Python3 wrapper around the CoinGecko API (V3) enabling access to cryptocurrency market data, prices, exchanges, and NFT information.
—
NFT collection data, market information, historical charts, and marketplace tickers for digital collectibles. This module provides comprehensive information about Non-Fungible Token collections and their market performance across various NFT marketplaces.
Get comprehensive lists of supported NFT collections with market data and metadata.
def get_nfts_list(**kwargs):
"""
List all supported NFT collection IDs, paginated by 100 items per page.
Parameters:
- order (str): Sort order ('h24_volume_native_asc', 'h24_volume_native_desc', 'floor_price_native_asc', 'floor_price_native_desc', 'market_cap_native_asc', 'market_cap_native_desc', 'market_cap_usd_asc', 'market_cap_usd_desc')
- asset_platform_id (str): Filter by blockchain platform (e.g., 'ethereum')
- per_page (int): Results per page (1-100, default: 100)
- page (int): Page number (default: 1)
Returns:
list: List of NFT collections with basic information (id, name, symbol, asset_platform_id)
"""
def get_nfts_markets(**kwargs):
"""
Query all supported NFT collections with floor price, market cap, volume and market related data.
Parameters:
- vs_currency (str): Target currency for market data (default: 'usd')
- order (str): Sort order ('market_cap_usd_desc', 'market_cap_usd_asc', 'floor_price_usd_desc', 'floor_price_usd_asc', 'h24_volume_usd_desc', 'h24_volume_usd_asc')
- asset_platform_id (str): Filter by blockchain platform
- per_page (int): Results per page (1-100, default: 100)
- page (int): Page number (default: 1)
Returns:
list: List of NFT collections with comprehensive market data including floor prices and volumes
"""Usage Examples:
# Get all NFT collections sorted by volume
nfts = cg.get_nfts_list(order='h24_volume_native_desc')
# Get NFT market data sorted by market cap
nft_markets = cg.get_nfts_markets(
vs_currency='usd',
order='market_cap_usd_desc',
per_page=50
)
# Get Ethereum-based NFT collections only
ethereum_nfts = cg.get_nfts_list(asset_platform_id='ethereum')Get detailed information about specific NFT collections.
def get_nfts_by_id(id, **kwargs):
"""
Get comprehensive data for an NFT collection including floor price, volume, and metadata.
Parameters:
- id (str): NFT collection ID (e.g., 'cryptopunks')
Returns:
dict: Comprehensive NFT collection data including description, floor price, volume, and social links
"""
def get_nfts_by_asset_platform_id_and_contract_address(asset_platform_id, contract_address, **kwargs):
"""
Get NFT collection data by blockchain platform and contract address.
Parameters:
- asset_platform_id (str): Blockchain platform ID (e.g., 'ethereum')
- contract_address (str): NFT contract address
Returns:
dict: NFT collection data identified by contract address
"""Usage Examples:
# Get CryptoPunks collection data
cryptopunks = cg.get_nfts_by_id(id='cryptopunks')
# Get NFT collection by contract address
nft_by_contract = cg.get_nfts_by_asset_platform_id_and_contract_address(
asset_platform_id='ethereum',
contract_address='0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb'
)Access historical market data for NFT collections including floor prices and trading volumes.
def get_nfts_market_chart_by_id(id, days, **kwargs):
"""
Query historical market data of an NFT collection including floor price, market cap, and 24h volume.
Parameters:
- id (str): NFT collection ID (e.g., 'cryptopunks')
- days (str or int): Data range ('1', '7', '14', '30', '90', '180', '365', 'max')
Returns:
dict: Contains 'floor_price_usd', 'floor_price_native', 'h24_volume_usd', 'h24_volume_native', 'market_cap_usd', 'market_cap_native' arrays with [timestamp, value] pairs
"""
def get_nfts_market_chart_by_asset_platform_id_and_contract_address(asset_platform_id, contract_address, days, **kwargs):
"""
Query historical market data by contract address including floor price, market cap, and volume.
Parameters:
- asset_platform_id (str): Blockchain platform ID (e.g., 'ethereum')
- contract_address (str): NFT contract address
- days (str or int): Data range ('1', '7', '14', '30', '90', '180', '365', 'max')
Returns:
dict: Historical market data arrays for the NFT collection
"""Usage Examples:
# Get CryptoPunks price chart for last 30 days
punks_chart = cg.get_nfts_market_chart_by_id(id='cryptopunks', days=30)
# Get NFT market chart by contract address
nft_chart = cg.get_nfts_market_chart_by_asset_platform_id_and_contract_address(
asset_platform_id='ethereum',
contract_address='0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb',
days=7
)Get floor price and volume data from individual NFT marketplaces.
def get_nfts_tickers_by_id(id, **kwargs):
"""
Query the latest floor price and 24h volume of an NFT collection on each marketplace.
Parameters:
- id (str): NFT collection ID (e.g., 'cryptopunks')
Returns:
dict: Contains 'tickers' array with marketplace-specific floor prices, volumes, and last updated timestamps
"""Usage Examples:
# Get CryptoPunks marketplace tickers
punks_tickers = cg.get_nfts_tickers_by_id(id='cryptopunks')
# Access individual marketplace data
for ticker in punks_tickers['tickers']:
marketplace = ticker['nft_marketplace']['name'] # e.g., 'OpenSea', 'LooksRare'
floor_price = ticker['floor_price_in_usd']
volume_24h = ticker['h24_volume_in_usd']
print(f"{marketplace}: Floor ${floor_price}, 24h Volume ${volume_24h}")NFT collection information includes:
{
"id": "cryptopunks",
"contract_address": "0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb",
"asset_platform_id": "ethereum",
"name": "CryptoPunks",
"symbol": "PUNK",
"image": {
"small": "https://assets.coingecko.com/nft_contracts/images/28/small/cryptopunks.png",
"large": "https://assets.coingecko.com/nft_contracts/images/28/large/cryptopunks.png"
},
"description": "CryptoPunks launched as a fixed set of 10,000 items...",
"native_currency": "ethereum",
"native_currency_symbol": "eth",
"floor_price": {
"native_currency": 45.5,
"usd": 123456.78
},
"market_cap": {
"native_currency": 455000.0,
"usd": 1234567890.12
},
"volume_24h": {
"native_currency": 123.45,
"usd": 334455.67
},
"floor_price_in_usd_24h_percentage_change": 2.5,
"number_of_unique_addresses": 3840,
"number_of_unique_addresses_24h_percentage_change": -0.8,
"volume_in_usd_24h_percentage_change": 15.3,
"total_supply": 10000,
"links": {
"homepage": "https://www.larvalabs.com/cryptopunks",
"twitter": {
"handle": "larvalabs",
"followers": 123456
},
"discord": "https://discord.gg/tQp4pSE"
}
}Historical NFT data includes multiple metrics:
{
"floor_price_usd": [[timestamp1, price1], [timestamp2, price2], ...],
"floor_price_native": [[timestamp1, native_price1], [timestamp2, native_price2], ...],
"h24_volume_usd": [[timestamp1, volume1], [timestamp2, volume2], ...],
"h24_volume_native": [[timestamp1, native_vol1], [timestamp2, native_vol2], ...],
"market_cap_usd": [[timestamp1, cap1], [timestamp2, cap2], ...],
"market_cap_native": [[timestamp1, native_cap1], [timestamp2, native_cap2], ...]
}Marketplace-specific ticker data:
{
"tickers": [
{
"nft_marketplace": {
"name": "OpenSea",
"identifier": "opensea"
},
"floor_price_in_native_currency": 45.5,
"floor_price_24h_percentage_change": {
"native_currency": 2.5,
"usd": 3.2
},
"floor_price_in_usd": 123456.78,
"h24_volume_in_native_currency": 123.45,
"h24_volume_in_usd": 334455.67,
"h24_average_sale_price_in_native_currency": 50.2,
"h24_average_sale_price_in_usd": 136000.50,
"updated_at": "2023-12-01T10:00:00.000Z"
}
]
}NFT collections have a native_currency field that indicates the blockchain's native token:
native_currency = "ethereum" (ETH)native_currency = "polygon" (MATIC)native_currency = "solana" (SOL)Floor prices and volumes are provided in both native currency and USD equivalent.
The API covers major NFT marketplaces including:
Each marketplace provides independent floor price and volume data, allowing for comprehensive market analysis across platforms.
Install with Tessl CLI
npx tessl i tessl/pypi-pycoingecko