A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/user/.local/lib/python3.6/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py", line 142, in _create_stream_thread
loop.run_until_complete(binance_websocket_api_socket.start_socket())
File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/home/user/.local/lib/python3.6/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_socket.py", line 62, in start_socket
received_stream_data_json = await websocket.receive()
File "/home/user/.local/lib/python3.6/site-packages/unicorn_binance_websocket_api/unicorn_binance_websocket_api_connection.py", line 183, in receive
received_data = await self.handler_binance_websocket_api_manager.websocket_list[self.stream_id].recv()
File "/home/user/.local/lib/python3.6/site-packages/websockets/protocol.py", line 441, in recv
self._put_message_waiter.set_result(None)
asyncio.base_futures.InvalidStateError: invalid state
We added an error handling for asyncio.base_futures.InvalidStateError: invalid state and a restart process for the stream and it worked well for a while.
In Nov 2019 the websockets 8.1 was released and we switched over to it as a requirement, we are using newer python versions and it looks like, that something important has changed.
So I think its the best to remove that code part and lets see whats happens then..
If someone is receiving a new InvalidStateError please post
Related to issue https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/18, https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/105, https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/83
The first issue https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/18 was created in Jun 2019 by @DaWe35 who reported this error:
We added an error handling for
asyncio.base_futures.InvalidStateError: invalid state
and a restart process for the stream and it worked well for a while.In Nov 2019 the websockets 8.1 was released and we switched over to it as a requirement, we are using newer python versions and it looks like, that something important has changed.
So I think its the best to remove that code part and lets see whats happens then..
If someone is receiving a new InvalidStateError please post
in this issue below!