LUCIT-Systems-and-Development / unicorn-binance-websocket-api

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.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
683 stars 164 forks source link

boolean value should be made False instead of false in pop_stream_data_from_stream _buffer() #94

Closed gfox72 closed 4 years ago

gfox72 commented 4 years ago

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.

Schermafbeelding 2020-07-29 om 16 58 36

gfox72 commented 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

oliver-zehentleitner commented 4 years ago

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 :)

gfox72 commented 4 years ago

copy, thx !