优化代码
This commit is contained in:
@@ -16,11 +16,11 @@ async def start_bn_future_order_consumer(account_id, api_key, api_secret, testne
|
|||||||
client = await AsyncClient.create(api_key, api_secret, testnet=testnet)
|
client = await AsyncClient.create(api_key, api_secret, testnet=testnet)
|
||||||
bm = BinanceSocketManager(client, max_queue_size=100000)
|
bm = BinanceSocketManager(client, max_queue_size=100000)
|
||||||
ws = bm.futures_user_socket()
|
ws = bm.futures_user_socket()
|
||||||
while True:
|
async with ws as stream:
|
||||||
msg = await ws.recv()
|
while True:
|
||||||
msg['x-account-id'] = account_id
|
msg = await ws.recv()
|
||||||
asyncio.create_task(send_msg(msg))
|
msg['x-account-id'] = account_id
|
||||||
|
asyncio.create_task(send_msg(msg))
|
||||||
|
|
||||||
async def send_msg(msg):
|
async def send_msg(msg):
|
||||||
logger.info(f"send to kafka: {msg}")
|
logger.info(f"send to kafka: {msg}")
|
||||||
|
|||||||
Reference in New Issue
Block a user