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

When a RESERVED robot closes its position and no live orders are, the robot's color does not turns black #236

Closed nikolayromenskiy closed 3 months ago

evgrmn commented 3 months ago

Fixed.

nikolayromenskiy commented 3 months ago

Did not work. When I tried to close Bybit's robot position the following error occurred. The same time the Bybit's robot kept its red color.

2024-06-03 11:51:51,409 - root - INFO - Posting symbol=('BTCUSDT', 'linear', 'Bybit') clOrdID=1264046796.BTCUSDT.linear side=Buy price=69230.0 qty=0.001 2024-06-03 11:51:51,681 - root - WARNING - Bybit: execType Trade - order with clOrdID 1264046796.BTCUSDT.linear not found. 2024-06-03 11:51:51,681 - root - INFO - Bybit Trade Buy: orderID=329a95b0-5534-46c7-b1ef-49b22708d92c clOrdID=1264046796.BTCUSDT.linear price=69219.9 qty=0.001 2024-06-03 11:52:00,127 - root - INFO - Bitmex Replaced Buy: orderID=b0aba2ad-4673-411a-9563-77849f91f6b3 clOrdID=1263910197.Xbt1_1 price=60494.1 qty=0.001 2024-06-03 11:52:00,148 - api.bitmex.ws - ERROR - Traceback (most recent call last): File "/home/rmn/tmatic_240603/api/bitmex/ws.py", line 273, in __on_message self.transaction(row=val) File "/home/rmn/tmatic_240603/functions.py", line 423, in transaction Function.orders_processing(self, row=row, info=info) File "/home/rmn/tmatic_240603/functions.py", line 517, in orders_processing Function.not_defined_robot_color(self, emi=_emi) File "/home/rmn/tmatic_240603/functions.py", line 1212, in not_defined_robot_color tree.paint(row=robot["y_position"], configure="Red") KeyError: 'y_position'

2024-06-03 11:52:00,153 - root - INFO - Bitmex Replaced Buy: orderID=af49db1e-d50c-4f88-9631-e68aed89dfe0 clOrdID=1263910196.Xbt1 price=60494.1 qty=0.001 2024-06-03 11:52:00,223 - root - INFO - Bybit Replaced Sell: orderID=2b4ca51b-13cd-4d9d-af20-cfddddd968e2 clOrdID=1261718872.Btc1 price=76155.3 qty=0.003 2024-06-03 11:52:00,235 - api.bitmex.ws - ERROR - Traceback (most recent call last): File "/home/rmn/tmatic_240603/api/bitmex/ws.py", line 273, in __on_message self.transaction(row=val) File "/home/rmn/tmatic_240603/functions.py", line 425, in transaction Function.orders_processing(self, row=row) File "/home/rmn/tmatic_240603/functions.py", line 463, in orders_processing Function.not_defined_robot_color(self, clOrdID=clOrdID) File "/home/rmn/tmatic_240603/functions.py", line 1212, in not_defined_robot_color tree.paint(row=robot["y_position"], configure="Red") KeyError: 'y_position'

2024-06-03 11:52:00,360 - api.bitmex.ws - INFO - Bitmex - Websocket closed 2024-06-03 11:52:00,361 - api.bitmex.ws - INFO - (https) sending GET to instrument/active: "" 2024-06-03 11:52:00,792 - api.bitmex.ws - INFO - (https) sending GET to order?filter=%7B%22open%22%3A%20true%7D&reverse=false: "" 2024-06-03 11:52:00,867 - api.bitmex.ws - INFO - Connecting to websocket 2024-06-03 11:52:00,867 - api.bitmex.ws - INFO - Authenticating with API key. 2024-06-03 11:52:00,868 - api.bitmex.ws - INFO - (https) sending GET to user: "" 2024-06-03 11:52:00,869 - api.bitmex.ws - INFO - (https) sending GET to position: "" 2024-06-03 11:52:01,129 - websocket - INFO - Websocket connected 2024-06-03 11:52:01,870 - api.bitmex.ws - INFO - Connected to websocket. 2024-06-03 11:52:02,071 - api.bitmex.ws - INFO - Data received. Continuing. 2024-06-03 11:52:02,090 - api.bitmex.ws - INFO - (https) sending GET to execution/tradeHistory?count=500&reverse=false&startTime=2024-06-03 08:37:46: "" 2024-06-03 11:52:02,327 - root - INFO - Robot EMI=Xbt1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-03 11:52:02,327 - root - INFO - Robot EMI=Xbt1_1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-03 11:52:02,327 - root - INFO - Robot EMI=XbtInv1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-03 11:52:02,327 - root - INFO - Robot EMI=XbtInv5. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-03 11:52:02,328 - root - INFO - Robot EMI=Xbt5. Adding to 'robots' with STATUS='NOT DEFINED'


The second try showed the following error:

