Skip to content

bnc-projects/python-bravenewcoin-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Brave New Coin Client

Build Status

A Python library to connect with Brave New Coin APIs.

Supported APIs:

Install

pip install git+https://github.com/pgrangeiro/python-bravenewcoin-client.git

Tests

tox

Usage

>>> from brave.clients import SpotPriceClient
>>> client = SpotPriceClient('customer', ('BraveNewCoin-API-Key', 'Token'))

Get crypto coin latest quotes

Return the latest quote for crypto coin.

Parameters:

  • Ticker: The crypto coin ticker. Type: String.
  • Currency[optional]: The crypto coin value converted to currency. Type: String. Default: USD.
>>> from brave.clients import SpotPriceClient
>>> client = SpotPriceClient('customer', ('BraveNewCoin-API-Key', 'Token'))
>>> client.get('btc')
{'success': True, 'source': 'BraveNewCoin', 'time_stamp': 1523066461, 'utc...

Get crypto coin exchange rates

Return the historic exchange data for crypto coin.

Parameters:

  • Ticker: The crypto coin ticker. Type: String.
  • Start Date[optional]: Get historic data from start date. Type: Datetime. Default: Today.
  • End Date[optional]: Get historic data until end date. Type: Datetime. Default: Today.
  • Currency[optional]: The crypto coin value converted to currency. Type: String. Default: USD.
>>> from brave.clients import ExchangeClient
>>> client = ExchangeClient('customer', ('BraveNewCoin-API-Key', 'Token'))
>>> client.get('btc')
{'success': True, 'source': 'BraveNewCoin', 'time_stamp': 1523066820, 'utc...

Get crypto coins market capitalization

Return the market capitalization data for all crypto coins tracked by Brave New Coin.

Parameters:

  • Days[optional]: Get market cap data for a number of days. Type: Integer. Default: 1.
>>> from brave.clients import MarketClient
>>> client = MarketClient('customer', ('BraveNewCoin-API-Key', 'Token'))
>>> client.get()
{'success': True, 'source': 'BraveNewCoin', 'endpoint': 'market-table', 'r...

Parsing response data from Brave New Coin API

You can create your own parser with your parse class method.

from brave.clients import SpotClient


class MyParser:

    @classmethod
    def parse(cls, data):
        return {
            'ticker': data['coin_id'],
            'last_value': data['last_price'],
        }

client = SpotPriceClient('customer', ('BraveNewCoin-API-Key', 'Token'), MyParser)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%