def okex_spot(): print("Okex 币币账户状态监控中...") url = 'wss://real.okex.com:8443/ws/v3' access_key = config.access_key secret_key = config.secret_key passphrase = config.passphrase task_list = [] symbol_list = [ 'BTC', 'lTC', 'ETH', 'ETC', 'XRP', 'EOS', 'BCH', 'BSV', 'TRX', 'USDT' ] for item in symbol_list: task_list.append( okex_subscribe(url, access_key, passphrase, secret_key, ["spot/account:{}".format(item)])) asyncio.run(asyncio.wait(task_list))
def okex_futures_usd(): print("Okex币本位交割合约持仓状态监控中...") url = 'wss://real.okex.com:8443/ws/v3' access_key = config.access_key secret_key = config.secret_key passphrase = config.passphrase delivery_date = config.delivery_date task1 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:BTC-USD-{}".format(delivery_date)]) task2 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:BCH-USD-{}".format(delivery_date)]) task3 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:BSV-USD-{}".format(delivery_date)]) task4 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:ETH-USD-{}".format(delivery_date)]) task5 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:ETC-USD-{}".format(delivery_date)]) task6 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:EOS-USD-{}".format(delivery_date)]) task7 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:LTC-USD-{}".format(delivery_date)]) task8 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:TRX-USD-{}".format(delivery_date)]) task9 = okex_subscribe( url, access_key, passphrase, secret_key, ["futures/position:XRP-USD-{}".format(delivery_date)]) task_list = [task1, task2, task3, task4, task5, task6, task7, task8, task9] asyncio.run(asyncio.wait(task_list))
def okex_swap_usd(): print("Okex 永续合约持仓状态监控中...") url = 'wss://real.okex.com:8443/ws/v3' access_key = config.access_key secret_key = config.secret_key passphrase = config.passphrase task_list = [] symbol_list = [ 'BTC-USD-SWAP', 'lTC-USD-SWAP', 'ETH-USD-SWAP', 'ETC-USD-SWAP', 'XRP-USD-SWAP', 'EOS-USD-SWAP', 'BCH-USD-SWAP', 'BSV-USD-SWAP', 'TRX-USD-SWAP', ] for item in symbol_list: task_list.append( okex_subscribe(url, access_key, passphrase, secret_key, ["swap/position:{}".format(item)])) asyncio.run(asyncio.wait(task_list))