bitpie钱包|coinmarketcap api

作者: bitpie钱包
2024-03-15 11:03:41

Most Trusted Cryptocurrency Market Data API | CoinMarketCap

Trusted Cryptocurrency Market Data API | CoinMarketCapCoinMarketCapDevelopersAPI DocumentationPricingFAQLog InThe world's cryptocurrency data authority has a professional API made for you.Get Your API Key NowCompare API PlansA new suite of powerful, flexible, and accurate cryptocurrency market data endpoints.From demanding enterprise use cases to economical pricing plans for startups, there is a plan for you.Created by the most trusted cryptocurrency market data provider in the industry.Your private key for all crypto use cases.Backtest your strategiesUse the best possible crypto data to run simulations and backtest your trading or investing strategies. With data aggregated from hundreds of exchanges and thousands of coins, you can be sure that you're getting the right picture every single time.All time historical data available on our Enterprise plan, ensuring that you have full visibility of all cryptocurrency data since 2013.Chart the right dataShow your users the most accurate data on the market with our API. Whether you're building a wallet, a portfolio management tool, a new media offering, or more, we have the most advanced and updated data on the market for your product.(only available on Standard and Professional plans)Beat the competitionCheck in on how other exchanges and coins are doing with our markets data. With deep insight into current and past pricing, volume and exchange info, you can make the right decisions to stay ahead of the game.Run experimentsBuild your own models with our data, to further your interest or just for fun. With our flexible and powerful API, we provide you with a set of data that will help you draw insights and make conclusions.View PlansMore new features coming soon.Subscribe to stay up-to-date on Pro API feature updates Live price streamingSocial dataNews dataWhitepaper searchCharts snapshotMost watchlisted© 2024 CoinMarketCapPricingAPI DocumentationFAQAPI Sta

如何通过 CoinCap.io 的 API 免费获取区块链交易数据 - 知乎

如何通过 CoinCap.io 的 API 免费获取区块链交易数据 - 知乎首发于币圈金马奖切换模式写文章登录/注册如何通过 CoinCap.io 的 API 免费获取区块链交易数据金马搞事情的程序员,给你希望与方向最近因为每天和区块链交易数据打交道,所以今天继续写获取数据的方式,昨天我写了一篇文章,如何通过 CoinMarketCap 获取比特币交易数据,如果你没有任何编程基础,直接使用手动复制的方法获取区块链交易数据就可以,请参考文章。如果你想使用 API 获取区块链的交易数据,就会发现 CoinMarketCap 太贵了,根本用不起来,免费的 API KEY 只能获取一些比较简单的数据,比如历史交易数据就需要收费,这也是我发现为什么身边人都不使用 CoinMarketCap 的 API。为什么我们这么执着的要使用 API 而不是手动呢?因为交易数据一直在增加,如果用手动的话,就太累了,但是如果用 API,我们就可以写一个程序,然后定时的抓取到对应的交易数据,然后自动处理就可以了。那有没有别的方案,既可以是 API,又是免费的?有的,就是我今天要介绍的网站:CoinCap.io | Reliable Cryptocurrency Prices and Market Capitalizationshttp://CoinCap.io 介绍http://CoinCap.io 也是一个行情软件,先团队介绍请查看:Company Information – ShapeShift 根据团队介绍,这个团队应该主要做着另外一个更厉害的项目 ShapeShift,ShapeShift 是一个可以帮你快速完成币币兑换的平台,不要登记,不收法币,不保留你的币,如果你感兴趣可以了解一下。对了,http://CoinCap.io 除了有网页版,还有安卓和 iOS 的移动版本,使用了一下还不错。http://CoinCap.io API 如何使用?首先请查看文档地址:https://docs.coincap.io/API 提供两种方式,一种是 RESTful API,一种是 WebSocket,非常方便,你可以根据你的具体情况来使用。当然,更方便的是所有接口不需要认证,任何人都可以调用,简直太好用了。举例子,如果我们要简单获取比特币过去每天的价格(http://CoinCap.io 只提供 Volume-weighted price 成交量加权价格),那么我们只需要使用接口:你可以使用任意的一个终端或者 Postman 来测试,非常方便。http://CoinCap.io 可以提供的 API 包括几大类:Assets 资产情况(比如查看比特币的历史数据),Rates 外汇兑换汇率情况(http://CoinCap.io 使用的是 USD,如果要换成别的币种需要这个接口查看汇率),Exchanges 交易所情况,Market 行情情况,Candles K 线情况。http://CoinCap.io 的比特币历史交易数据准确吗?这么好用,我有点担心 http://CoinCap.io 提供的数据的准确性,为了验证,我就把 http://CoinCap.io 提供的比特币历史数据和 CoinMarketCap 提供的数据进行对比,对比结果如下,因为一个是收盘价,一个是成交量加权价格,所以会有一些差别,但是总体来说这些数据是值得参考,也可以拿来使用做回测的。CoinMarketCap 2018年06月27日 BTC 收盘价格 6157.13 USDhttp://CoinCap.io 2018年06月27日 BTC 成交量加权价格 6128.22 USDCoinMarketCap 2014年11月29日 BTC 收盘价格 375.49 USDhttp://CoinCap.io 2014年11月29日 BTC 成交量加权价格 377.99 USD「注意」 我是金马,别人离开币圈的时候,正是我深耕的时候。这是我日更的的115天,你的熊市,让我陪你度过可好?币圈金马奖,和你一起走币圈这条光明大道。希望和你成为朋友,我的微信:lijinma888发布于 2019-02-20 18:47区块链(Blockchain)交易定投​赞同 2​​1 条评论​分享​喜欢​收藏​申请转载​文章被以下专栏收录币圈金马奖专注区块链社群、媒体、项

