优化代码
This commit is contained in:
@@ -7,8 +7,8 @@ async def start():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
async def start_bn_future_order_consumer(account_id, api_key, api_secret):
|
async def start_bn_future_order_consumer(account_id, api_key, api_secret, testnet=False):
|
||||||
client = await AsyncClient.create(api_key, api_secret, testnet=True,https_proxy="http://127.0.0.1:7890")
|
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()
|
||||||
|
|
||||||
@@ -23,11 +23,3 @@ async def send_msg(msg):
|
|||||||
logger.info(f"send to kafka: {msg}")
|
logger.info(f"send to kafka: {msg}")
|
||||||
await kafka_service.send_to_kafka("binance_future_order_update", json.dumps(msg),key="DEFAULT",send_now=True)
|
await kafka_service.send_to_kafka("binance_future_order_update", json.dumps(msg),key="DEFAULT",send_now=True)
|
||||||
logger.info(f"send to kafka success: {msg}")
|
logger.info(f"send to kafka success: {msg}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
import asyncio
|
|
||||||
api_key = "a47059edcf978d1e1f616634c2cce1b3ae22e741f745a5152b56c039e8bfa7a4"
|
|
||||||
secret = "6f69f45a686cfc7dae71c10ebd3419517582b0f4ce0253e6c21d853e8637c112"
|
|
||||||
asyncio.run(start_bn_future_order_consumer(1, api_key, secret))
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user