Last active
December 30, 2023 06:32
Get Crypto price
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
symbol=$(echo $1 | tr 'a-z' 'A-Z') | |
filter=".data.$symbol.name,.data.$symbol.quote.USD.price" | |
token=$(security find-generic-password -a "$USER" -s 'CMC_API_TOKEN' -w) | |
curl -s -H "X-CMC_PRO_API_KEY: $token" -H "Accept: application/json" -d "symbol=$symbol" "https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest" -G | jq $filter | tee >(pbcopy) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reg an CMC API Token at https://coinmarketcap.com
Add CMC_API_TOKEN to macos-keychain