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:
- Simplified access to CoinMarketCap's API endpoints
- Supports both free and pro API versions
- Sandbox mode for testing without API keys
- Structured response handling
👉 Explore cryptocurrency market tools
Getting Started
Installation
Install the package via pip:
pip install python-coinmarketcapBasic 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 millisecondsAPI Reference
Available Endpoints
| Endpoint Category | Key Methods |
|---|---|
| Cryptocurrency Data | cryptocurrency_map(), cryptocurrency_info(), cryptocurrency_listings_latest() |
| Market Metrics | globalmetrics_quotes_latest(), globalmetrics_quotes_historical() |
| Exchange Data | exchange_map(), exchange_info(), exchange_listings_latest() |
| Tools | tools_priceconversion(), tools_postman() |
Response Handling
All API methods return a Response object with these properties:
data: The complete API response payloadstatus: Response status metadatacredit_count: API credits consumedelapsed: Server processing time (ms)error: Boolean indicating if an error occurred
👉 Discover advanced crypto trading strategies
Advanced Features
Sandbox Mode
For testing without consuming API credits:
cmc = CoinMarketCapAPI() # Defaults to sandboxDebug 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)
- Added new endpoints including fear-and-greed indicators
- Improved error handling
- Dropped Python 2.7 support
Version 0.5 (Nov 2022)
- Fixed debug output issues
- Improved error logging
Version 0.4 (Nov 2022)
- Added content-related endpoints
- Updated default API versions for certain endpoints