Skip to main content

cmc-api

Unofficial wrapper for coinmarketcap api

This is up to date for coinmarketcap pro-api v1.27.0.

Endpoints and their associated function

Endpoint Method
/v1/cryptocurrency/map map()
/v1/cryptocurrency/info info()
/v1/cryptocurrency/listings/latest listings()
/v1/cryptocurrency/listings/historical historical_listings()
/v1/cryptocurrency/quotes/latest quotes()
/v1/cryptocurrency/quotes/historical historical_quotes()
/v1/cryptocurrency/market-pairs/latest -
/v1/cryptocurrency/ohlcv/latest -
/v1/cryptocurrency/ohlcv/historical -
/v1/cryptocurrency/price-performance-stats/latest -
/v1/exchange/map map('exchange')
/v1/exchange/info info('exchange')
/v1/exchange/listings/latest listings('exchange')
/v1/exchange/listings/historical historical_listings('exchange')
/v1/exchange/quotes/latest quotes('exchange')
/v1/exchange/quotes/historical historical_quotes('exchange')
/v1/exchange/market-pairs/latest -
/v1/global-metrics/quotes/latest quotes('global-metrics')
/v1/global-metrics/quotes/historical historical_quotes('global-metrics')
/v1/tools/price-conversion -
/v1/blockchain/statistics/latest -
/v1/fiat/map map('fiat')
/v1/partners/flipside-crypto/fcas/listings/latest -
/v1/partners/flipside-crypto/fcas/quotes/latest -
/v1/key/info key_info() or info('key')

Note: Every method takes in parameters as kwargs. - would be added later.

Installation

Method 1

pip install cmc-api

Method 2

pip install git+https://github.com/bizzyvinci/cmc-api.git

Method 3

git clone https://github.com/bizzyvinci/cmc-api.git
cd cmc-api
python setup.py install

Quick start guide

Import

from cmc_api import CoinMarketCap

Quick start with sandbox.

cmc = CoinMarketCap(root='sandbox')

# List all cryptocurrency in coinmarketcap
cmc.map()

# Get latest listings
cmc.listings()

To use pro-api, A registered key from coinmarketcap is required. This key can be added to environment variable as CMC_PRO_API_KEY. After, the api can be used as:

cmc = CoinMarketCap()

If CMC_PRO_API_KEY is not in environment variable, then the key needs to be passed as argument.

cmc = CoinMarketCap(YOUR_API_KEY)

Passing parameters

You can pass parameters to send along with the request in each method. This can be passed in as keyword arguments.

keyword arguments

cmc.info('exchange', id=[2,270])

kwargs as dict

Get all listing with price between $1 and $10, and market cap between $1B and $10B.

parameters = {
    'price_min': 1,
    'price_max': 10,
    'market_cap_min': 1000000000,
    'market_cap_max': 10000000000
}
data = cmc.listings(**parameters)

Documentation here

coinmarketcap best practices

Metadata

Release files for cmc-api 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmc-api 0.0.1
File Size Uploaded
cmc-api-0.0.1.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cmc-api 0.0.1
File Interpreter ABI Platform
cmc_api-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / cmc-api-0.0.1.tar.gz

Download URL cmc-api-0.0.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb6a0139f641c222021149b52fa0f1f2673fda1cd1c295b379dbaab164b4227
BLAKE2b-256 checksum
How to use checksums
5c0939eabce947fe2288b9332252e1faf14caa9cc1c2737085394c1d48ccb766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / cmc_api-0.0.1-py3-none-any.whl

Download URL cmc_api-0.0.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c36858384eb0f8d051b4133561d9ffdc342175cf925af883ce1c8d1a442f2cc
BLAKE2b-256 checksum
How to use checksums
3f6dc718009dd6a9ac2d0b9decbb269407cdadfc1ca6477166014960b3a8a5af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page