如何通过 CoinMarketCap 获取比特币交易数据 - 知乎

如何通过 CoinMarketCap 获取比特币交易数据 - 知乎首发于币圈金马奖切换模式写文章登录/注册如何通过 CoinMarketCap 获取比特币交易数据金马搞事情的程序员,给你希望与方向最近在写定投的教程,需要使用比特币、ETH、EOS 等历史交易数据,就上网搜寻,找到了一个比较靠谱的帖子分享给大家:比特币历史数据哪里可以拿到? - 知乎作者:BigQuant链接:https://www.zhihu.com/question/265468047/answer/294443015来源:知乎著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。数字货币最近有点火。提供几个可供下载的地址:Cryptocurrency Market Capitalizations | CoinMarketCap 主要包括各个数字货币现货数据以及货币对在各个平台上的交易行情数据 CoinCapDev/http://CoinCap.io这是一个开源项目,相当于是提供了下载的接口Bitcoin (BTC) - Live Bitcoin price and market cap 比特币价格实时数据和市场数据Cryptocurrency data API for over 40 exchanges and 600 coins(BTC,ETH,XMR + 600 other cryptos) 提供600多个数字货币、40个交易平台的数据接口BTC USD Historical Data - http://Investing.com 可直接下载某段时间段的比特币价格数据(日线、周线、月线)Quandl 提供json\csv的数据文件下载Cryptocurrencies Trading Strategy With Data Extraction Technique 不仅有数据,还有交易策略Bitcoin Price Index - Real-time Bitcoin Price Charts 比特币实时交易价格数据Digital Currency Data for Investors and Miners - http://Spreadstreet.ioComplete Bitcoin Price History Chart + Related Events (2009 - 2018)提前透露一下,BigQuant 也在计划支持数字货币及策略开发,希望早点和各位见面!这个作者分享的这些内容中,我都进行了一些尝试,但是效果一般,最后还是决定使用 CoinMarketCap,如果你需要数据建议使用 Bitcoin (BTC) 历史数据 | CoinMarketCap,这里的数据比较权威,也比较完整。只想获取一些简单数据怎么办?如果你只想获取一些简单的数据,而且你没有编程经验,建议你使用如下的方法,非常简单,也很使用。比如你只想获取:日期 开盘价 最高价 最低价 收盘价 交易量那么可以直接使用网站:Bitcoin (BTC) 历史数据 | CoinMarketCap,选择好你需要的数据的日期,然后复制网站的数据,然后粘贴到 Excel 中,可能粘贴过程中会有问题,可以尝试先粘贴到空白文本,然后修改分隔符,转化成 CSV 格式。不过根据我的尝试,比特币最早的数据应该只有2013年04月28日,更靠前的数据没有,之前确实交易所也比较少。如果你想使用 API 获取数据怎么办?事实上,CoinMarketCap 也提供了方便的 API 供你来获取数据,但是获取历史数据情况是收费的。打开:Most Trusted Cryptocurrency Market Data API | CoinMarketCap先注册一个账户,然后就可以获取到自己的 API KEY。这个 KEY 怎么用呢?在你请求的 API 中,请添加一个 Header“X-CMC_PRO_API_KEY”: “b54bcf4d-1bca-4e8e-9a24-22ff2c3d462c”或者更简单一点,在 URL 添加一个 query string parameter&CMC_PRO_API_KEY=b54bcf4d-1bca-4e8e-9a24-22ff2c3d462c类似上面的请求方法。具体你可以查看文档:https://coinmarketcap.com/api/documentation/v1/#section/Quick-Start-Guide接着,你就可以获取你想要的交易数据了。使用的 API 如下:Get OHLCV values (historical)https://coinmarketcap.com/api/documentation/v1/#operation/getV1CryptocurrencyOhlcvHistorical但是无奈这个接口太贵了。还在寻找其他更方便的接口。「注意」 我是金马,别人离开币圈的时候,正是我深耕的时候。这是我日更的第114天,你的熊市,让我陪你度过可好?币圈金马奖,和你一起走币圈这条光明大道。希望和你成为朋友,我的微信:lijinma888发布于 2019-02-19 19:18区块链(Blockchain)比特币 (Bitcoin)定投​赞同 16​​3 条评论​分享​喜欢​收藏​申请转载​文章被以下专栏收录币圈金马奖专注区块链社群、媒体、项

Register for CoinMarketCap's API | CoinMarketCap

ster for CoinMarketCap's API | CoinMarketCapLearnTopicsCoinMarketCap UpdatesLanguageGlossaryAuthorsEnglishBahasa IndonesiaDeutschEspañolPortuguês BrasilTiếng ViệtTürkçeРусскийУкраїнськаไทยLearnBlogCMC ResearchCrypto BasicsHow-to GuidesTech Deep DivesTrading AnalysisTopicsAltcoinsBitcoinBlockchainDeFiEthereumGameFiMetaverseNFTsTradingCoinMarketCap UpdatesAnnouncementsFeature ExplorerMarketingGlossaryAuthorsEnglishBahasa IndonesiaDeutschEspañolPortuguês BrasilTiếng ViệtTürkçeРусскийУкраїнськаไทยRegister for CoinMarketCap's APICoinMarketCap UpdatesRegister for CoinMarketCap's APIBy Emanuel Scicluna1mCreated 1yr ago, last updated 1yr agoRegister for the CoinMarketCap API — it's as easy as 1..2..3.If you're already checking CoinMarketCap every day for your daily dose of cryto prices, CMC's API can give you even more data to make more informed decisions in the market.CMC offers API plans that start at free for personal use, and increases in price depending on what your data needs are. Check out our API plans available here.To get started with using the CMC API, you need to start by registering a new account to get your API key. You can start here!Once you have registered, you can now get your API key from your API dashboard:Almost there! You can now read about our API in our documentation: we recommend using Postman as the easiest way for testing the API. You can download it here.After you set up Postman, you can import CMC's latest Postman collection — following the steps in the screenshot below — by adding this URL: https://pro-api.coinmarketcap.com/v1/tools/postmanFinally, you can update the collection variables by setting the base URL to https://pro-api.coinmarketcap.com and selecting your new API key. You can follow the five simple steps in the image below to set this up.And that's it! You can now start using our set of APIs! Each entry has default parameters set up, so you can get started without a lot of configuration.15 people liked this articleEmanuel SciclunaI'm an engineer at CMC.Related ArticlesFeature ExplorerAn In-Depth Look at CoinMarketCap’s Newly Improved Liquidity Score for Finding the Best Crypto Ex...Originally published on May 8, 2020.By CoinMarketCap3mo ago7mFeature ExplorerA Basic Guide to Using Liquidity to Find the Best Crypto ExchangesOriginally published on May 8, 2020By CoinMarketCap3mo ago3mFeature ExplorerCan You Trade Crypto on CoinMarketCap?Confused what CoinMarketCap does and does not offer.? Let us help you out!By Yousra Anwar Ahmed4mo ago2mSee all articlesJoin the thousands already learning crypto!Join our free newsletter for daily crypto updates!Subscribe©2024 CoinMarket

CoinMarketCap API - An Introductory Guide - AlgoTrading101 Blog

CoinMarketCap API - An Introductory Guide - AlgoTrading101 Blog

From $0 to $1,000,000. Authentic Stories about Trading, Coding and Life

→ Learn Algo Trading

Share

Reply

1

Igor Radovanovic Follow

CoinMarketCap API – An Introductory Guide

8 min read

Get 10-day Free Algo Trading Course

Last Updated on April 3, 2023

Table of contents:

What is CoinMarketCap?Is CoinMarketCap API free?Why should I use CoinMarketCap?Why shouldn’t I use the CoinMarketCap?What are the alternatives to using CoinMarketCap?What coding languages/clients are available for CoinMarketCap?How to get started with CoinMarketCap API?What are the CoinMarketCap API cryptocurrency functions?How to obtain metadata using CoinMarketCap API?How to get the ID Map data with CoinMarketCap API?How to get quote data using CoinMarketCap API?How to get the latest listing data using CoinMarketCap API?How to get Fiat data using CoinMarketCap API?What are the CoinMarketCap API exchange functions?How to get global-metrics using CoinMarketCap API?How to use the CoinMarketCap API price conversion tool?How to use partners endpoints in CoinMarketCap API?How to use CoinMarketCap API in Google Sheets?More about CoinMarketCapFull code

What is the CoinMarketCap API?

The CoinMarketCap API is a method to retrieve cryptocurrency data such as price, volume, market cap, and exchange data from CoinMarketCap using code.

We will demonstrate this in this article using Python.

CoinMarketCap is one of the most popular websites used for tracking various cryptocurrencies and obtaining data about them.

Link: https://coinmarketcap.com

Is the CoinMarketCap API free?

The website of the CMC is free to use and the payment is necessary if you want more API functions.

CoinMarketCap API offers a free plan among the other 4 available ones. With the free plan you have access to the 9 market data endpoints:

Crypto referential and info logo and logo assetsLatest Global Market cap, volume and statsLatest crypto rankings and market quotesLatest crypto and flat currency conversionsPartner data access

The STARTUP plan which is 79$ per month, gives you access to 14 market endpoints like historical data and OHLCV. On the other hand the STANDARD and PROFESSIONAL plans give you access to 22 market endpoints.

The number of free CMC API call credits per month is 10k and, with the other paid packages, it can even go up to 3 million or more.

In my opinion, the free plan is at a huge disadvantage compared to the premium plans and there are other websites similar to CMC that give you free access to the endpoints that CMC doesn’t give you. For example, check out our CoinGecko article:

You can see the other available plans from the picture below:

Why should I use CoinMarketCap?

Has a free planEasy to useInformativeTracks a great number of coins and exchangesHas a mobile APPGood API

Why shouldn’t I use the CoinMarketCap?

Doesn’t offer enough metricsIsn’t always preciseThe free plan is severely limitedThere are some suspicions that CMC favors its parent (Binance) company when it comes to rankings.

What are the alternatives to using CoinMarketCap?

CoinMarketCap can be replaced with other websites that can be more suitable for you needs. Here are some of them:

CoinGeckoBlockchain walletCoinsflareCoincodexViewBaseCryptoCompareBlockfolioWallmineCoincheckupCesiumCryptonaut

What coding languages/clients are available for CoinMarketCap API?

You can use the CMC API with the following clients:

PythonNode.jsJavaPHPC#GoGoogle SheetsExcel

How to get started with CoinMarketCap API?

In order to get started with the CoinMarketCap API you’ll need to obtain your API key from the following link:

https://coinmarketcap.com/api/

Click on the “GET YOUR API KEY NOW” button and fill up the sign-up information. After you input the relevant data, go over to your email to confirm it. After that, you’ll be taken to the following screen:

As you can see you can easily disable and generate new API keys.

For this tutorial we’ll be using Python, so let’s go over and install the CoinMarketCap library with the following command:

pip install python-coinmarketcap

Have in mind that for most of the next chapters we’ll be using the Jupyter Notebook.

What are the CoinMarketCap API cryptocurrency functions?

The main cryptocurrency endpoints that the CMC offers us are the following:

MetadataHistorical listingsHistorical quotesHistorical OHLCVCMC ID MapLatest QuotesLatest ListingsLatest Market PairsLatest OHLCVPrice performance stats

We’ll cover all of the free plan endpoints in the following chapters.

How to obtain metadata using CoinMarketCap API?

The CMC metadata endpoint returns all the static data that is available for the specified cryptocurrency. The information obtained contains the following: logo, description, website URL, various social links and other.

In order to obtain crypto metadata, we’ll need to import the CMC library and set the client up.

import coinmarketcapapi

cmc = coinmarketcapapi.CoinMarketCapAPI(‘YOUR API KEY’)

Now, let’s make a call that will provide is with the overall data for the Bitcoin cryptocurrency.

data = cmc.cryptocurrency_info(symbol='BTC')

data

How to get the ID Map data with CoinMarketCap API?

The CMC ID Map endpoint obtains a mapping of all currencies with their unique ID’s. Each currency obtained by this endpoint will return standard identifiers as name, symbol and token address.

This endpoint will return crpytocurrencies that have actively tracked markets on supported exchanges by default. The data obtained will also provide the first and last historical data timestamps.

In order to obtain this endpoint, after validating your API Key, do the following:

data_id_map = cmc.cryptocurrency_map()

You may want to make the data more readable by putting it into a pandas data frame. For this, you need to do the following:

import pandas as pd

pd = pd.DataFrame(data_id_map.data, columns =['name','symbol'])

pd.set_index('symbol',inplace=True)

print(pd)

How to get quote data using CoinMarketCap API?

The CMC quote data endpoint returns the latest market quote for a specified cryptocurrency. Moreover, we can convert this data easily into a wanted currency. All we need to do is the following:

data_quote = cmc.cryptocurrency_quotes_latest(symbol='ETH', convert='USD')

If you want to create this into a Pandas data frame you can check out our previous ID Map example.

How to get the latest listing data using CoinMarketCap API?

The CMC latest listings endpoint obtains a list of all active cryptocurrencies with their latest market data.

Like in our previous example, we can convert the data into a preferred currency and rank it differently if we wish to:

data_listing = cmc.cryptocurrency_listings_latest()

How to get Fiat data using CoinMarketCap API?

According to Investopedia, Fiat money is a government-issued currency that is not backed by a physical commodity, such as gold or silver, but rather by the government that issued it.

Firstly, let’s import the relevant library, authenticate the API Key and call our endpoint:

from coinmarketcapapi import CoinMarketCapAPI

cmc = CoinMarketCapAPI('b44c1fd8-1c05-45b9-8df7-380a409f9b69')

fiat = cmc.fiat_map()

What are the CoinMarketCap exchange functions API?

The CMC has 7 Exchange options and none of the are available for the basic plan:

CMC ID mapMetadataLatest ListingsLatest QuotesHistorical ListingsHistorical Quotes

How to get global-metrics using CoinMarketCap API?

The CMC global-metrics option has 2 endpoints (historical and latest quotes). The latest quotes one is the only one available for the basic plan so let’s see what it does.

Let’s import he relevant library, authenticate the API Key and call our endpoint:

from coinmarketcapapi import CoinMarketCapAPI

cmc = CoinMarketCapAPI('b44c1fd8-1c05-45b9-8df7-380a409f9b69')

global_quote = cmc.globalmetrics_quotes_latest()

How to use the CoinMarketCap API price conversion tool?

The CMC price conversion tool endpoint allows us to convert a specified amount of one cryptocurrency or fiat currency into other currencies by utilizing the latest market rate for each of them.

In this example we’ll convert the BTC currency to USD with a specified amount (20).

Let’s import the relevant library, authenticate the API Key, and call our endpoint:

from coinmarketcapapi import CoinMarketCapAPI

cmc = CoinMarketCapAPI('b44c1fd8-1c05-45b9-8df7-380a409f9b69')

tool=cmc.tools_priceconversion(amount=20, symbol='BTC',convert='USD')

tool

How to use partners endpoints in CoinMarketCap API?

The CMC partners endpoints provides us with the FCAS latest listings and quotes.

FCAS stands for The Fundamental Crypto Asset Score, which is a comparative metric used to determine the fundamental health of the crypto project.

In CMC the FCAS endpoint returns a paginated list of FCAS scores for all cryptocurrencies. Let’s import he relevant library, authenticate the API Key and call our endpoints

from coinmarketcapapi import CoinMarketCapAPI

cmc = CoinMarketCapAPI('b44c1fd8-1c05-45b9-8df7-380a409f9b69')

FCAS_listing = cmc.partners_flipsidecrypto_fcas_listings_latest()

FCAS_quote = cmc.partners_flipsidecrypto_fcas_quotes_latest(symbol='LTC')

How to use CoinMarketCap API in Google Sheets?

CMC can be easily integrated into Google Sheets. Let us go over the steps together and pull some data into our Google Sheets.

The first thing we need to do is to navigate ourselves to the “Script Editor” menu that is located on the main tool ribbon.

After that, we will start the building process of our script. Firstly, we will make a variable that will pull the data onto a specified sheet.

var sh1 =SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1');

For this example, we will want the latest quotes for the Etherium cryptocurrency that is converted to USD. Let’s code our request:

var requestOptions = {

method: ‘GET’,

uri: ‘https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest’,

qs: {

start: 1,

limit: 4000,

convert: ‘USD’

},

headers: {

‘X-CMC_PRO_API_KEY’ : ‘YOUR API KEY HERE’

},

json: true,

gzip: true

};

The next step is to create a variable that will access the URL for our API request:

var url=https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=ETH;

The next thing we need to specify is a function that will obtain all the data from the JSON file. So let us create a result variable:

var result= UrlFetchApp.fetch(url, requestOptions);

As the data wouldn’t be useful in the JSON modality we will want to convert it to a string. That being said, out next step is to create a function that will put it into a txt format:

