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
678 stars 166 forks source link

oldest_stream_data_from_stream_buffer OUTPUT #165

Closed kuratkull closed 3 years ago

kuratkull commented 3 years ago
618775300351, 'm': True, 'M': True}}
{'stream': 'bnbbtc@trade', 'data': {'e': 'trade', 'E': 1618775300359, 's': 'BNBBTC', 't': 132628372, 'p': '0.00850160', 'q': '1.48000000', 'b': 967634566, 'a': 967634573, 'T': 1618775300358, 'm': True, 'M': True}}
{'stream': 'bnbbtc@trade', 'data': {'e': 'trade', 'E': 1618775300373, 's': 'BNBBTC', 't': 132628373, 'p': '0.00850160', 'q': '1.03000000', 'b': 967634574, 'a': 967634577, 'T': 1618775300372, 'm': True, 'M': True}}
{'stream': 'bnbbtc@trade', 'data': {'e': 'trade', 'E': 1618775300482, 's': 'BNBBTC', 't': 132628374, 'p': '0.00850160', 'q': '0.98000000', 'b': 967634574, 'a': 967634579, 'T': 1618775300481, 'm': True, 'M': True}}

I tried to set the output as follows, but it did not work.

while True:
    oldest_stream_data_from_stream_buffer = binance_websocket_api_manager.pop_stream_data_from_stream_buffer()
    if oldest_stream_data_from_stream_buffer:
        print(oldest_stream_data_from_stream_buffer)
        j = json.load(oldest_stream_data_from_stream_buffer)
        print(j('time','symbol','price','quentity','m'))

how can i get it output this way

time symbol price quentity true/false

oliver-zehentleitner commented 3 years ago

https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api#convert-received-raw-webstream-data-into-well-formed-python-dictionaries-with-unicornfy