Files: f1521af2d73e96acaa4e96dfc60dbfc50373845a / gethistoric
513 bytesRaw
1 | |
2 | |
3 | req_date="$2" |
4 | if [[ -z "$req_date" ]] || [[ -z "$1" ]] |
5 | then |
6 | echo "Usage: $0 [CURRENCY] [yyyy-mm-dd]" >&2 |
7 | exit 1 |
8 | fi |
9 | |
10 | req_date="${req_date%% *}" |
11 | |
12 | case $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¤cy=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 | ;; |
22 | esac |
23 |
Built with git-ssb-web