async def run(): api_key = os.environ['BIBOXAPIKEY'] sec_key = os.environ['BIBOXSECKEY'] bibox = CryptoXLib.create_bibox_client(api_key, sec_key) print("Ping:") await bibox.get_ping() print("Pair list:") await bibox.get_pairs() print("Exchange info:") await bibox.get_exchange_info() print("User assets:") await bibox.get_spot_assets(full=True) print("Create order:") try: await bibox.create_order(pair=Pair('ETH', 'BTC'), order_type=enums.OrderType.LIMIT, order_side=enums.OrderSide.BUY, price="1", quantity="1") except BiboxException as e: print(e) print("Cancel order:") await bibox.cancel_order(order_id="1234567890") await bibox.close()
async def run(): api_key = os.environ['BIBOXAPIKEY'] sec_key = os.environ['BIBOXSECKEY'] bibox = CryptoXLib.create_bibox_client(api_key, sec_key) bibox.compose_subscriptions([ OrderBookSubscription(pair=Pair('BTC', 'USDT'), callbacks=[order_book_update]), ]) bibox.compose_subscriptions([ TradeSubscription(pair=Pair('BTC', 'USDT'), callbacks=[trade_update]), ]) # Execute all websockets asynchronously await bibox.start_websockets() await bibox.close()