コード例 #1
0
 def get_ticker(cls, **kwargs):
     rawticker = polo.returnTicker()
     usdtick = rawticker['USDT_BTC']
     return create_ticker(bid=usdtick['highestBid'], ask=usdtick['lowestAsk'],
                          high=usdtick['high24hr'], low=usdtick['low24hr'],
                          last=usdtick['last'], volume=usdtick['baseVolume'],
                          timestamp=time.time(), currency='USD')
コード例 #2
0
 def get_ticker(cls, **kwargs):
     rawticker = btcny.get_ticker()
     if 'ticker' in rawticker:
         ticker = rawticker['ticker']
         return create_ticker(bid=ticker['buy'], ask=ticker['sell'], high=ticker['high'], low=ticker['low'],
                              volume=ticker['vol'], last=ticker['last'], timestamp=ticker['date'],
                              currency='CNY')
     raise ExchangeError('btcchina', 'unable to get ticker')
コード例 #3
0
    def get_ticker(cls, pair='btcusd'):
        try:
            rawtick = requests.get(BASE_URL + '/v1/pubticker/%s' % pair, timeout=REQ_TIMEOUT).json()
        except (ConnectionError, Timeout, ValueError) as e:
            raise ExchangeError('bitfinex', '%s %s while sending get_ticker to bitfinex' % (type(e), str(e)))

        return create_ticker(bid=rawtick['bid'], ask=rawtick['ask'], high=rawtick['high'], low=rawtick['low'],
                             volume=rawtick['volume'], last=rawtick['last_price'], timestamp=rawtick['timestamp'],
                             currency='USD')
コード例 #4
0
ファイル: huobi.py プロジェクト: deginner/bitcoin_exchanges
    def get_ticker(cls, pair='btc_usd'):
        try:
            rawtick = requests.get('https://market.huobi.com/staticmarket/ticker_btc_json.js',
                                   timeout=REQ_TIMEOUT).json()
        except (ConnectionError, Timeout, ValueError) as e:
            raise ExchangeError('huobi', '%s %s while sending get_ticker to huobi' % (type(e), str(e)))

        return create_ticker(bid=rawtick['ticker']['buy'], ask=rawtick['ticker']['sell'],
                             high=rawtick['ticker']['high'], low=rawtick['ticker']['low'],
                             volume=rawtick['ticker']['vol'], last=rawtick['ticker']['last'],
                             timestamp=time.time(), currency='CNY')
コード例 #5
0
 def get_ticker(cls, **kwargs):
     rawticker = btcny.get_ticker()
     if 'ticker' in rawticker:
         ticker = rawticker['ticker']
         return create_ticker(bid=ticker['buy'],
                              ask=ticker['sell'],
                              high=ticker['high'],
                              low=ticker['low'],
                              volume=ticker['vol'],
                              last=ticker['last'],
                              timestamp=ticker['date'],
                              currency='CNY')
     raise ExchangeError('btcchina', 'unable to get ticker')
コード例 #6
0
    def get_ticker(cls, pair='btc_usd'):
        try:
            rawtick = requests.get(BASE_URL + 'ticker.do?symbol=%s' % pair,
                                   timeout=REQ_TIMEOUT).json()
        except (ConnectionError, Timeout, ValueError) as e:
            raise ExchangeError(
                'okcoin',
                '%s %s while sending get_ticker to okcoin' % (type(e), str(e)))

        return create_ticker(bid=rawtick['ticker']['buy'],
                             ask=rawtick['ticker']['sell'],
                             high=rawtick['ticker']['high'],
                             low=rawtick['ticker']['low'],
                             volume=rawtick['ticker']['vol'],
                             last=rawtick['ticker']['last'],
                             timestamp=rawtick['date'],
                             currency='USD')
コード例 #7
0
ファイル: lakebtc.py プロジェクト: mayerwin/bitcoin_exchanges
    def get_ticker(cls, pair='btc_cny'):
        try:
            rawtick = requests.get(BASE_URL + 'ticker',
                                   timeout=REQ_TIMEOUT).json()
        except (ConnectionError, Timeout, ValueError) as e:
            raise ExchangeError(
                'lakebtc', '%s %s while sending get_ticker to lakebtc' %
                (type(e), str(e)))

        return create_ticker(bid=rawtick['CNY']['bid'],
                             ask=rawtick['CNY']['ask'],
                             high=rawtick['CNY']['high'],
                             low=rawtick['CNY']['low'],
                             volume=rawtick['CNY']['volume'],
                             last=rawtick['CNY']['last'],
                             timestamp=time.time(),
                             currency='CNY')
コード例 #8
0
ファイル: huobi.py プロジェクト: mayerwin/bitcoin_exchanges
    def get_ticker(cls, pair='btc_usd'):
        try:
            rawtick = requests.get(
                'https://market.huobi.com/staticmarket/ticker_btc_json.js',
                timeout=REQ_TIMEOUT).json()
        except (ConnectionError, Timeout, ValueError) as e:
            raise ExchangeError(
                'huobi',
                '%s %s while sending get_ticker to huobi' % (type(e), str(e)))

        return create_ticker(bid=rawtick['ticker']['buy'],
                             ask=rawtick['ticker']['sell'],
                             high=rawtick['ticker']['high'],
                             low=rawtick['ticker']['low'],
                             volume=rawtick['ticker']['vol'],
                             last=rawtick['ticker']['last'],
                             timestamp=time.time(),
                             currency='CNY')
コード例 #9
0
ファイル: kraken.py プロジェクト: mayerwin/bitcoin_exchanges
 def get_ticker(cls, pair='XXBTZEUR'):
     pair = adjust_pair(pair)
     fullticker = cls.submit_public_request('Ticker', {'pair': pair})
     ticker = fullticker['result'][pair]
     return create_ticker(ask=ticker['a'][0], bid=ticker['b'][0], timestamp=time.time(), volume=ticker['v'][1],
                          last=ticker['c'][0], high=ticker['h'][1], low=ticker['l'][1], currency='EUR')