From e0d3d4e078377889e4ad948ee4d345e961c509b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Tue, 3 Dec 2024 20:26:30 -0300 Subject: [PATCH] todo --- todo.txt | 5 +++-- trader.py | 5 +++-- utils/statistics_server_v3.py | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/todo.txt b/todo.txt index aaaee90..cf9eb0f 100755 --- a/todo.txt +++ b/todo.txt @@ -7,8 +7,9 @@ Mandatory: 3. Consolidate vocabulary (trader, pair and bot; instance & trader) 4. Base add for short traders. 5. Proper handling of order price too high/low in OKX (rare, it happens when under heavy volatility). -6. Optimize database code. -7. Things that should be objects (it's not 1994): +6. Multiple safety orders open at the same time (to catch big volatility spikes more effectively) +7. Optimize database code. +8. Things that should be objects (it's not 1994): * Orders. * Sredro. * A lot more. diff --git a/trader.py b/trader.py index 1fa5de6..57e147f 100755 --- a/trader.py +++ b/trader.py @@ -699,7 +699,7 @@ class trader: self.broker.logger.log_this("Can't switch a long trader to long, there's nothing to do",1,self.pair) return 1 - #Check if the orders are OK + #Check if the orders are OK (Is this really necessary?) if self.tp_order is None: self.broker.logger.log_this("Take profit order is None, can't switch to short",1,self.pair) return 1 @@ -1194,8 +1194,9 @@ class trader: self.status_dict["pause_reason"] = "check for autoswitch" #If it's a short bot that used to be long AND autoswitch is enabled if self.is_short and "autoswitch" in self.config_dict and self.config_dict["autoswitch"] and "old_long" in self.status_dict: - #If selling the base currency left at the current market price plus the quote already received turns out to be more than the amount of the old_long, + #If selling the base currency left at the current market price plus the quote already received turns out to be more than the old long deal target, # it means that we already are in profit territory, switch back to long. + #A more conservative approach would be old_target = self.status_dict["old_long"]["quote_spent"], just breaking even. old_target = self.status_dict["old_long"]["tp_price"]*self.status_dict["old_long"]["tp_amount"] base_left = self.status_dict["old_long"]["tp_amount"]-self.status_dict["base_bought"] if (base_left*self.status_dict["price"])+self.status_dict["quote_spent"]>=old_target: diff --git a/utils/statistics_server_v3.py b/utils/statistics_server_v3.py index 0eb055e..5a0aac3 100644 --- a/utils/statistics_server_v3.py +++ b/utils/statistics_server_v3.py @@ -219,8 +219,6 @@ def last_n_lines(file_name,width,amount=4,full_log=False): return result,len(file_contents) for line in file_contents[::-1][:amount]: - #trimmed = f"{line[0]}{line[12:21]}{line[23:]}".strip() - #result.append(trimmed[:width]) trimmed = line.strip() result.append(trimmed[:width]) if len(trimmed)>width: