Skip to main content

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.

Manual Installation

Clone this repo and :

Example

  import coinmarketcapapi

  cmc = 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('{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('{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('{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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for python-coinmarketcap, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size python_coinmarketcap-0.1-py2-none-any.whl (5.0 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size python_coinmarketcap-0.1-py3-none-any.whl (6.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page