This commit is contained in:
lz_db
2025-11-30 11:19:39 +08:00
parent 6bb93a3968
commit a630c42ddd
4 changed files with 68 additions and 32 deletions

View File

@@ -135,20 +135,19 @@ async def websocket_quick_test():
async def order_listener():
while True:
# print("111111111")
res = await exchange.watch_ticker(symbol='BTCUSD')
logger.error("aaa")
logger.warning("bbb")
logger.debug("ccc")
res = await exchange.watch_orders()
print("===========================收到信息")
print(res)
for order in res:
del order['info']
logger.info(f"📦 订单更新: {order}")
# for order in res:
# logger.info(f"📦 订单更新: {order}")
# 监听余额更新
async def balance_listener():
balance = await exchange.watch_balance()
total = sum([v for v in balance['total'].values() if v is not None])
logger.info(f"💰 余额更新: 总余额 {total:.2f}")
# async def balance_listener():
# balance = await exchange.watch_balance()
# total = sum([v for v in balance['total'].values() if v is not None])
# logger.info(f"💰 余额更新: 总余额 {total:.2f}")
# 运行监听器
await asyncio.gather(
@@ -166,5 +165,5 @@ async def websocket_quick_test():
if __name__ == "__main__":
# 运行快速测试
asyncio.run(quick_order_test())
# asyncio.run(websocket_quick_test())
# asyncio.run(quick_order_test())
asyncio.run(websocket_quick_test())