Ejemplo n.º 1
0
async def run():
    api_key = os.environ['HITBTCAPIKEY']
    sec_key = os.environ['HITBTCSECKEY']

    client = CryptoXLib.create_hitbtc_client(api_key, sec_key)

    print("Account balance:")
    await client.get_balance()

    print("Symbols:")
    await client.get_symbols()

    print("Orderbook:")
    await client.get_order_book(pair=Pair("ETH", "BTC"), limit=2)

    await client.close()
Ejemplo n.º 2
0
async def run():
    api_key = os.environ['HITBTCAPIKEY']
    sec_key = os.environ['HITBTCSECKEY']

    client = CryptoXLib.create_hitbtc_client(api_key, sec_key)

    # Bundle several subscriptions into a single websocket
    client.compose_subscriptions([
        AccountSubscription(callbacks=[account_update]),
        OrderbookSubscription(pair=Pair("ETH", "BTC"),
                              callbacks=[order_book_update]),
        TickerSubscription(pair=Pair("BTC", "USD"), callbacks=[ticker_update])
    ])

    # Bundle another subscriptions into a separate websocket
    client.compose_subscriptions([
        TradesSubscription(pair=Pair("ETH", "BTC"),
                           limit=5,
                           callbacks=[trade_update])
    ])

    # Execute all websockets asynchronously
    await client.start_websockets()
Ejemplo n.º 3
0
 async def init_test(self):
     self.client = CryptoXLib.create_hitbtc_client(api_key, sec_key)