Giter VIP home page Giter VIP logo

bitcoin-price-api's Introduction

Bitcoin Price API

If you are trying to do interesting things with bitcoin price data, you shouldn't have to be concerned with the low-level details of how to obtain that data, or the particular JSON structures that it comes in. This module will provide a unified way of getting price data from various exchanges which have publicly available API's, as well as a unified representation of that data rather than exchange specific ones.

Quick Guide

    >>> from exchanges import bitfinex
    >>> bitfinex.get_current_price()
    Decimal('371.17')

Dependencies

The only dependency is on the requests library. You can either do pip install requests or pip install -r requirements.txt inside the directory.

Bitstamp, Bitfinex, OKCoin, Huobi

All expose the interface below:

get_current_price()
get_current_bid()
get_current_ask()

which will return a Decimal object. Note that all exchanges return values in USD, with the exception of Huobi which returns CNY.

Coindesk

Coindesk offers a much richer price interface:

get_current_price(currency='USD')
get_past_price(date)
get_historical_data_as_dict(start='2013-09-01', end=None)
get_historical_data_as_list(start='2013-09-01', end=None)

get_current_price and get_past_price both return Decimal objects.

get_current_price takes in an optional parameter specifying the currency.

The dates for all functions must be in the form 'YYYY-MM-DD'.

get_historical_data_as_dict will return a dictionary of the following format:

{'2014-10-20': 400.00, '2014-10-21': 301.99}

Remember that these date/prices will not be in any given order.

get_historical_data_as_list will return a list of dictionaries, correctly sorted by date from start to end.

[{'date': 'YYYY-MM-DD', 'price': 300.00}, {'date': 'YYYY-MM-DD', 'price': 301.00 }]

bitcoin-price-api's People

Contributors

sathoro avatar

Watchers

 avatar  avatar  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.