Giter Club home page Giter Club logo

cryptocompare's Introduction

cryptocompare

Python3 Wrapper to query cryptocurrency prices (and more) using the CryptoCompare API.

Installation

sudo pip3 install cryptocompare

Usage

Import

import cryptocompare

Methods

Coin List

cryptocompare.get_coin_list(format=False)

# ...
# },
# 'BTC': {
#  'Id': '1182'
#  'Url': '/coins/btc/overview'
#  'ImageUrl': '/media/19633/btc.png'
#  'Name': 'BTC'
#  'CoinName': 'Bitcoin'
#  'FullName': 'Bitcoin (BTC)'
#  'Algorithm': 'SHA256'
#  'ProofType': 'PoW'
#  'FullyPremined': '0'
#  'TotalCoinSupply': '21000000'
#  'PreMinedValue': 'N/A'
#  'TotalCoinsFreeFloat': 'N/A'
#  'SortOrder': '1'
# },
# ...

If format is True, the coin list is returned as Python list.

Price

cryptocompare.get_price('BTC')
# or
cryptocompare.get_price('BTC',curr='USD',full=True)
# or
cryptocompare.get_price(['BTC','ETH'],['EUR','GBP'])

# {'BTC': {'EUR': 3709.04, 'GBP': 3354.78},
#  'ETH': {'EUR': 258.1, 'GBP': 241.25}}

Historical Price

# pass either datetime or time instance
cryptocompare.get_historical_price('XMR', timestamp=datetime.datetime(2017,6,6))
# or
cryptocompare.get_historical_price('XMR', 'EUR', datetime.datetime(2017,6,6))

# {'XMR': {'EUR': 43.05}}

Average

cryptocompare.get_avg('BTC', 'EUR', 'Kraken')

# {
# 'MARKET': 'CUSTOMAGG',
# 'FROMSYMBOL': 'BTC',
# 'TOSYMBOL': 'EUR',
# 'FLAGS': 0,
# 'PRICE': 3610,
# 'LASTUPDATE': 1503066719,
# 'LASTVOLUME': 0.5,
# 'LASTVOLUMETO': 1805,
# 'LASTTRADEID': 1503066719.7584,
# 'VOLUME24HOUR': 12614.509997469995,
# 'VOLUME24HOURTO': 46397723.00499387,
# 'OPEN24HOUR': 3847.9,
# 'HIGH24HOUR': 3848.96,
# 'LOW24HOUR': 3555,
# 'LASTMARKET': 'Kraken',
# 'CHANGE24HOUR': -237.9000000000001,
# 'CHANGEPCT24HOUR': -6.182593102731363
# }

Credit

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

Tipjar

If you like this and/or use it in a project, show some love:

BTC: 1JJMk3QmcyTjPsvFpKUhgvPNd3KcWCKc86

ETH: 0xe3c951a953f56d0ec88800386281e88ea9bef630

...or head over to https://www.cryptocompare.com and tip CryptoCompare.

Disclaimer

This is a hobby project, no guarantees. If you find bugs, open an issue. If you want additional features, open an issue or create a pull request.

cryptocompare's People

Contributors

lagerfeuer avatar mohataher avatar

Watchers

Ryan Hennig avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.