python-binance
python-binance copied to clipboard
Futures socket does not work with websockets version 10.0
Describe the bug I recently reinstalled all modules and the futures websocket suddenly stopped working (no exceptions thrown). Downgrading to "websockets==9.1" resolved the issue.
To Reproduce
Install the latest version of python-binance and websockets, then the following code will get stuck at tscm.recv()
client = await AsyncClient.create() bm = BinanceSocketManager(client) ts = bm.aggtrade_futures_socket('BTCUSDT') async with ts as tscm: while True: res = await tscm.recv() print(res)
Environment (please complete the following information):
- Python version: 3.8.10
- OS: [Ubuntu]
- python-binance version: 1.0.12
Describe the bug I recently reinstalled all modules and the futures websocket suddenly stopped working (no exceptions thrown). Downgrading to "websockets==9.1" resolved the issue.
To Reproduce Install the latest version of python-binance and websockets, then the following code will get stuck at tscm.recv()
client = await AsyncClient.create() bm = BinanceSocketManager(client) ts = bm.aggtrade_futures_socket('BTCUSDT') async with ts as tscm: while True: res = await tscm.recv() print(res)
Environment (please complete the following information):
- Python version: 3.8.10
- OS: [Ubuntu]
- python-binance version: 1.0.12
I have the same problem. I have suffered losses because of this. Developers need to commit versions of dependent libraries in files requirements.txt and setup.py.
Yeah, took me a while to figure out what the issue even was. I forgot to mention that I only tried the aggregated trades websocket stream and that it works for spot markets while the futures markets does not.
OMG It takes me 48 hours to find the problem
Describe the bug I recently reinstalled all modules and the futures websocket suddenly stopped working (no exceptions thrown). Downgrading to "websockets==9.1" resolved the issue. To Reproduce Install the latest version of python-binance and websockets, then the following code will get stuck at tscm.recv()
client = await AsyncClient.create() bm = BinanceSocketManager(client) ts = bm.aggtrade_futures_socket('BTCUSDT') async with ts as tscm: while True: res = await tscm.recv() print(res)
Environment (please complete the following information):
- Python version: 3.8.10
- OS: [Ubuntu]
- python-binance version: 1.0.12
I have the same problem. I have suffered losses because of this. Developers need to commit versions of dependent libraries in files requirements.txt and setup.py.
I could not agree anymore. Developers need to commit versions of dependent libraries in files requirements.txt and setup.py.
Big issue indeed, recently did a reinstall and took me a long long time to figure out what's wrong...
Still didn't work for me :(
Python version : 3.9.7 OS: Windows 10 Pro python-binance version: 1.0.14
I tried with websockets 9.1, 8.1, upgrading my python version, my python-binance version, nothing work :(
@DaStapo Thank you very much! It takes me 48 hours to find out what's the problem.
@Molloss: you're same env with me. If you're using testnet, you must me change code in stream.py #929
I tried future socket over 6~8 hours. finally I solved it thanks to you by downgrade websockets.
I tried future socket over 6~8 hours. finally I solved it thanks to you by downgrade websockets.
What is the version of the websockets library at your system ? I have same problem. Every stream works except futures socket.
this issue is still going on, after 20 days of being reported.
manually installing websockets==9.1
continues to be the solution, while installing dependencies as-is from this library continues to be broken
Here you can find information about the cause and suggestions for a workaround: https://github.com/aaugustin/websockets/issues/1065
It looks like websockets will be able to handle this again in future versions: https://github.com/aaugustin/websockets/pull/1067/files
this issue is still going on, after 20 days of being reported.
manually installing
websockets==9.1
continues to be the solution, while installing dependencies as-is from this library continues to be broken
@ericcastro I have the same problem, but websockets version 9.1 does not seem to work for me, does this snippet work for you ?
from binance import ThreadedWebsocketManager
bsm = ThreadedWebsocketManager()
bsm.start()
def show_ticker(msg):
print(msg)
bsm.start_kline_futures_socket(callback=show_ticker, symbol='BTCUSDT', interval='1m')
websockets==9.1
gets installed by default now with this library however I still can't see any streams with multiplex.
Wat do?
Hello, add this at the start of your code:
import asyncio
import nest_asyncio
nest_asyncio.apply()
that should be enough