2024-06-03 12:02:57,376 - root - INFO - Posting symbol=('BTCUSDT', 'linear', 'Bybit') clOrdID=1264053267.BTCUSDT.linear side=Buy price=70000.0 qty=0.001 2024-06-03 12:02:57,621 - root - WARNING - Bybit: execType Trade - order with clOrdID 1264053267.BTCUSDT.linear not found. 2024-06-03 12:02:57,621 - root - INFO - Bybit Trade Buy: orderID=739ccd3c-03a3-4060-84b7-f530f4dca43a clOrdID=1264053267.BTCUSDT.linear price=69153.1 qty=0.001 2024-06-03 12:03:00,093 - root - INFO - Bitmex Replaced Sell: orderID=21bd3bae-f140-4061-a9cb-fe9609f3c6a8 clOrdID=1263910210.XbtInv1 price=76066.5 qty=100 2024-06-03 12:03:00,095 - api.bitmex.ws - ERROR - Traceback (most recent call last): File "/home/rmn/tmatic_240603/api/bitmex/ws.py", line 273, in __on_message self.transaction(row=val) File "/home/rmn/tmatic_240603/functions.py", line 423, in transaction Function.orders_processing(self, row=row, info=info) File "/home/rmn/tmatic_240603/functions.py", line 517, in orders_processing Function.not_defined_robot_color(self, emi=_emi) File "/home/rmn/tmatic_240603/functions.py", line 1212, in not_defined_robot_color tree.paint(row=robot["y_position"], configure="Red") File "/home/rmn/tmatic_240603/display/variables.py", line 422, in paint self.tree.item(self.children[row], tags=configure) IndexError: tuple index out of range

2024-06-03 12:03:00,124 - api.bitmex.ws - ERROR - Traceback (most recent call last): File "/home/rmn/tmatic_240603/api/bitmex/ws.py", line 273, in __on_message self.transaction(row=val) File "/home/rmn/tmatic_240603/functions.py", line 423, in transaction Function.orders_processing(self, row=row, info=info) File "/home/rmn/tmatic_240603/functions.py", line 517, in orders_processing Function.not_defined_robot_color(self, emi=_emi) File "/home/rmn/tmatic_240603/functions.py", line 1212, in not_defined_robot_color tree.paint(row=robot["y_position"], configure="Red") File "/home/rmn/tmatic_240603/display/variables.py", line 422, in paint self.tree.item(self.children[row], tags=configure) IndexError: tuple index out of range

2024-06-03 12:03:00,192 - api.bitmex.ws - ERROR - Traceback (most recent call last): File "/home/rmn/tmatic_240603/api/bitmex/ws.py", line 273, in __on_message self.transaction(row=val) File "/home/rmn/tmatic_240603/functions.py", line 425, in transaction Function.orders_processing(self, row=row) File "/home/rmn/tmatic_240603/functions.py", line 463, in orders_processing Function.not_defined_robot_color(self, clOrdID=clOrdID) File "/home/rmn/tmatic_240603/functions.py", line 1212, in not_defined_robot_color tree.paint(row=robot["y_position"], configure="Red") File "/home/rmn/tmatic_240603/display/variables.py", line 422, in paint self.tree.item(self.children[row], tags=configure) IndexError: tuple index out of range

2024-06-03 12:03:00,202 - api.bitmex.ws - ERROR - Traceback (most recent call last): File "/home/rmn/tmatic_240603/api/bitmex/ws.py", line 273, in __on_message self.transaction(row=val) File "/home/rmn/tmatic_240603/functions.py", line 425, in transaction Function.orders_processing(self, row=row) File "/home/rmn/tmatic_240603/functions.py", line 463, in orders_processing Function.not_defined_robot_color(self, clOrdID=clOrdID) File "/home/rmn/tmatic_240603/functions.py", line 1212, in not_defined_robot_color tree.paint(row=robot["y_position"], configure="Red") File "/home/rmn/tmatic_240603/display/variables.py", line 422, in paint self.tree.item(self.children[row], tags=configure) IndexError: tuple index out of range

2024-06-03 12:03:00,230 - root - INFO - Bybit Replaced Sell: orderID=2b4ca51b-13cd-4d9d-af20-cfddddd968e2 clOrdID=1261718872.Btc1 price=76066.0 qty=0.003 2024-06-03 12:03:00,238 - api.bitmex.ws - INFO - Bitmex - Websocket closed 2024-06-03 12:03:00,255 - api.bitmex.ws - INFO - (https) sending GET to instrument/active: "" 2024-06-03 12:03:00,430 - api.bitmex.ws - INFO - (https) sending GET to order?filter=%7B%22open%22%3A%20true%7D&reverse=false: "" 2024-06-03 12:03:00,521 - api.bitmex.ws - INFO - Connecting to websocket 2024-06-03 12:03:00,521 - api.bitmex.ws - INFO - Authenticating with API key. 2024-06-03 12:03:00,521 - api.bitmex.ws - INFO - (https) sending GET to user: "" 2024-06-03 12:03:00,522 - api.bitmex.ws - INFO - (https) sending GET to position: "" 2024-06-03 12:03:00,825 - websocket - INFO - Websocket connected 2024-06-03 12:03:01,523 - api.bitmex.ws - INFO - Connected to websocket. 2024-06-03 12:03:02,023 - api.bitmex.ws - INFO - Data received. Continuing. 2024-06-03 12:03:02,043 - api.bitmex.ws - INFO - (https) sending GET to execution/tradeHistory?count=500&reverse=false&startTime=2024-06-03 08:37:46: "" 2024-06-03 12:03:02,265 - root - INFO - Robot EMI=Xbt1_1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-03 12:03:02,265 - root - INFO - Robot EMI=XbtInv1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-03 12:03:02,265 - root - INFO - Robot EMI=Xbt1. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-03 12:03:02,265 - root - INFO - Robot EMI=XbtInv5. Adding to 'robots' with STATUS='NOT DEFINED' 2024-06-03 12:03:02,265 - root - INFO - Robot EMI=Xbt5. Adding to 'robots' with STATUS='NOT DEFINED'

evgrmn commented 3 months ago

See latest commit cfaa432. It seems this problem has been resolved.