CoinEx Institution: CoinGecko API VS CoinMarketCap API

6 min readApr 24



In the crypto market, APIs serve as important tools that facilitate connections between various applications and services. CoinGecko API and CoinMarketCap API are two major crypto data providers. Unlike APIs provided by exchanges that focus primarily on trading, CoinGecko and CoinMarketCap offer more comprehensive and diverse data and information. They can be used for quantitative trading, data mining, and cross-sectional comparisons. In this article, we will use these two giants of coin data integration as examples, with Python as the basic language, for an introductory explanation, and compare these two APIs to better understand their differences, advantages, and disadvantages.

CoinGecko API:

API documentation

CoinGecko API provides live price, historical data, trading volumes and pairs of exchanges, as well as other types of data. It is divided into 5 categories, each with different levels of price and service quality in terms of response time, data precision, data depth, and personalized customization. The monthly cost for customized packages ranges from $100 to $800. However, due to limited funding, this article will focus on the entry-level publicly available version.

The documentation above is for CoinGecko API V3, which includes price and volume data, background information, exchange information, and a new feature for NFT tracking.

Languages Supported

CoinGecko supports a wide range of mainstream programming languages, including NodeJs, Go, .Net, Python, Java, Kotlin, Google Sheets, Cryptosheets, PHP, and WordPress Plugin.

Registration on CoinGecko is not required for the free version, and you can directly call the library provided by the project.

Practical Exercise

Pip install pycoingecko

To install the Python library in the terminal, use the command:

pip install pycoingecko

After installation, you can use pip show pycoingecko to check if the library is correctly installed. This command will display the dependency for the library, which is “requests” in this case. Requests is an important component of Python web scraping, and you can also use requests to crawl information from CoinGecko by your own code. However the API provides a simpler and more direct way.

Or you can manually add the library to your preferred environment using anaconda. As this process is outside the scope of this article, we will not go deep into it.

You can access the CoinGecko API by importing it. Commonly, we use cg as the alias for the dependency.

from pycoingecko import CoinGeckoAPI

cg = CoinGeckoAPI()

To check the status of the API, you can use the ping function:

After receiving a reply that goes “To the moon!” from CoinGecko that confirms the API is working, we can proceed to retrieve basic price data. Take ETH for example:

To retrieve prices, two necessary variables are required: the token name and supported trading pair. These can be obtained separately using


and cg.get_supported_vs_currencies()

Then run the program and you will get the current value of Ethereum in US dollars.

cg.get_price(ids=’ethereum’, vs_currencies=’usd’)

You can also input multiple IDs to retrieve prices for several tokens.

Data on volume changes: In addition to price, the get_price function can retrieve market cap, 24h volume, 24h price change, and timestamp.


Historical data: In addition to live data, the “History” function can be used to retrieve historical data:

cg.get_coin_history_by_id(id=’ethereum’,date=’01–01–2023', localization=’false’)

Apart from price data, other data such as community data, developer data, and public browsing data can also be obtained.

If you need 24-hour historical data, you may use:


The above is the basic usage of CoinGecko API, and there are more advanced uses of the API that can be combined with different software or libraries for various purposes. It is a valuable tool for work and study.

CoinMarketCap API

API Documentation

Compared to CoinGecko, CMC has been criticized for its bias towards Binance. However, CMC charges lower fees than CoinGecko. Yet obviously, many features are only available in paid services. The open-source free version of CMC API provides limited data, and neither data precision nor volume can meet academic or commercial demands.

Languages Supported

CMC supports programming languages such as NodeJS, PHP, Python, Ruby, Objective-C, Java (Android), C# (.NET), and cURL.

Practical Exercise

Registration: To use CMC API PRO, you must obtain an API Key by registering and logging in to the CMC website. Then click to copy the API Key.

CMC API can be accessed in two ways: through requests or the official library.

To install the library, use pip install python-coinmarketcap.

Here, we will demonstrate the process in sandbox mode. Just define cmc=CoinMarketCapAPI(), and the system will default to sandbox mode, or input an API Key to enter Pro mode.

To retrieve asset information, first import the CMC library and use cryptocurrency_info() from the API. Here, we will use Solana as an example:

The returned values can take the form of a dictionary, integer, string, or boolean, which correspond to various functionalities. This design is a great benefit for developers.

To retrieve token information: We can also use _listings_latest() to retrieve the latest token information.

The response will be in dictionary form, including the ID, name, symbol, CMC rank, circulating supply, total supply, date of addition, and last update. You can specify a symbol or use a slug to query real-time information for a specific token.

To obtain volume and price information, use cryptocurrency_ohlcv_latest() from the API. The ID or symbol must be specified. You can use convert_id to specify the trading pair. The default is USD.

Other features: Interestingly, CMC also provides a function for querying airdrops. Here, we will use SOL as an example. Please note that the ID variable must be specified. The API will respond with data such as the start date, total prize, and winner count:

The CMC API offers a wide range of functions, allowing users to retrieve exchange, token, volume and price, on-chain, and customized information. For more information, please refer to the documentation on Pypi.

Below are several dimensions for comparing the two APIs, with a maximum score of 5 points:

It is clear that CMC focuses more on providing a better developer experience, while CoinGecko’s advantage lies in the diversity of data and future planning. Both have their own strengths. Apart from these two leading products, users also have choices such as blockchain wallets and Coinsfera. However, CMC and CoinGecko have already taken the lion’s share of the market and have a first-mover advantage, making them the most recognized projects. It is difficult for newcomers to surpass them in the short term. We expect the two projects will bring stabler, more efficient, and higher-quality APIs to the data market as they develop.