Skip to main content

Python wrapper around the coinmarketcap.com API.

Project description

<h1><img src="https://raw.githubusercontent.com/mrsmn/coinmarketcap-api/master/doc/coinmarketcap.png" height=85 alt="coinmarketcap" title="coinmarketcap">coinmarketcap-api</h1>

[![PyPi Version](http://img.shields.io/pypi/v/coinmarketcap.svg)](https://pypi.python.org/pypi/coinmarketcap/)

**coinmarketcap** is an APACHE licensed library written in Python providing an easy to use wrapper around the [coinmarketcap](http://coinmarketcap.com/) API.
This library has been tested with Python 2.7.x and Python 3.6.x.

**Please note that all results are cached for 120 seconds.**

## Installation:

From source use

$ python setup.py install

or install from PyPi

$ pip install coinmarketcap

## API Documentation:

This API can currently retrieve the following data from [coinmarketcap](http://coinmarketcap.com/):

- **`GET /v1/ticker/`**
- **`GET /v1/ticker/currency`**
- **`Optional parameters:`**
- **(int) limit** - only returns the top limit results.
- **(string) convert** - return price, 24h volume, and market cap in terms of another currency. Valid values are:
"AUD", "BRL", "CAD", "CHF", "CNY", "EUR", "GBP", "HKD", "IDR", "INR", "JPY", "KRW", "MXN", "RUB"

```python
>>> from coinmarketcap import Market
>>> coinmarketcap = Market()
>>> coinmarketcap.ticker(<currency>, limit=3, convert='EUR')
[
{
"market_cap_usd": "46511837774.0",
"price_usd": "2840.01",
"last_updated": "1496839152",
"name": "Bitcoin",
"24h_volume_usd": "1653540000.0",
"percent_change_7d": "28.25",
"symbol": "BTC",
"rank": "1",
"percent_change_1h": "0.17",
"total_supply": "16377350.0",
"price_btc": "1.0",
"available_supply": "16377350.0",
"market_cap_eur": "41469908047.0",
"percent_change_24h": "-1.63",
"24h_volume_eur": "1474294610.46",
"id": "bitcoin",
"price_eur": "2532.15007599"
},
{
"market_cap_usd": "24216937775.0",
"price_usd": "262.428",
"last_updated": "1496839164",
"name": "Ethereum",
"24h_volume_usd": "576588000.0",
"percent_change_7d": "13.56",
"symbol": "ETH",
"rank": "2",
"percent_change_1h": "0.22",
"total_supply": "92280312.0",
"price_btc": "0.0932293",
"available_supply": "92280312.0",
"market_cap_eur": "21591797503.0",
"percent_change_24h": "0.72",
"24h_volume_eur": "514085284.212",
"id": "ethereum",
"price_eur": "233.980542372"
},
{
"market_cap_usd": "10803955417.0",
"price_usd": "0.279738",
"last_updated": "1496839144",
"name": "Ripple",
"24h_volume_usd": "110956000.0",
"percent_change_7d": "27.08",
"symbol": "XRP",
"rank": "3",
"percent_change_1h": "-0.15",
"total_supply": "99994661895.0",
"price_btc": "0.00009938",
"available_supply": "38621693933.0",
"market_cap_eur": "9632795846.0",
"percent_change_24h": "-3.87",
"24h_volume_eur": "98928258.644",
"id": "ripple",
"price_eur": "0.2494141211"
}
]
```

- **`GET /v1/global/`**
- **`Optional parameters:`**
- **(string) convert** - return 24h volume, and market cap in terms of another currency. Valid values are:
"AUD", "BRL", "CAD", "CHF", "CNY", "EUR", "GBP", "HKD", "IDR", "INR", "JPY", "KRW", "MXN", "RUB"


```python
>>> coinmarketcap.stats()
{
"bitcoin_percentage_of_market_cap": 45.71,
"total_market_cap_usd": 101753095791.0,
"active_markets": 4046,
"active_assets": 121,
"total_24h_volume_eur": 3199756517.0,
"active_currencies": 745,
"total_market_cap_eur": 90722958453.0,
"total_24h_volume_usd": 3588784327.0
}
```

## License:

```
Copyright 2014-2017 Martin Simon

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

```

## Buy me a coffee?

If you feel like buying me a coffee (or a beer?), donations are welcome:

```
WDC : WbcWJzVD8yXt3yLnnkCZtwQo4YgSUdELkj
HBN : F2Zs4igv8r4oJJzh4sh4bGmeqoUxLQHPki
DOGE: DRBkryyau5CMxpBzVmrBAjK6dVdMZSBsuS
```

Project details


Download files

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

Source Distribution

coinmarketcap-4.1.tar.gz (7.5 kB view details)

Uploaded Source

File details

Details for the file coinmarketcap-4.1.tar.gz.

File metadata

  • Download URL: coinmarketcap-4.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for coinmarketcap-4.1.tar.gz
Algorithm Hash digest
SHA256 d1c53dd5eb33232c08502308b8f6307256b561faf7764e855049a0cbb0b6efb6
MD5 f7c2b8cd8c87982c358098482eecf1a5
BLAKE2b-256 a42599baa60d83315ad984277537594ff93337ed7649d8e1c7fc5f6abf046814

See more details on using hashes here.

Supported by

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