git ssb

0+

cel / ledger-scripts



Tree: f1521af2d73e96acaa4e96dfc60dbfc50373845a

Files: f1521af2d73e96acaa4e96dfc60dbfc50373845a / gethistoric

513 bytesRaw
1#!/bin/bash
2
3req_date="$2"
4if [[ -z "$req_date" ]] || [[ -z "$1" ]]
5then
6 echo "Usage: $0 [CURRENCY] [yyyy-mm-dd]" >&2
7 exit 1
8fi
9
10req_date="${req_date%% *}"
11
12case $1 in
13 BTC)
14 echo -n \$
15 curl -s "http://api.coindesk.com/v1/bpi/historical/close.json?start=$req_date&end=$req_date&currency=USD" | jq ".bpi[\"$req_date\"]"
16 ;;
17 ZEC|ETH|ETC|REP)
18 ts=$(date +%s --date="$req_date")
19 echo -n \$
20 curl -s "https://min-api.cryptocompare.com/data/pricehistorical?fsym=$1&tsyms=USD&ts=$ts" | jq ".$1.USD"
21 ;;
22esac
23

Built with git-ssb-web