Skip to content

Instantly share code, notes, and snippets.

@soundslikeinfo
Created August 24, 2020 23:53
Show Gist options
  • Save soundslikeinfo/6a6e49a68eefb4bdff909bdb084f9e38 to your computer and use it in GitHub Desktop.
Save soundslikeinfo/6a6e49a68eefb4bdff909bdb084f9e38 to your computer and use it in GitHub Desktop.
Using your CMC api token, retrieve the symbol and price for selected tokens
function cryptonumbers {
curl -H 'X-CMC_PRO_API_KEY: {CMC_PRO_API_KEY}' \
-H 'Accept: application/json' \
-d 'symbol=BTC,ETH,LTC' \
-G https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest | \
jq -r '.data | .[] | .symbol, .quote.USD.price' | \
while read -r SYMBOL; do
read -r PRICE
echo -e "${SYMBOL} - \$${PRICE}"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment