Python3 wrapper around the CoinGecko API (V3) enabling access to cryptocurrency market data, prices, exchanges, and NFT information.
—
Exchange data including listings, volume information, tickers, historical volume charts, and trading pair details. This module provides comprehensive information about cryptocurrency exchanges and their trading activity.
Get comprehensive lists of cryptocurrency exchanges with market data and metadata.
def get_exchanges_list(**kwargs):
"""
List all exchanges with volume, tickers count, and market data.
Parameters:
- per_page (int): Number of results per page (1-250, default: 100)
- page (int): Page number (default: 1)
Returns:
list: List of exchanges with comprehensive data including volume, trust score, and metadata
"""
def get_exchanges_id_name_list(**kwargs):
"""
List all supported exchange IDs and names (no pagination required).
Returns:
list: List of basic exchange information (id, name)
"""Usage Examples:
# Get all exchanges with market data
exchanges = cg.get_exchanges_list()
# Get simple list of exchange IDs and names
exchange_names = cg.get_exchanges_id_name_list()Get detailed information about specific exchanges including volume data and trading pairs.
def get_exchanges_by_id(id, **kwargs):
"""
Get exchange volume in BTC and comprehensive exchange information.
Parameters:
- id (str): Exchange ID (e.g., 'binance', 'coinbase-exchange')
Returns:
dict: Comprehensive exchange data including volume, trust score, description, and social links
"""
def get_exchanges_tickers_by_id(id, **kwargs):
"""
Get exchange tickers with trading pairs and volume data (paginated, 100 tickers per page).
Parameters:
- id (str): Exchange ID (e.g., 'binance')
- coin_ids (str or list): Filter by specific coin IDs
- include_exchange_logo (bool): Include exchange logos (default: False)
- page (int): Page number (default: 1)
- depth (bool): Include 2% order book depth data (default: False)
- order (str): Sort order ('trust_score_desc', 'trust_score_asc', 'volume_desc')
Returns:
dict: Contains 'tickers' array with trading pair data, volumes, and market information
"""Usage Examples:
# Get Binance exchange information
binance = cg.get_exchanges_by_id(id='binance')
# Get Binance trading pairs and tickers
binance_tickers = cg.get_exchanges_tickers_by_id(
id='binance',
order='volume_desc',
include_exchange_logo=True
)
# Get tickers for specific coins on Coinbase
coinbase_btc = cg.get_exchanges_tickers_by_id(
id='coinbase-exchange',
coin_ids=['bitcoin', 'ethereum']
)Access historical trading volume data for exchanges.
def get_exchanges_volume_chart_by_id(id, days, **kwargs):
"""
Get volume chart data for a specific exchange.
Parameters:
- id (str): Exchange ID (e.g., 'binance')
- days (int): Number of days (1-365)
Returns:
list: Array of [timestamp, volume] pairs showing historical trading volume
"""
def get_exchanges_volume_chart_by_id_within_time_range(id, from_timestamp, to_timestamp, **kwargs):
"""
Get exchange volume chart data within a specific time range.
Parameters:
- id (str): Exchange ID (e.g., 'binance')
- from_timestamp (int): Start timestamp (Unix seconds)
- to_timestamp (int): End timestamp (Unix seconds)
Returns:
list: Volume data arrays for the specified time range
"""Usage Examples:
# Get Binance volume chart for last 30 days
volume_chart = cg.get_exchanges_volume_chart_by_id(id='binance', days=30)
# Get Coinbase volume for specific date range
coinbase_volume = cg.get_exchanges_volume_chart_by_id_within_time_range(
id='coinbase-exchange',
from_timestamp=1640995200, # Jan 1, 2022
to_timestamp=1672531200 # Jan 1, 2023
)Get information about blockchain networks and asset platforms that support tokens.
def get_asset_platforms(**kwargs):
"""
List all asset platforms (blockchain networks) that support tokens.
Parameters:
- filter (str): Filter platforms ('nft' for NFT-supporting platforms)
Returns:
list: List of blockchain platforms with metadata including chain identifier and native token
"""
def get_asset_platform_by_id(asset_platform_id, **kwargs):
"""
Get token list for a specific asset platform.
Parameters:
- asset_platform_id (str): Platform ID (e.g., 'ethereum', 'binance-smart-chain')
Returns:
dict: Token list data for the specified platform
"""Usage Examples:
# Get all supported blockchain platforms
platforms = cg.get_asset_platforms()
# Get Ethereum platform token information
ethereum_tokens = cg.get_asset_platform_by_id(asset_platform_id='ethereum')Get cryptocurrency category information and market data.
def get_coins_categories_list(**kwargs):
"""
List all cryptocurrency categories without market data.
Returns:
list: List of category information (category_id, name)
"""
def get_coins_categories(**kwargs):
"""
List all cryptocurrency categories with comprehensive market data.
Parameters:
- order (str): Sort order ('market_cap_desc', 'market_cap_asc', 'name_desc', 'name_asc', 'market_cap_change_24h_desc', 'market_cap_change_24h_asc')
Returns:
list: List of categories with market cap, volume, and change data
"""Usage Examples:
# Get simple list of categories
categories = cg.get_coins_categories_list()
# Get categories with market data sorted by market cap
category_markets = cg.get_coins_categories(order='market_cap_desc')Access data about cryptocurrency derivatives and futures markets.
def get_derivatives(**kwargs):
"""
List all derivative tickers across all derivative exchanges.
Parameters:
- include_tickers (str): Include tickers ('all', 'unexpired', 'expired')
Returns:
list: List of derivative contracts with pricing and volume data
"""
def get_derivatives_exchanges(**kwargs):
"""
List all derivative exchanges with volume and open interest data.
Parameters:
- order (str): Sort order ('name_asc', 'name_desc', 'open_interest_btc_desc', 'trade_volume_24h_btc_desc')
- per_page (int): Results per page (1-100, default: 100)
- page (int): Page number (default: 1)
Returns:
list: List of derivative exchanges with market data
"""
def get_derivatives_exchanges_by_id(id, **kwargs):
"""
Get information about a specific derivative exchange.
Parameters:
- id (str): Derivative exchange ID
- include_tickers (str): Include ticker data ('all', 'unexpired', 'expired')
Returns:
dict: Comprehensive derivative exchange data with tickers and statistics
"""
def get_derivatives_exchanges_list(**kwargs):
"""
List all derivative exchange IDs and names.
Returns:
list: List of derivative exchange basic information (id, name)
"""Usage Examples:
# Get all derivative tickers
derivatives = cg.get_derivatives(include_tickers='unexpired')
# Get derivative exchanges by volume
deriv_exchanges = cg.get_derivatives_exchanges(order='trade_volume_24h_btc_desc')
# Get specific derivative exchange data
binance_futures = cg.get_derivatives_exchanges_by_id(id='binance_futures')Access market index data and cryptocurrency index information.
def get_indexes(**kwargs):
"""
List all market indexes with current values and metadata.
Parameters:
- per_page (int): Results per page (1-100, default: 100)
- page (int): Page number (default: 1)
Returns:
list: List of market indexes with current values and performance data
"""
def get_indexes_by_market_id_and_index_id(market_id, id, **kwargs):
"""
Get specific market index data by market ID and index ID.
Parameters:
- market_id (str): Market/exchange ID
- id (str): Index ID
Returns:
dict: Specific index data with historical performance
"""
def get_indexes_list(**kwargs):
"""
List all market index IDs and names.
Returns:
list: List of index basic information (id, name, market)
"""Usage Examples:
# Get all market indexes
indexes = cg.get_indexes()
# Get specific index data
btc_index = cg.get_indexes_by_market_id_and_index_id(
market_id='bitfinex',
id='BTC'
)
# Get simple list of available indexes
index_list = cg.get_indexes_list()Exchange information includes:
{
"id": "binance",
"name": "Binance",
"year_established": 2017,
"country": "Cayman Islands",
"description": "...",
"url": "https://www.binance.com/",
"image": "https://assets.coingecko.com/markets/images/52/small/binance.jpg",
"trust_score": 10,
"trust_score_rank": 1,
"trade_volume_24h_btc": 284567.89,
"normalized_trade_volume_24h_btc": 284567.89
}Trading pair tickers include:
{
"base": "BTC",
"target": "USDT",
"market": {
"name": "Binance",
"identifier": "binance",
"has_trading_incentive": false
},
"last": 43250.50,
"volume": 12345.67,
"converted_last": {
"btc": 1.0,
"eth": 17.234,
"usd": 43250.50
},
"converted_volume": {
"btc": 12345.67,
"eth": 212876.34,
"usd": 534123456.78
},
"trust_score": "green",
"bid_ask_spread_percentage": 0.012345,
"timestamp": "2023-12-01T10:00:00.000Z",
"last_traded_at": "2023-12-01T10:00:00.000Z",
"last_fetch_at": "2023-12-01T10:00:30.000Z",
"is_anomaly": false,
"is_stale": false
}Volume data returns arrays of timestamp-volume pairs:
[
[timestamp1, volume1],
[timestamp2, volume2],
...
]Timestamps are Unix timestamps in milliseconds, volumes are in the exchange's base currency or BTC equivalent.
Install with Tessl CLI
npx tessl i tessl/pypi-pycoingecko