var txt= result.getContentText();

As we need to make the data readable, we will parse the data into different Javascript objects. Let us create another variable that does that:

var d=JSON.parse(txt); 

sh1.getRange(1, 2).setValue(d.data.ETH.quote.USD.price)

}

We’re ready! Let’s save the function and click “Run”. After that, be sure to authorize the function.

After you run the function you should see the data in your second column. I’ll write the word Etherium next to it.

More about CoinMarketCap

CoinMarketCap (CMC) was founded in 2013, and one of the primary tasks that it has set for itself is to add transparency and accountability when it comes to cryptocurrencies and aggregation of the Market data.

Moreover, they offer a holistic approach to data aggregation and state that it is better to overprovide data than to censor or police the information.

Binance, a leading cryptocurrency exchange, has acquired CMC in April of 2020 for $400 million dollars.

Lately, CMC is looking to expand its horizons by adding educational content that could inspire and educate a whole new generation of crypto traders. They decided to call this expansion “CMC Alexandria” which is a reference to the ancient Library of Alexandria.

When it comes to cryptocurrencies, CMC tracks over 7 thousand of them. On the other hand, the number of markets the CMC tracks is over 33 thousand.

CMC also provides three ways of ratings for exchanges:

Top 100 By Adjusted Volume – provides volumes of spot trading platformsTop 100 By Reported Volume – provides volumes of all spot trading platforms, no matter what trading models they useBy Liquidity – shows all trading platforms by liquidity

CMC has a listings criteria as they deem the quality of their data of utmost importance. They state 3 main principles of data admissibility and they are the following:

Credibility: Is the requester able to substantiate his/her case with supporting evidence?Verification: Are we able to verify the information from credible and independently verifiable sources?Methodology: Is this request in accordance with our methodology?

You can read more about the said criteria on the following link:

https://support.coinmarketcap.com/hc/en-us/articles/360043659351-Listings-Criteria

As the CMC provides us with the minute updates of all market data it provides, all data is run through several cleaning and verification algorithms.

One raises a question in what way do these algorithms work and how are the following metrics calculated:

PriceVolumeMarket CapitalizationLiquidity ScoreWeb Traffic FactorSupply and more.

Good news that the CMC shares the methodology behind the mentioned metrics which can be read on the following link:

https://support.coinmarketcap.com/hc/en-us/sections/360008888252-Metric-Methodologies

The CMC API is a powerful tool that is built on a high-performance RESTful JSON endpoints.

CMC even excludes markets with no fees as there could be malicious activities going behind them. For example, a trader or bot can trade back and forth with himself and make a lot of illusory volume. This volume could deceive others.

We should also have in mind that the CMC doesn’t offer a way to purchase a cryptocurrency. Their main role is to only provide data on it.

CMC offers us a mobile app that is available for iOS & Android. With it, we can track crypto and exchange ranking data, build our portfolio and watchlist, obtain crypto price alerts, get cryptocurrency and blockchain news, and get global stats that are ready for conversion.

CMC also has a blockchain explorer which you can check out on the following link:

https://blockchain.coinmarketcap.com/?utm_source=coinmarketcap&utm_content=footer

Full code

Github link

Igor Radovanovic Follow

Programming

Trading

« CoinGecko API – A Complete Guide

Crypto Arbitrage Guide – What It Is and How to Find It »

Blankly – Python Backtesting Guide

Igor Radovanovic

Apr 20, 2023

10 min read

OpenBB Platform – A Complete Guide

Igor Radovanovic

Jan 23, 2024

13 min read

LEAN Engine (on AWS) and Interactive Brokers Guide

Igor Radovanovic

Nov 12, 2023

4 min read

One Reply to “CoinMarketCap API – An Introductory Guide”

Pingback: CoinGecko API - A Complete Guide - AlgoTrading101 Blog

Comments are closed.

Our AlgoTrading101 Course is full - Join our Wait List here

RSS Feed Link

Login for Writers

© Copyright AlgoTrading101 Blog

Beginner's Guide to the CoinMarketCap API with Python (TUTORIAL) - YouTube

nner's Guide to the CoinMarketCap API with Python (TUTORIAL) - YouTubeAboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new features© 2024 Google

CoinMarketCap API — Public APIs

MarketCap API — Public APIsApp BackendA simple backend for your static website to make dynamic.Start for freePublic APIsBlog ArticlesSaved APIsList Your APICoinMarketCapFinanceVisit API documentation pageExploring the Coinmarketcap Public API

Coinmarketcap is one of the most popular websites for tracking cryptocurrency prices. They offer a free public API to access their cryptocurrency data. In this article, we'll explore how to use this API and provide code examples in JavaScript.

Prerequisites

Before we start, make sure that you have Node.js installed on your computer. You can download it from the official website.

Getting Started

First, we need to create an account on Coinmarketcap to obtain an API Key. Once you've created an account, go to your account dashboard and click on the "API" tab. From here, you can generate your API Key.

Using the Coinmarketcap Public API

The Coinmarketcap Public API supports both HTTP and HTTPS requests. The base URL for the API is https://pro-api.coinmarketcap.com/v1/.

To make requests to the API, we need to include our API Key as a header with each request. Here's an example using the Fetch API:

const fetch = require("node-fetch");

const apiKey = "YOUR_API_KEY";

fetch("https://pro-api.coinmarketcap.com/v1/cryptocurrency/map", {

headers: {

"X-CMC_PRO_API_KEY": apiKey

}

})

.then(response => response.json())

.then(data => console.log(data))

.catch(err => console.error(err));

This code sends a GET request to the cryptocurrency/map endpoint of the Coinmarketcap API and logs the response data to the console.

