bettertouchtool-crypto
bettertouchtool-crypto copied to clipboard
Request: Is it possible to get an example to fetch from the coinmarketcap API?
I.e. if I want to fetch the price from the coinmarketcap API for the ticker Monero, I can use this link to get the price in EUR: https://api.coinmarketcap.com/v1/ticker/monero/?convert=EUR
It returns a JSON body which includes the price. The only thing I don't understand is how to parse that from the JSON using the apple scripting language. Would it be possible to receive an example? I can write the documentation for people how to add any ticker this way using coinmarketcap.
Thank you for making this! Will feature it on Cryptominded.com as Resource of the day next week.
@dylandamsma Sorry for the delayed response. The answer it to use "grep" or "sed" or any other unix based tool. BetterTouchTool uses Apple script but can run Unix commands so that's how we do it. When I have time, I can add features to use the coinmarketcap.com API. Probably two weeks from now.
Would be amazing if it was easy to access any coin from Coinmarketcap.
If I could easily use the URL for Coinmarketcap API and a URL for the coin icon, I could easily customize this for myself with my favorite coins.
@zachherbert This snippet of AppleScript will get any price from https://coinmarketcap.com/ . It depends on having jq
installed for grabbing stuff out of the JSON. See https://stedolan.github.io/jq/
set value to do shell script "curl -s https://api.coinmarketcap.com/v1/ticker/bitcoin/ | /usr/local/bin/jq '.[0].price_usd | tonumber'"
return "$" & value
PR created here for CoinMarketCap: https://github.com/krunkosaurus/bettertouchtool-crypto/pull/8