Upgrading to Coinmarketcap.com API v2
As someone of you may know, I published a cryptocurrency portfolio template for Google sheet. It uses coinmarketcap.com's API to get it's prices.
Yesterday, coinmarketcap released their API v2. They are deprecating API v1 on November 30th, 2018. So, I tried upgrading my template to use the new API.
At first look, the API didn't seem to change much. It provides almost same data and almost same arguments. The resulting JSON is more structured.
The largest change is the coin ID. It used to accept string (which they call website_slug) which is the last url string of the cryptoasset's webpage. It is replaced by their internal numeral id. The JSON results contains the "id" for each cryptoassets. But client need to know the "id" before it makes a request to get each coin info from the API. So I had to make a lookup table by enumerating all coins and save to a sheet. I also added "CMC ID" column, so the script doesn't have to use the lookup table every time it sends an API request.
The next thing the new API didn't return was price in BTC. So I had to calculate the price in BTC by getting the price of Bitcoin in USD first and calculate the price for each coin's USD value.
They were getting too many requests and was forced to make the API less friendly to achieve better server performance. I agree with the decision they made. But they should have at least considered providing a lookup API for coins, so developers don't have to enumerate all coins to build a lookup table.
Here's the new template. I think I need to test it more before upgrading the already shared template.
https://docs.google.com/spreadsheets/d/18eNXwr6a8LEYQYvfw6zvLgBPBZAPs8z4jWywvz7oWao/edit?usp=sharing
If you are using template v2, you can replace the script and it will function properly. On first run, it will add a "lookup" sheet which takes a few minutes.
Leave Upgrading to Coinmarketcap.com API v2 to:
Read more #cryptocurrency posts
Best Posts From mix1009
We have not curated any of mix1009's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From mix1009
- Push Authenticator Pro for iOS and Android released!
- Scam Alert: EOS Black bonus tokens
- Bloks Desktop wallet for EOS with Ledger Nano S support
- Power Up your KARMA (EOS token)
- Get Free EOS RAM : 1400 bytes for each account
- TradingView Tips
- Ledger Nano S now supports EOS
- Cryptocurrency Portfolio v3 for Google Sheets
- CoinMarketCap Public API to be removed on December 4th, 2018
- Checking your EOS Airdrop tokens