Example API Requests

Here are some example requests that you can make to the Coinmarketcap Public API:

List of Cryptocurrencies

fetch("https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?limit=10", {

headers: {

"X-CMC_PRO_API_KEY": apiKey

}

})

.then(response => response.json())

.then(data => console.log(data))

.catch(err => console.error(err));

This code sends a GET request to the cryptocurrency/listings/latest endpoint with a limit of 10 and logs the response data to the console.

Price Conversion

fetch("https://pro-api.coinmarketcap.com/v1/tools/price-conversion?amount=1&symbol=BTC&convert=USD", {

headers: {

"X-CMC_PRO_API_KEY": apiKey

}

})

.then(response => response.json())

.then(data => console.log(data))

.catch(err => console.error(err));

This code sends a GET request to the tools/price-conversion endpoint to convert 1 Bitcoin to US dollars and logs the response data to the console.

Historical Data

fetch("https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/historical?symbol=BTC&time_start=2021-09-01T00%3A00%3A00.000Z&time_end=2021-09-30T00%3A00%3A00.000Z", {

headers: {

"X-CMC_PRO_API_KEY": apiKey

}

})

.then(response => response.json())

.then(data => console.log(data))

.catch(err => console.error(err));

This code sends a GET request to the cryptocurrency/quotes/historical endpoint to get historical data for Bitcoin from September 1 to September 30, 2021 and logs the response data to the console.

Conclusion

The Coinmarketcap Public API provides a powerful way to access cryptocurrency data. With the examples we provided in this article, you now have a solid starting point for using the API.

Related APIsKite ConnectFinanceKite Connect is a comprehensive set of REST-like HTTP APIs that provides developers with the tools they need to build a complete stock market investment and trading platform. With Kite Connect, you can execute orders in real time for equities, commodities, mutual funds, and more. You can also manage user portfolios and stream live market data over WebSockets, making it easier than ever to keep track of the latest trends and opportunities. Whether you're an experienced trader or just starting out, Kite Connect provides the flexibility and scalability you need to build a robust investment platform that meets your unique needs. So why not explore the possibilities and start building your next great investment app with Kite Connect today?Razorpay IFSCFinanceIndian Financial Systems Code (Bank Branch Codes)CoinDeskFinanceCoinDesk provides a simple API to make its Bitcoin Price Index (BPI) data programmatically available to others.IEXFinanceStocks and Market Data on IEX CloudCryptoCompareFinanceCryptocurrencies Comparison APIIG LabsFinanceAutomate trades, build integrations and create trading apps using our market-leading CFD and spread betting technology.PlaidFinanceEnables applications to connect with users’ bank accounts and access transaction dataAlpha VantageFinanceRealtime and historical stock dataFinancial Modeling PrepFinanceFree stock, historical data, financial statements APIFeaturedipstackGeocodingLocate and identify website visitors by IP address.FeaturedExchangerate APICurrency ExchangeJSON API for foreign exchange rates and currency conversionFeaturedWeatherstackWeatherRetrieve instant, accurate weather information for any location in the world in lightweight JSON formatPublic APIs — A directory of free and public apisBuilt by @mddanishyu

CoinMarketCap API - An Introductory Guide - AlgoTrading101 Blog

CoinMarketCap API - An Introductory Guide - AlgoTrading101 Blog

From $0 to $1,000,000. Authentic Stories about Trading, Coding and Life

→ Learn Algo Trading

Share

Reply

1

Igor Radovanovic Follow

CoinMarketCap API – An Introductory Guide

8 min read

Get 10-day Free Algo Trading Course

Last Updated on April 3, 2023

Table of contents:

What is CoinMarketCap?Is CoinMarketCap API free?Why should I use CoinMarketCap?Why shouldn’t I use the CoinMarketCap?What are the alternatives to using CoinMarketCap?What coding languages/clients are available for CoinMarketCap?How to get started with CoinMarketCap API?What are the CoinMarketCap API cryptocurrency functions?How to obtain metadata using CoinMarketCap API?How to get the ID Map data with CoinMarketCap API?How to get quote data using CoinMarketCap API?How to get the latest listing data using CoinMarketCap API?How to get Fiat data using CoinMarketCap API?What are the CoinMarketCap API exchange functions?How to get global-metrics using CoinMarketCap API?How to use the CoinMarketCap API price conversion tool?How to use partners endpoints in CoinMarketCap API?How to use CoinMarketCap API in Google Sheets?More about CoinMarketCapFull code

What is the CoinMarketCap API?

The CoinMarketCap API is a method to retrieve cryptocurrency data such as price, volume, market cap, and exchange data from CoinMarketCap using code.

We will demonstrate this in this article using Python.

CoinMarketCap is one of the most popular websites used for tracking various cryptocurrencies and obtaining data about them.

Link: https://coinmarketcap.com

Is the CoinMarketCap API free?

The website of the CMC is free to use and the payment is necessary if you want more API functions.

CoinMarketCap API offers a free plan among the other 4 available ones. With the free plan you have access to the 9 market data endpoints:

Crypto referential and info logo and logo assetsLatest Global Market cap, volume and statsLatest crypto rankings and market quotesLatest crypto and flat currency conversionsPartner data access

The STARTUP plan which is 79$ per month, gives you access to 14 market endpoints like historical data and OHLCV. On the other hand the STANDARD and PROFESSIONAL plans give you access to 22 market endpoints.

The number of free CMC API call credits per month is 10k and, with the other paid packages, it can even go up to 3 million or more.

In my opinion, the free plan is at a huge disadvantage compared to the premium plans and there are other websites similar to CMC that give you free access to the endpoints that CMC doesn’t give you. For example, check out our CoinGecko article:

You can see the other available plans from the picture below:

