Closed gfox72 closed 4 years ago
same goes for true > True and null > None. This likely originates at the side of binance so can't really call it a bug, but I think it would be nice to do the conversion before pop'ing out the stream
Hi Gfox!
The the websocket lib has to care about the connection and about receiving data from binance.
Binance sends strings to us. This strings are represent different values with JSON syntax (but data type is string!)
So the work of unicorn-binance-websocket-api is done at this point!
If you want to work with python dicts you can convert the json string to a dict. To make this conversion easyier i wrote a second lib called unicorn-fy: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api#convert-received-raw-webstream-data-into-well-formed-python-dictionaries-with-unicornfy
Binance maybe doesnt use Python, maybe they use Java, C++ or what ever. So you cant expect a python "True" - they write true and then its up to you and the language you use how to work with it.
Unicorn-fy is converting a true string to a boolen Python True that you expect....
I hope this helps you :)
copy, thx !
as used in several examples, oldest_stream_data_from_stream_buffer = binance_websocket_api_manager.pop_stream_data_from_stream_buffer() will generate a String
However, to easily convert it to a dict, I noticed the boolean value comes as false while it should be capital False to easily process, see console screenshot where I copy/pasted the intitial stream string and changed the false to False at the end.