Last active
February 7, 2018 04:28
-
-
Save raymanoz/b1722a03e6e659651d9da28ceb1a9655 to your computer and use it in GitHub Desktop.
Historical crypto value conversion. Eg get the AUD value of half a BTC on some date in the past
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ts=$(date -j -f "%Y%m%d" "$1" "+%s") | |
from=$2 | |
to=$3 | |
convert=$4 | |
result=$(curl -s "https://min-api.cryptocompare.com/data/pricehistorical?fsym=${from}&tsyms=${to}&ts=${ts}") | |
toValue=$(echo ${result} | jq -r ".${from}.AUD") | |
echo "${to}: ${toValue}" | |
echo "${toValue}*${convert}" | bc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: