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.
Great work Sir...Thank you for share the template.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you so much....i am using template v2.Try to replace the script
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you. If you find any problem with the migration, I'm here to help :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you for your explaination.
I saw they changed their api, but it's not user friendly at all.
I will look to update my scripts to make everything works like it should. But i still doesnt understand why they have to make it like this why their previous api was much more user friendly
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This isn't the worst of the API upgrades. Dropbox v1 to v2 was rough (They didn't have proper ObjC support when I migrated) . The worst was YouTube API v2 to v3 update. If you cache it intelligently, it could make your client faster. But it sucks to update a working system just to provide the same functionality.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Very kind of you to put this together sir. I admit I am not using it but it looks like others are, which must make you feel good about the usefulness of your hard work.
Programming was never my thing, kudos to you!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thanks, as always for your kind words. I like to create things. The best thing about programming is that you see results immediately. And fixing my mistakes is rather easy.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi there,
I've followed all the "HOW TO USE" steps.
However the document won't update...
The displayed error is the following:
Am I the only one having this issue? If not, pls upvote! :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I think you hit the API limit for the day. Maybe you have lots of coins or maybe your timer is set very frequently. I have about 45 coins and call UPDATE every 10 minutes. I didn't encounter error with my settings. If you have 30+ coins, the script tries to get top 100 listing and uses the results. You could try changing "var useBatchRequestThreshold = 30;". If you coins are mostly in top 100 it will reduce your API call (urlfetch). Try to set it to lower than number of coins.
You'll have to wait to have the error go away.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
The script had a bug when calling RECORD_HISTORY. I've updated the script. If you copied the script, please update the script. (setupHistoryHeader function has been updated)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I've updated the script today. They added a new API that lists all crypto ids. So instead of calling top crypto currencies multiple times to build the lookup table, now it's just one API call. Thanks CMC.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi
what if you have 35 coins in your portfolio?
we have to make one call for each coin if it is not in the top 100 coins.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
could you please share the new update?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
항상 잘 쓰고 있습니다. 고맙습니다. 그런데 이번 버전에서는 시트내에 있는 UPDATE버튼 관련해서 에러가 뜨는데요.
혹시 해결책이 없을까요. 에러메세지는 다음과 같습니다.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I am getting this issue very often as well, is there anyway to fix our script to avoid the error?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit