CoinMarketCap Python API Wrapper
Project description
Python-CoinMarketCap API Wrapper
This is a non official (but working) Python package to wrap the CoinMarketCap API. With this you can monitoring and watch the crypto market.
Installation
Via pip
- pip install python-coinmarketcap /!\ Don't confound with the coinmarketcap package.
Example
import coinmarketcapapi
cmc = coinmarketcapapi.CoinMarketCapAPI('{YOUR_API_KEY}')
r = cmc.cryptocurrency_info(symbol='BTC')
print repr(r.data)
Requirements and links
First, you have to create an API on the Developper Portal : https://coinmarketcap.com/api/ You can found the full official documentation here : https://coinmarketcap.com/api/documentation/v1/
API Guide
List of all methods
You have to pass to theses functions the parameters detailled in the official documentation. Endoints :
- cryptocurrency_info: Get cryptocurrency metadata
- cryptocurrency_map: Get cryptocurrency CoinMarketCap ID map
- cryptocurrency_listings_latest: List all cryptocurrencies (latest)
- cryptocurrency_market_pairs_latest: Get cryptocurrency market pairs (latest)
- cryptocurrency_ohlcv_historical: Get cryptocurrency OHLCV values (historical)
- cryptocurrency_quotes_latest: Get cryptocurrency market quotes (latest)
- cryptocurrency_quotes_historical: Get cryptocurrency market quotes (historical)
- exchange_info: Get exchange metadata
- exchange_map: Get exchange to CoinMarketCap ID map
- exchange_listings_latest: List all exchanges (latest)
- exchange_market_pairs_latest: Get exchange market pairs (latest)
- exchange_quotes_latest: Get exchange market quotes (latest)
- exchange_quotes_historical: Get exchange market quotes (historical)
- global_metrics_quotes_latest: Get aggregate market metrics (latest)
- global_metrics_quotes_historical: Get aggregate market metrics (historical)
- tools_price_conversion: Price conversion tool
Response
Just get the results of the API in rep.data
or check the status with rep.status
.
Sanbox / Pro Environement
You can switch easly you have to set sandbox
the default value is True
.
cmc = coinmarketcapapi.CoinMarketCapAPI('{YOUR_API_KEY}', sandbox=False)
# You are in production environnement
Debuging
You can enable a debuging mode, just set debug
to True
to main class:
cmc = coinmarketcapapi.CoinMarketCapAPI('{YOUR_API_KEY}', debug=True)
Will produce a new output :
2019-04-06 16:03:04,716 root DEBUG GET SANDBOX 'v1/cryptocurrency/info'
PARAMETERS: {'symbol': 'BTC'}
2019-04-06 16:03:05,004 root DEBUG RESPONSE: 288ms OK: {u'BTC': {u'category': u'coin', u'name': u'Bitcoin', u'tags': [u'mineable'], u'symbol': u'BTC', u'id': 1, [...]}
You can also passing directly a logger instance :
cmc = coinmarketcapapi.CoinMarketCapAPI('{YOUR_API_KEY}', debug=True, logger=my_logger)
ToDo
- Add Cryptocurrency Abstraction
- Add Exchange Abstraction
- Add GlobalMetrics Abstraction
- Add Tools Abstraction
ChangeLog
- 6 apr 2019: Version 0.1
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 Distributions
Built Distributions
File details
Details for the file python_coinmarketcap-0.1a0-py3-none-any.whl
.
File metadata
- Download URL: python_coinmarketcap-0.1a0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5004bda9c879f01fd0d92620156948e4d142fa96d853b9011c8cee126f457ad7 |
|
MD5 | ae06abacd10b5e392c37c9a53c134be6 |
|
BLAKE2b-256 | 53555fc9169479cf3122dfc41d1c535844484f791c64842bd9168a5ab1392401 |
File details
Details for the file python_coinmarketcap-0.1a0-py2-none-any.whl
.
File metadata
- Download URL: python_coinmarketcap-0.1a0-py2-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ca32eb2c8244cf41e0164092f3ff32519c0b46b3dcd007386fb19caa2e42c1f |
|
MD5 | f09b889c98a5733a5a9d27de9674d77c |
|
BLAKE2b-256 | 28ef399d31515f4e28d3591f6e24e261f53ab327df254d48c03ef3ecee8c358c |