sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
6.01k stars 2.2k forks source link

python-binance not working with Python 3.10? #1391

Open chiwalfrm opened 8 months ago

chiwalfrm commented 8 months ago

Describe the bug nothing received on websocket

To Reproduce

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('BTCUSDT')
        # 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())

Expected behavior Essentially the line "res = await tscm.recv()" never finishes. Nothing is received.

Environment (please complete the following information):

Logs or Additional context Add any other context about the problem here.

luk0y commented 7 months ago

I am on Python 3.10.12 and Ubuntu 22.04 python-binance version is 1.0.19 I can verify this code is working fine.