Unicorn Websocket crashes because of key 'data' error when the event type is balanceUpdate #20
Closed
4 of 11 tasks
Labels
bug
Something isn't working
Check this or we will delete your issue. (fill in the checkbox with an X like so: [x])
Select one:
Environment
Operating System? (include version)
Exact Python Version?
Pip Version?
Description of your issue
unicorn-binance-websocket-api crashes when I use the output=UnicornFy on my user stream and I make a manual trade on my Binance account. My guess is that the key 'balanceUpdate' does not exist in UnicornFy.
This error occurs both in margin (cross and isolated) and spot account stream data.
I've created the isolated margin stream with the output=UnicornFy
This is part of the DEBUG output after I've sent 1USDT to my BTCUSDT Isolated-Margin (this error also happens in the spot account when I trade manually.
I think this is the part of the UnicornFy code that misses the balanceUpdate key and throws the error down in the code:
Since the 'balanceUpdate' is not on this if-else chain the stream_data follows as it is, the code down below can't find the key 'data' and raises the error killing the WebSocket.
I did a local test tinkering with this and worked, however, I did by processing the JSON after the buffer output and not using the output param in create_stream. I'll fork the code, fix this and will do a pull request.
The text was updated successfully, but these errors were encountered: