Unofficial wrapper for coinmarketcap api
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cmc-api-0.0.1.tar.gz
.
File metadata
- Download URL: cmc-api-0.0.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffb6a0139f641c222021149b52fa0f1f2673fda1cd1c295b379dbaab164b4227 |
|
MD5 | 9f6109a3a9c0e0e544bd519aec39806b |
|
BLAKE2b-256 | 5c0939eabce947fe2288b9332252e1faf14caa9cc1c2737085394c1d48ccb766 |
File details
Details for the file cmc_api-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: cmc_api-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c36858384eb0f8d051b4133561d9ffdc342175cf925af883ce1c8d1a442f2cc |
|
MD5 | 0fde50a65e7c472a460fa673628bc388 |
|
BLAKE2b-256 | 3f6dc718009dd6a9ac2d0b9decbb269407cdadfc1ca6477166014960b3a8a5af |