Why should I use CoinMarketCap?

Has a free planEasy to useInformativeTracks a great number of coins and exchangesHas a mobile APPGood API

Why shouldn’t I use the CoinMarketCap?

Doesn’t offer enough metricsIsn’t always preciseThe free plan is severely limitedThere are some suspicions that CMC favors its parent (Binance) company when it comes to rankings.

What are the alternatives to using CoinMarketCap?

CoinMarketCap can be replaced with other websites that can be more suitable for you needs. Here are some of them:

CoinGeckoBlockchain walletCoinsflareCoincodexViewBaseCryptoCompareBlockfolioWallmineCoincheckupCesiumCryptonaut

What coding languages/clients are available for CoinMarketCap API?

You can use the CMC API with the following clients:

PythonNode.jsJavaPHPC#GoGoogle SheetsExcel

How to get started with CoinMarketCap API?

In order to get started with the CoinMarketCap API you’ll need to obtain your API key from the following link:

https://coinmarketcap.com/api/

Click on the “GET YOUR API KEY NOW” button and fill up the sign-up information. After you input the relevant data, go over to your email to confirm it. After that, you’ll be taken to the following screen:

As you can see you can easily disable and generate new API keys.

For this tutorial we’ll be using Python, so let’s go over and install the CoinMarketCap library with the following command:

pip install python-coinmarketcap

Have in mind that for most of the next chapters we’ll be using the Jupyter Notebook.

What are the CoinMarketCap API cryptocurrency functions?

The main cryptocurrency endpoints that the CMC offers us are the following:

MetadataHistorical listingsHistorical quotesHistorical OHLCVCMC ID MapLatest QuotesLatest ListingsLatest Market PairsLatest OHLCVPrice performance stats

We’ll cover all of the free plan endpoints in the following chapters.

How to obtain metadata using CoinMarketCap API?

The CMC metadata endpoint returns all the static data that is available for the specified cryptocurrency. The information obtained contains the following: logo, description, website URL, various social links and other.

In order to obtain crypto metadata, we’ll need to import the CMC library and set the client up.

import coinmarketcapapi

cmc = coinmarketcapapi.CoinMarketCapAPI(‘YOUR API KEY’)

Now, let’s make a call that will provide is with the overall data for the Bitcoin cryptocurrency.

data = cmc.cryptocurrency_info(symbol='BTC')

data

How to get the ID Map data with CoinMarketCap API?

The CMC ID Map endpoint obtains a mapping of all currencies with their unique ID’s. Each currency obtained by this endpoint will return standard identifiers as name, symbol and token address.

This endpoint will return crpytocurrencies that have actively tracked markets on supported exchanges by default. The data obtained will also provide the first and last historical data timestamps.

In order to obtain this endpoint, after validating your API Key, do the following:

data_id_map = cmc.cryptocurrency_map()

You may want to make the data more readable by putting it into a pandas data frame. For this, you need to do the following:

import pandas as pd

pd = pd.DataFrame(data_id_map.data, columns =['name','symbol'])

pd.set_index('symbol',inplace=True)

print(pd)

How to get quote data using CoinMarketCap API?

The CMC quote data endpoint returns the latest market quote for a specified cryptocurrency. Moreover, we can convert this data easily into a wanted currency. All we need to do is the following:

data_quote = cmc.cryptocurrency_quotes_latest(symbol='ETH', convert='USD')

If you want to create this into a Pandas data frame you can check out our previous ID Map example.

How to get the latest listing data using CoinMarketCap API?

The CMC latest listings endpoint obtains a list of all active cryptocurrencies with their latest market data.

Like in our previous example, we can convert the data into a preferred currency and rank it differently if we wish to:

data_listing = cmc.cryptocurrency_listings_latest()

How to get Fiat data using CoinMarketCap API?

According to Investopedia, Fiat money is a government-issued currency that is not backed by a physical commodity, such as gold or silver, but rather by the government that issued it.

Firstly, let’s import the relevant library, authenticate the API Key and call our endpoint:

from coinmarketcapapi import CoinMarketCapAPI

cmc = CoinMarketCapAPI('b44c1fd8-1c05-45b9-8df7-380a409f9b69')

fiat = cmc.fiat_map()

What are the CoinMarketCap exchange functions API?

The CMC has 7 Exchange options and none of the are available for the basic plan:

CMC ID mapMetadataLatest ListingsLatest QuotesHistorical ListingsHistorical Quotes

How to get global-metrics using CoinMarketCap API?

The CMC global-metrics option has 2 endpoints (historical and latest quotes). The latest quotes one is the only one available for the basic plan so let’s see what it does.

Let’s import he relevant library, authenticate the API Key and call our endpoint:

from coinmarketcapapi import CoinMarketCapAPI

cmc = CoinMarketCapAPI('b44c1fd8-1c05-45b9-8df7-380a409f9b69')

global_quote = cmc.globalmetrics_quotes_latest()

How to use the CoinMarketCap API price conversion tool?

The CMC price conversion tool endpoint allows us to convert a specified amount of one cryptocurrency or fiat currency into other currencies by utilizing the latest market rate for each of them.

In this example we’ll convert the BTC currency to USD with a specified amount (20).

Let’s import the relevant library, authenticate the API Key, and call our endpoint:

from coinmarketcapapi import CoinMarketCapAPI

cmc = CoinMarketCapAPI('b44c1fd8-1c05-45b9-8df7-380a409f9b69')

tool=cmc.tools_priceconversion(amount=20, symbol='BTC',convert='USD')

tool

How to use partners endpoints in CoinMarketCap API?

The CMC partners endpoints provides us with the FCAS latest listings and quotes.

