我尝试从 Binance Websocket 获取数据。使用 python 3.9 作为解释器它运行良好,但是使用 3.10 它给了我错误:(
这是代码:
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('BNBBTC')
# then start receiving messages
async with ts as tscm:
while True:
res = await tscm.recv()
print(res)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
我收到此错误:
DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
我使用 PyCharm 作为 IDE。
请问有哪位可以帮帮我吗?