How to connect Excel to Coinmarketcap API
Using the Coinmarketcap API, you can quickly get live ticker information into your Excel spreadsheet for your favorite cryptocurrency. With the free API that is available, in this article we will look at how you can connect to this API with Excel and keep your data up to date.
Obtaining a Coinmarketcap API Key
You can register and sign up for an API key here
https://pro.coinmarketcap.com/
The free key will allow you
- 9 market data endpoints
- 10K call credit/mo
Once you have registered, you will be able to access your developer’s dashboard. This contains the API key you will need. You will also find a quick link to the API documentation (https://coinmarketcap.com/api/documentation/v1/)
Creating a URL endpoint to connect to with Excel
The base of the API URL endpoint is
https://pro-api.coinmarketcap.com/v1/
We will add more to this URL so we can call call certain data. The API documentation lists the endpoints, but not all of them are available with the free API.
For our examples we will use the end point /cryptocurrency and for our endpoint paths we will look at /quotes/latest and /listings/latest
https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest will allow you access to current market information for 1 or more coins. The default price return is USD and you must use CONVERT to add other exchange rates.
You can find full details on the parameters here https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyQuotesLatest
The parameters allow you to basically filter and define what you want returned. For example, we want to return information for BTC,LRC,ADA. As these are coin symbols, we will use the symbol parameter at the end of the API URL. Each one separated with a comma.
https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=BTC,LRC,ADA
If you need to call more than a few listings as you would do with /quotes/latest, you can use /listing/latest. This will return a full list, by default the top 100 coins by ranking on coinmarketcap.
https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest
By adding different paths and parameter we can filter this list as required. You can find all the details of the parameter in the API documentation.
For Example, this URL will return the to 100 showing in BTC.
https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?convert=btc
And this URL will return only the coins with the tag for Defi
https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?tag=defi
Once we have created our API endpoints, we can then use these to connect Excel to Coinmarketcap data.
Connecting Excel to the Coinmarketcap API
- From the data ribbon, select From Web which can be found in the Get and Transform group of commands. This will open a From Web setup box.
- Select Advanced
- Enter the API URL endpoint to the first URL parts box
- In the HTTP request header parameters(optional) first box enter X-CMC_PRO_API_KEY (you will find this on the Authentication section of the API documentation)
- In the HTTP request header parameters(optional) second box enter your API Key and press OK.
- Excel will connect to the API and open up the Power Query window. The data is returned in JSON format and we must now extract the data. To learn more about working with JSON in Excel you can read this article.
- Select the row for Data List and click on the word list
- This will expand the lists of data. Select To Table from the ribbon and select ok for the default settings in the To table option box.
- Next expand the records by clicking on the column header. Select the columns you want to import and deselect Use original column name as prefix and press ok
- The new columns of data will expand. However, the quote field will still be a record that we must also expand
- Click on the expander in the column header for quote to expand the record.
- This opens another record which we much expand again. Click on the expander in the column header and select the columns you want to import
- This will import all the selected columns
- Carry out any required transformation steps, most notably ensuring all the data types are correct before you load to Excel.
- From the home Ribbon select Close and Load to load the data as a table in Excel.
Refresh the data from Coinmarketcap API in Excel
Once all the tables have been loaded into Excel, we can keep these up to date with the latest information. To update the data, from the data ribbon, select Refresh All.
Conclusion
Connecting to Coinmarketcap API with Excel is a great way to ensure you have the latest pricing information for Bitcoin and your favorite cryptocurrencies. This article was brief to show you the steps involved in connecting to the API and getting the ticker and current information into Excel.
To look further at the other API points listed in this article and to get some tips on the data transformations required, do check out this video.
SIGN UP
Over to you
What coinmarketcap end point do you like to use and why? Do you have any feedback on this article and video? If so, don't be shy and drop a comment below
SIGN UP
Cross posted from my blog with SteemPress : https://theexcelclub.com/how-to-connect-excel-to-coinmarketcap-api/
Really cool here Paula, thanks! I wonder, could we use this to grab hive data or is it too far down the list? I wouldn’t mind trying my hand at setting it up.
I might have missed it but could we save snippets of the data so we can get daily prices saved? It would be fun to do a bit of visualization with that type of info!
The answer is yes, there are Hive API,s but I have not looked at them. There is also the SQL which is even easier to get data from, however you have to pay a sub for the SQL data on hive. From the hive SQL you can chart and track all movement from the internal market, in which the price feed comes from the witnesses and exchanges. I use to do posts on it.
Oh you have to pay who for the hive data? That’s kind of a pain!
@hivesql - 4 HBD/day or 40 for the month :)
Oh man thanks, I don’t know if I’ll be spending that until I can have the ability to do consistent pulls! I guess it makes sense to charge for it lol
Yeah, there is time, effort, and cost to put it together.
with so much data at this stage, I say the cost of running is high enough
Congratulations @theexcelclub! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Do not miss the last post from @hivebuzz:
Upvoted by GITPLAIT!
We have a curation trial on Hive.vote. you can earn a passive income by delegating to @gitplait
We share 80 % of the curation rewards with the delegators.
To delegate, use the links or adjust 10HIVE, 20HIVE, 50HIVE, 100HIVE, 200HIVE, 500HIVE, 1,000HIVE, 10,000HIVE, 100,000HIVE
Join the Community and chat with us on Discord let’s solve problems & build together.