evgrmn / tmatic

Tmatic is a cryptocurrency platform designed for automated trading on the Bitmex, Bybit and Deribit crypto exchanges.
https://www.tmatic.org
GNU General Public License v3.0
25 stars 6 forks source link

AttributeError: type object 'TreeTable' has no attribute 'robots'. This error occurred during initial loading. #242

Closed nikolayromenskiy closed 3 months ago

nikolayromenskiy commented 3 months ago

2024-06-08 17:33:55,062 - root - INFO -

hello

2024-06-08 17:33:55,064 - api.bybit.ws - INFO - Bybit - Websocket closed 2024-06-08 17:33:55,064 - api.bitmex.http - INFO - (https) sending GET to instrument/active: "" 2024-06-08 17:33:55,067 - api.bybit.agent - INFO - Sending get_instruments_info() - category - spot 2024-06-08 17:33:55,072 - api.bybit.agent - INFO - Sending get_instruments_info() - category - inverse 2024-06-08 17:33:55,074 - api.bybit.agent - INFO - Sending get_instruments_info() - category - option 2024-06-08 17:33:55,075 - api.bybit.agent - INFO - Sending get_instruments_info() - category - linear 2024-06-08 17:33:55,528 - api.bitmex.http - INFO - (https) sending GET to order?filter=%7B%22open%22%3A%20true%7D&reverse=false: "" 2024-06-08 17:33:55,607 - api.bitmex.ws - INFO - Connecting to websocket 2024-06-08 17:33:55,607 - api.bitmex.ws - INFO - Authenticating with API key. 2024-06-08 17:33:55,608 - api.bitmex.http - INFO - (https) sending GET to user: "" 2024-06-08 17:33:55,612 - api.bitmex.http - INFO - (https) sending GET to position: "" 2024-06-08 17:33:55,873 - websocket - INFO - Websocket connected 2024-06-08 17:33:56,612 - api.bitmex.ws - INFO - Connected to websocket. 2024-06-08 17:33:56,813 - api.bitmex.ws - INFO - Data received. Continuing. 2024-06-08 17:33:56,865 - api.bitmex.http - INFO - (https) sending GET to execution/tradeHistory?count=500&reverse=false&startTime=2024-06-05 07:42:12: "" 2024-06-08 17:33:57,065 - api.bybit.agent - INFO - Sending open_orders() - parameters - {'openOnly': 0, 'limit': 50, 'category': 'spot', 'cursor': 'no'} 2024-06-08 17:33:57,068 - api.bybit.agent - INFO - Sending open_orders() - parameters - {'openOnly': 0, 'limit': 50, 'category': 'linear', 'settleCoin': 'USDT', 'cursor': 'no'} 2024-06-08 17:33:57,850 - api.bybit.agent - INFO - Sending open_orders() - parameters - {'openOnly': 0, 'limit': 50, 'category': 'linear', 'settleCoin': 'USDT', 'cursor': '75a680ea-6e92-4494-b9f8-02cb549ce2f6%3A1717867980114%2Caa2205dd-6474-4199-9540-67c7e709a1d7%3A1716477047327'} 2024-06-08 17:33:58,497 - api.bybit.ws - INFO - Connecting to websocket 2024-06-08 17:33:58,497 - api.bybit.agent - INFO - Sending get_uid_wallet_type() 2024-06-08 17:33:58,498 - api.bybit.agent - INFO - Sending get_wallet_balance() - accountType - UNIFIED 2024-06-08 17:33:58,501 - api.bybit.pybit._websocket_stream - INFO - WebSocket Unified V5 attempting connection... 2024-06-08 17:33:58,516 - api.bybit.pybit._websocket_stream - INFO - WebSocket Unified V5 (Auth) attempting connection... 2024-06-08 17:33:58,522 - api.bybit.agent - INFO - Sending get_positions() - category - linear - settlCurrency - USDT 2024-06-08 17:33:58,782 - api.bybit.agent - INFO - Sending get_wallet_balance() - accountType - CONTRACT 2024-06-08 17:34:00,116 - websocket - INFO - Websocket connected 2024-06-08 17:34:00,116 - websocket - INFO - Websocket connected 2024-06-08 17:34:00,117 - api.bybit.pybit._websocket_stream - INFO - WebSocket Unified V5 connected 2024-06-08 17:34:00,117 - api.bybit.pybit._websocket_stream - INFO - WebSocket Unified V5 (Auth) connected 2024-06-08 17:34:00,118 - api.bybit.ws - INFO - ws subscription - orderbook_stream - category - linear - symbol - ('BTCUSDT', 'linear', 'Bybit') 2024-06-08 17:34:00,119 - api.bybit.ws - INFO - ws subscription - ticker_stream - category - linear - symbol - ('BTCUSDT', 'linear', 'Bybit') 2024-06-08 17:34:00,127 - api.bybit.agent - INFO - Sending get_executions() - category - spot - startTime - 2024-06-05 08:04:40+00:00 2024-06-08 17:34:00,130 - api.bybit.agent - INFO - Sending get_executions() - category - inverse - startTime - 2024-06-05 08:04:40+00:00 2024-06-08 17:34:00,131 - api.bybit.agent - INFO - Sending get_executions() - category - option - startTime - 2024-06-05 08:04:40+00:00 2024-06-08 17:34:00,133 - api.bybit.agent - INFO - Sending get_executions() - category - linear - startTime - 2024-06-05 08:04:40+00:00 2024-06-08 17:34:00,372 - api.bybit.agent - INFO - Sending get_executions() - category - linear - startTime - 2024-06-05 08:04:40+00:00 2024-06-08 17:34:00,599 - api.bybit.agent - INFO - Bybit - loading trading history, startTime=2024-06-05 08:04:40+00:00, received: 1 records. 2024-06-08 17:34:00,673 - common.init - INFO - Robot EMI=Btc5. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-08 17:34:00,674 - common.init - INFO - Robot EMI=Btc1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-08 17:34:00,732 - functions - WARNING - Bitmex: execType Replaced - order with clOrdID 1266575583.Xbt1 not found. 2024-06-08 17:34:00,747 - api.bitmex.http - INFO - (https) sending GET to instrument?symbol=ADAH24: "" 2024-06-08 17:34:00,825 - api.bitmex.http - INFO - (https) sending GET to instrument?symbol=XBTH24: "" _Unexpected Bybit error: AttributeError Traceback (most recent call last): File "/home/rmn/tmatic_240608/api/bybit/errors.py", line 16, in decorator return method(*args, **kwargs) File "/home/rmn/tmatic_240608/api/bybit/ws.py", line 338, in __handle_order self.transaction(row=row) File "/home/rmn/tmatic_240608/functions.py", line 423, in transaction Function.orders_processing(self, row=row, info=info) File "/home/rmn/tmatic_240608/functions.py", line 517, in orders_processing Function.not_defined_robot_color(self, emi=_emi) File "/home/rmn/tmatic_240608/functions.py", line 1216, in not_defined_robot_color tree = TreeTable.robots AttributeError: type object 'TreeTable' has no attribute 'robots' 2024-06-08 17:34:00,868 - api.bybit.errors - ERROR - AttributeError - type object 'TreeTable' has no attribute 'robots' 2024-06-08 17:34:00,983 - common.init - INFO - Robot EMI=Xbt1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-08 17:34:00,984 - common.init - INFO - Robot EMI=XbtInv1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-08 17:34:00,984 - common.init - INFO - Robot EMI=Xbt11. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-08 17:34:00,985 - common.init - INFO - Robot EMI=XbtInv5. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-08 17:34:00,985 - common.init - INFO - Robot EMI=Xbt5. Adding to 'robots' with STATUS='NOT DEFINED' Unexpected Bybit error: AttributeError Traceback (most recent call last): File "/home/rmn/tmatic_240608/api/bybit/errors.py", line 16, in decorator return method(*args, **kwargs) File "/home/rmn/tmatic_240608/api/bybit/ws.py", line 338, in __handle_order self.transaction(row=row) File "/home/rmn/tmatic_240608/functions.py", line 425, in transaction Function.orders_processing(self, row=row) File "/home/rmn/tmatic_240608/functions.py", line 463, in orders_processing Function.not_defined_robot_color(self, clOrdID=clOrdID) File "/home/rmn/tmatic_240608/functions.py", line 1216, in not_defined_robot_color tree = TreeTable.robots AttributeError: type object 'TreeTable' has no attribute 'robots' 2024-06-08 17:34:01,079 - api.bybit.errors - ERROR - AttributeError - type object 'TreeTable' has no attribute 'robots'

evgrmn commented 3 months ago

The websocket probably sent information before the TreeTable class object was initialized. Corrected by adding a condition: if hasattr(TreeTable, "robots") before tree = TreeTable.robots