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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

python_coinmarketcap-0.1-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

python_coinmarketcap-0.1-py2-none-any.whl (5.0 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page