FCAS stands for The Fundamental Crypto Asset Score, which is a comparative metric used to determine the fundamental health of the crypto project.

In CMC the FCAS endpoint returns a paginated list of FCAS scores for all cryptocurrencies. Let’s import he relevant library, authenticate the API Key and call our endpoints

from coinmarketcapapi import CoinMarketCapAPI

cmc = CoinMarketCapAPI('b44c1fd8-1c05-45b9-8df7-380a409f9b69')

FCAS_listing = cmc.partners_flipsidecrypto_fcas_listings_latest()

FCAS_quote = cmc.partners_flipsidecrypto_fcas_quotes_latest(symbol='LTC')

How to use CoinMarketCap API in Google Sheets?

CMC can be easily integrated into Google Sheets. Let us go over the steps together and pull some data into our Google Sheets.

The first thing we need to do is to navigate ourselves to the “Script Editor” menu that is located on the main tool ribbon.

After that, we will start the building process of our script. Firstly, we will make a variable that will pull the data onto a specified sheet.

var sh1 =SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1');

For this example, we will want the latest quotes for the Etherium cryptocurrency that is converted to USD. Let’s code our request:

var requestOptions = {

method: ‘GET’,

uri: ‘https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest’,

qs: {

start: 1,

limit: 4000,

convert: ‘USD’

},

headers: {

‘X-CMC_PRO_API_KEY’ : ‘YOUR API KEY HERE’

},

json: true,

gzip: true

};

The next step is to create a variable that will access the URL for our API request:

var url=https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=ETH;

The next thing we need to specify is a function that will obtain all the data from the JSON file. So let us create a result variable:

var result= UrlFetchApp.fetch(url, requestOptions);

As the data wouldn’t be useful in the JSON modality we will want to convert it to a string. That being said, out next step is to create a function that will put it into a txt format:

var txt= result.getContentText();

As we need to make the data readable, we will parse the data into different Javascript objects. Let us create another variable that does that:

var d=JSON.parse(txt); 

sh1.getRange(1, 2).setValue(d.data.ETH.quote.USD.price)

}

We’re ready! Let’s save the function and click “Run”. After that, be sure to authorize the function.

After you run the function you should see the data in your second column. I’ll write the word Etherium next to it.

More about CoinMarketCap

CoinMarketCap (CMC) was founded in 2013, and one of the primary tasks that it has set for itself is to add transparency and accountability when it comes to cryptocurrencies and aggregation of the Market data.

Moreover, they offer a holistic approach to data aggregation and state that it is better to overprovide data than to censor or police the information.

Binance, a leading cryptocurrency exchange, has acquired CMC in April of 2020 for $400 million dollars.

Lately, CMC is looking to expand its horizons by adding educational content that could inspire and educate a whole new generation of crypto traders. They decided to call this expansion “CMC Alexandria” which is a reference to the ancient Library of Alexandria.

When it comes to cryptocurrencies, CMC tracks over 7 thousand of them. On the other hand, the number of markets the CMC tracks is over 33 thousand.

CMC also provides three ways of ratings for exchanges:

Top 100 By Adjusted Volume – provides volumes of spot trading platformsTop 100 By Reported Volume – provides volumes of all spot trading platforms, no matter what trading models they useBy Liquidity – shows all trading platforms by liquidity

CMC has a listings criteria as they deem the quality of their data of utmost importance. They state 3 main principles of data admissibility and they are the following:

Credibility: Is the requester able to substantiate his/her case with supporting evidence?Verification: Are we able to verify the information from credible and independently verifiable sources?Methodology: Is this request in accordance with our methodology?

You can read more about the said criteria on the following link:

https://support.coinmarketcap.com/hc/en-us/articles/360043659351-Listings-Criteria

As the CMC provides us with the minute updates of all market data it provides, all data is run through several cleaning and verification algorithms.

One raises a question in what way do these algorithms work and how are the following metrics calculated:

PriceVolumeMarket CapitalizationLiquidity ScoreWeb Traffic FactorSupply and more.

Good news that the CMC shares the methodology behind the mentioned metrics which can be read on the following link:

https://support.coinmarketcap.com/hc/en-us/sections/360008888252-Metric-Methodologies

The CMC API is a powerful tool that is built on a high-performance RESTful JSON endpoints.

CMC even excludes markets with no fees as there could be malicious activities going behind them. For example, a trader or bot can trade back and forth with himself and make a lot of illusory volume. This volume could deceive others.

We should also have in mind that the CMC doesn’t offer a way to purchase a cryptocurrency. Their main role is to only provide data on it.

CMC offers us a mobile app that is available for iOS & Android. With it, we can track crypto and exchange ranking data, build our portfolio and watchlist, obtain crypto price alerts, get cryptocurrency and blockchain news, and get global stats that are ready for conversion.

CMC also has a blockchain explorer which you can check out on the following link:

https://blockchain.coinmarketcap.com/?utm_source=coinmarketcap&utm_content=footer

Full code

Github link

Igor Radovanovic Follow

Programming

Trading

« CoinGecko API – A Complete Guide

Crypto Arbitrage Guide – What It Is and How to Find It »

Blankly – Python Backtesting Guide

Igor Radovanovic

Apr 20, 2023

10 min read

OpenBB Platform – A Complete Guide

Igor Radovanovic

Jan 23, 2024

13 min read

LEAN Engine (on AWS) and Interactive Brokers Guide

Igor Radovanovic

Nov 12, 2023

4 min read

One Reply to “CoinMarketCap API – An Introductory Guide”

Pingback: CoinGecko API - A Complete Guide - AlgoTrading101 Blog

Comments are closed.

Our AlgoTrading101 Course is full - Join our Wait List here

RSS Feed Link

Login for Writers

© Copyright AlgoTrading101 Blog