unicorn-binance-websocket-api
unicorn-binance-websocket-api copied to clipboard
websocket crashes regularly
Version of this library.
unicorn-binance-websocket 1.41.0
wss = BinanceWebSocketApiManager(
exchange="binance.com-futures",
show_secrets_in_logs=True,
high_performance=True
)
userdata_stream_id = wss.create_stream(
"arr",
"!userData",
api_key=key,
api_secret=secret,
stream_label='userData',
output="dict",
ping_interval=10, ping_timeout=10, close_timeout=5
)
user_thread = threading.Thread(
target=callback_user_data_event,
args=(wss,)
)
user_thread.start()
wss.wait_till_stream_has_started(userdata_stream_id)
Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.
- [X] I checked the documentation and other Issues. I am using the latest version of this library.
Hardware?
Local server/workstation
Operating System?
Windows
Python version?
Python3.9
Installed packages
No response
Logging output
22 Jun 22 17:44:52 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.set_socket_is_not_ready(1ac92630ef63-4949-7997-2962-2121282d) - called by File "unicorn_binance_websocket_api\manager.py", line 3417, in set_socket_is_not_ready
logger.debug(f"BinanceWebSocketApiManager.set_socket_is_not_ready({stream_id}){self.get_debug_log()}")
22 Jun 22 17:44:52 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.is_stop_request(1ac92630ef63-4949-7997-2962-2121282d) - called by File "unicorn_binance_websocket_api\manager.py", line 2697, in is_stop_request
logger.debug(f"BinanceWebSocketApiManager.is_stop_request({stream_id}){self.get_debug_log()}")
22 Jun 22 17:44:52 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.is_stop_request(1ac92630ef63-4949-7997-2962-2121282d) - called by File "unicorn_binance_websocket_api\manager.py", line 2697, in is_stop_request
logger.debug(f"BinanceWebSocketApiManager.is_stop_request({stream_id}){self.get_debug_log()}")
22 Jun 22 17:44:53 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.set_heartbeat(1ac92630ef63-4949-7997-2962-2121282d)
22 Jun 22 17:44:53 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.is_stop_request(1ac92630ef63-4949-7997-2962-2121282d) - called by File "unicorn_binance_websocket_api\manager.py", line 2697, in is_stop_request
logger.debug(f"BinanceWebSocketApiManager.is_stop_request({stream_id}){self.get_debug_log()}")
22 Jun 22 17:44:53 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.is_stop_as_crash_request(1ac92630ef63-4949-7997-2962-2121282d) - called by File "unicorn_binance_websocket_api\manager.py", line 2719, in is_stop_as_crash_request
f"){self.get_debug_log()}")
22 Jun 22 17:44:53 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.set_heartbeat(1ac92630ef63-4949-7997-2962-2121282d)
22 Jun 22 17:44:55 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiSocket.start_socket(1ac92630ef63-4949-7997-2962-2121282d, ['arr'], ['!userData'] - Received inner asyncio.TimeoutError
22 Jun 22 17:44:55 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.is_stop_request(1ac92630ef63-4949-7997-2962-2121282d) - called by File "unicorn_binance_websocket_api\manager.py", line 2697, in is_stop_request
logger.debug(f"BinanceWebSocketApiManager.is_stop_request({stream_id}){self.get_debug_log()}")
22 Jun 22 17:44:55 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.is_stop_as_crash_request(1ac92630ef63-4949-7997-2962-2121282d) - called by File "unicorn_binance_websocket_api\manager.py", line 2719, in is_stop_as_crash_request
f"){self.get_debug_log()}")
22 Jun 22 17:44:55 - unicorn_binance_websocket_api - DEBUG - BinanceWebSocketApiManager.set_heartbeat(1ac92630ef63-4949-7997-2962-2121282d)
Processing method?
process_stream_data
Used endpoint?
binance.com-futures
Issue
I am opening a user stream websocket, and right away I get the errors above.
Anyone knows why I get those errors?
Dont use high_performance=True
with only one stream!
Do it this way:
from unicorn_binance_websocket_api.manager import BinanceWebSocketApiManager
def callback_user_data_event(stream_data, stream_buffer_name=False):
print(f"{stream_data}")
ubwa = BinanceWebSocketApiManager(exchange="binance.com-futures")
ubwa.create_stream("arr",
"!userData",
api_key=key,
api_secret=secret,
stream_label='userData',
output="dict",
ping_interval=10,
ping_timeout=10,
close_timeout=5,
process_stream_data=callback_user_data_event)