【发布时间】:2022-08-11 19:25:43
【问题描述】:
如何更改我的代码,以便每 100 毫秒获取一次信息?
import asyncio
from binance import AsyncClient, BinanceSocketManager
async def main():
client = await AsyncClient.create()
bm = BinanceSocketManager(client)
# start any sockets here, i.e a trade socket
ts = bm.trade_socket(\'BTCBUSD\')
# then start receiving messages
async with ts as tscm:
while True:
res = await tscm.recv()
print(res)
await client.close_connection()
if __name__ == \"__main__\":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
我很感激我能得到的每一个答案,非常感谢!
-
目前获取信息的时间是多少毫秒?我也认为由于交易所设置的限制,你能得到的最快是 200 ~ 300 ms
-
似乎我每 2 秒获取一次数据。每 200 毫秒获取一次数据会很棒。你知道我该怎么做吗?
-
是的,我会在周末为你写点东西。
-
非常感谢你 。我正在等待尽快
标签: python api websocket bitcoin binance