LUCIT-Systems-and-Development / unicorn-fy

A Python SDK by LUCIT to convert received raw data from crypto exchange API endpoints into well-formed python dictionaries.
https://unicorn-fy.docs.lucit.tech
MIT License
54 stars 20 forks source link

CRITICAL:root:UnicornFy #30

Closed yoobi closed 2 years ago

yoobi commented 2 years ago

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?

Include here the response of 'python --version' or 'python3 --version'
Python 3.9.7

Pip Version?

Include here the response of 'pip --version' or 'pip3 --version'
pip 21.2.4

Description of your issue

I just got this error while looking at logs, it seems that a Boolean has been passed instead of json data

CRITICAL:root:UnicornFy->binance_futures_websocket(False) - error: 'bool' object does not support item assignment

def print_stream_buffer_data(binance_websocket_api_manager, stream_id):
    while True:
        if binance_websocket_api_manager.is_manager_stopping():
            exit(0)
        oldest_stream_data_from_stream_buffer = binance_websocket_api_manager.pop_stream_data_from_stream_buffer(
            stream_id)
        if oldest_stream_data_from_stream_buffer is False:
            time.sleep(0.01)
        else:
            order = UnicornFy.binance_com_futures_websocket(oldest_stream_data_from_stream_buffer) # <--- ERROR HERE
            if order.get('stream_type') == "ACCOUNT_CONFIG_UPDATE":
                # PROCESS DATA
            if order.get("stream_type") == "ORDER_TRADE_UPDATE":
                # PROCESS DATA
oliver-zehentleitner commented 2 years ago

Hm... the error is unlogic.

If oldest_stream_data_from_stream_buffer is False then the block where the error happens should never get executed because this can only happen as "else" of False...

Can you debug this to get more info?

A solution could be if you use the integrated unicornfy of ubwa by: ubwa.create_stream(['trade'], ['btcusdt'], output="UnicornFy")

yoobi commented 2 years ago

Hm... the error is unlogic.

I know right ? I don't exactly know how it happened. It happened only once in 2 months of use. It is running again but no issue so far

I'll add the output="UnicornFy" argument

oliver-zehentleitner commented 2 years ago

if you add the output parameter you will receive unicorn-fied data, so you can remove the line order = UnicornFy.binance_com_futures_websocket(oldest_stream_data_from_stream_buffer) part.

oliver-zehentleitner commented 2 years ago

Feel free to reopen if needed!