Python CoinMarketCap API Wrapper: Monitor Crypto Markets Efficiently

·

Overview

The Python-CoinMarketCap API Wrapper provides developers with a streamlined interface to access cryptocurrency market data from CoinMarketCap's API. This unofficial (but fully functional) package enables real-time market monitoring and historical data analysis for crypto assets.

Key features:

👉 Explore cryptocurrency market tools

Getting Started

Installation

Install the package via pip:

pip install python-coinmarketcap

Basic Usage

from coinmarketcapapi import CoinMarketCapAPI

# Initialize API client (sandbox mode)
cmc = CoinMarketCapAPI()

# Get Bitcoin information
response = cmc.cryptocurrency_info(symbol='BTC')

# Access response data
print(response.data)  # Complete response payload
print(response.data["BTC"]["logo"])  # Specific data points
print(response.credit_count)  # API credits used
print(response.total_elapsed)  # Request duration in milliseconds

API Reference

Available Endpoints

Endpoint CategoryKey Methods
Cryptocurrency Datacryptocurrency_map(), cryptocurrency_info(), cryptocurrency_listings_latest()
Market Metricsglobalmetrics_quotes_latest(), globalmetrics_quotes_historical()
Exchange Dataexchange_map(), exchange_info(), exchange_listings_latest()
Toolstools_priceconversion(), tools_postman()

Response Handling

All API methods return a Response object with these properties:

👉 Discover advanced crypto trading strategies

Advanced Features

Sandbox Mode

For testing without consuming API credits:

cmc = CoinMarketCapAPI()  # Defaults to sandbox

Debug Mode

Enable verbose logging:

cmc = CoinMarketCapAPI(debug=True)

Version Control

Access specific API versions:

response = cmc.cryptocurrency_listings_latest(api_version="v1.1")

Error Handling

from coinmarketcapapi import CoinMarketCapAPIError

try:
    response = cmc.cryptocurrency_info(symbol='BTC')
except CoinMarketCapAPIError as e:
    print(f"Error: {e.rep.error_message}")

FAQ

How do I get an API key?

Visit CoinMarketCap's Developer Portal to register for API access.

What's the rate limit?

The free tier allows 333 daily requests (10,000/month). Pro tiers offer higher limits.

Can I use this for commercial projects?

Yes, but ensure compliance with CoinMarketCap's API terms of service.

How current is the market data?

Data latency varies by endpoint, typically ranging from 5-15 minutes for free tier access.

👉 Learn about crypto market analysis

Changelog

Version 0.6 (Jan 2025)

Version 0.5 (Nov 2022)

Version 0.4 (Nov 2022)

Resources