How to import CoinMarketCap Professional API (Ex: Excel, PHP)
After its latest update (API v2) CoinMarketCap has released the Professional API as a high performance suite designed specifically to meet the demands of mission critical. They have alerted the API publisher to migrate to the new on December 4th, 2018 (documentacion).
This new version requires authentication by query string parameter or http headers, to make requests you must use an APIKey provided by https://pro.coinmarketcap.com once you have registered and selected the plan.
To connect from excel we will use the query string parameter authentication (CMC_PRO_API_KEY), we are going to build list all cryptocurrencies
https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest? CMC_PRO_API_KEY=YOU-API-KEY
by default it will return 100 results, to request more you must go through method get start-limit:
https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest? CMC_PRO_API_KEY=YOU-API-KEY&start=1&limit=500









Result:

From PHP we will use HTTP header authentication (X-CMC_PRO_API_KEY). It must be built:
Response
{
"status": {
"timestamp": "2018-09-03T01:31:16.853Z",
"error_code": 0,
"error_message": null,
"elapsed": 9,
"credit_count": 1
},
"data": [
{
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"slug": "bitcoin",
"circulating_supply": 17246537,
"total_supply": 17246537,
"max_supply": 21000000,
"date_added": "2013-04-28T00:00:00.000Z",
"num_market_pairs": 5969,
"cmc_rank": 1,
"last_updated": "2018-09-03T01:29:24.000Z",
"quote": {
"USD": {
"price": 7263.51184063,
"volume_24h": 4296985869.55096,
"percent_change_1h": -0.28406,
"percent_change_24h": 1.37385,
"percent_change_7d": 8.14548,
"market_cap": 125270425709.36339,
"last_updated": "2018-09-03T01:29:24.000Z"
Comments
Post a Comment