Skip to main content

Python3 Wrapper for CryptoCompare public API

Project description

https://img.shields.io/pypi/v/cryptocmp.svg https://img.shields.io/travis/OkThought/cryptocmp.svg Documentation Status Updates

Python wrapper for CryptoCompare API

Description

cryptocmp provides to the CryptoCompare API in two ways:

  • Straight wrappers of the API calls in cryptocmp.api package.

  • A more user friendly mapping to these wrappers in object-oriented style via the following classes:

    • cryptocmp.coin.Coin represents a crypto coin.

Installation

pip3 install cryptocmp

or this can also work if you have only python3 installed (the symlink pip pointing to pip3 is created)

pip install cryptocmp

Usage

Examples

In object-oriented style:

  • Get a set of all available crypto coins:

    >>> from cryptocmp.coin import Coin
    >>> Coin.all()
    {'EOSDAC', 'GAP', 'ARN', 'SERA', 'ICASH', 'STAR*', 'AC3', ...}
    
  • Get a current price of BTC in USD:

    >>> from cryptocmp.coin import Coin
    >>> bitcoin = Coin('BTC')
    >>> bitcoin.price('USD')
    6318.35``
    
  • Get a current price of BTC in USD, EUR and GBP at the same time (produces single API call under the hood):

    >>> from cryptocmp.coin import Coin
    >>> bitcoin = Coin('BTC')
    >>> bitcoin.price(('USD', 'EUR', 'GBP'))
    {'USD': 6316.17, 'EUR': 5540.34, 'GBP': 4977.23}``
    
  • Get last 2 candles of BTC/USD daily historical data:

    >>> CoinPair('BTC', 'USD').price_history(points_num=2)
    [
        {
            'time': 1534291200,
            'close': 6274.22,
            'high': 6620.07,
            'low': 6193.63,
            'open': 6199.63,
            'volumefrom': 132926.33,
            'volumeto': 852103141.83
        },
        {
            'time': 1534377600,
            'close': 6439.39,
            'high': 6439.39,
            'low': 6217.33,
            'open': 6274.22,
            'volumefrom': 24013.18,
            'volumeto': 152446768.26
        }
    ]

Credit

Thanks to CryptoCompare for providing this service and building a nice community around everything crypto related.

Project was partially patched with files generated by Cookiecutter using cookiecutter-pypackage project template. Thanks to Audrey Roy Greenfeld and contributors who made python package creation so easy.

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

cryptocmp-0.3.3.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

cryptocmp-0.3.3-py2.py3-none-any.whl (17.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cryptocmp-0.3.3.tar.gz.

File metadata

  • Download URL: cryptocmp-0.3.3.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for cryptocmp-0.3.3.tar.gz
Algorithm Hash digest
SHA256 e589b0b84a19d82fb1a3dd29cbc361ee9b9198946535b64ab9ba699b4e1745c8
MD5 0c4a92c9d5225f1a538daedf485fcf62
BLAKE2b-256 43060e536d4e3e5ee93f7d719ef268283ea7d6ffcd28dc356e64d62f9afddac2

See more details on using hashes here.

File details

Details for the file cryptocmp-0.3.3-py2.py3-none-any.whl.

File metadata

  • Download URL: cryptocmp-0.3.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for cryptocmp-0.3.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3eacf021a42f4e50a1617fc5912b210db2014660c9f0b04bfaef7ce5ac83915c
MD5 3beb4d2e8b226f9adbd3a7314ff3acda
BLAKE2b-256 57996fa32677949b88dd4e4ce1a449c23a5d1a11137696d86c88d3e5e36ce450

See more details on using hashes here.

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