Created
December 4, 2017 19:47
-
-
Save rynote/9fc04be3e7a0cf0c7427ad83abfb037c to your computer and use it in GitHub Desktop.
BASH commands for grabbing Bittrex exchange rates
This file contains 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
#Bittrex fun Bash commands: | |
#requires 'curl', 'jq' and 'bc' | |
#To get a quote from bittrex and return it as BTC | |
curl -s https://bittrex.com/api/v1.1/public/getticker?market=BTC-MEME | jq '.["result"]["Last"]' | awk '{ print sprintf("%.8f", $1); }' | |
#To get USDT price of BTC at bittrex | |
curl -s https://bittrex.com/api/v1.1/public/getticker?market=USDT-BTC | jq '.["result"]["Last"]' | awk '{ print sprintf("%.2f", $1); }' | |
#One-liner to get quote and convert it to USD via USDT-BTC rate | |
echo `curl -s https://bittrex.com/api/v1.1/public/getticker?market=BTC-MEME | jq '.["result"]["Last"]' | awk '{ print sprintf("%.8f", $1); }'`"*"`curl -s https://bittrex.com/api/v1.1/public/getticker?market=USDT-BTC | jq '.["result"]["Last"]' | awk '{ print sprintf("%.2f", $1); }'` | bc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment