def get_current_price(cls, currency='USD'): url = 'https://api.coindesk.com/v1/bpi/currentprice/{}.json'.format( currency ) data = get_response(url) price = data['bpi'][currency]['rate'] return Decimal(price)
def get_current_price(cls, currency='USD'): url = 'https://api.coindesk.com/v1/bpi/currentprice/{}.json'.format( currency ) data = get_response(url) price = data['bpi'][currency]['rate_float'] return Decimal(price)
def _get_historical_data(cls, start, end=None): if not end: end = start url = ( 'https://api.coindesk.com/v1/bpi/historical/close.json' '?start={}&end={}'.format( start, end ) ) return get_response(url)
def refresh(self, callback=None, client_data=None): self.data = get_response(self.ticker_url) if callback is not None: callback(self, client_data)
def get_current_ask(cls, currency='USD', btc_amount=0.1): url = cls.TICKER_URL.format(currency) data = get_response(url) level = cls._pick_level(btc_amount) if btc_amount > 0 else 'small' price = str(data[level]['ask']) return Decimal(price)
def get_current_price(cls, currency='USD'): url = cls.TICKER_URL.format(currency) data = get_response(url) price = str(data['index']) return Decimal(price)
def _get_current_price(cls, currency='USD', price_type='spot'): url = cls.TICKER_URL.format(currency, price_type) data = get_response(url) price = data.get('data').get('amount') return Decimal(price)
def get_current_ask(cls, pair=''): data = get_response(cls.DEPTH_URL % cls.PAIR) price = data['result'][cls.PAIR]['asks'][0][0] return Decimal(str(price))
def get_current_ask(cls, pair='XXBTZUSD'): data = get_response(cls.DEPTH_URL % pair) price = data['result'][pair]['asks'][0][0] return Decimal(str(price))
def get_current_price(cls, pair='XXBTZUSD'): data = get_response(cls.TICKER_URL % pair) price = data['result'][pair][-1][0] return Decimal(str(price))
def get_current_price(cls, pair=''): data = get_response(cls.TICKER_URL % cls.PAIR) price = data['result'][cls.PAIR][-1][0] return Decimal(str(price))