From b69b0d2f15868f786652b38dea5a6a131df30063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Sun, 12 Oct 2025 19:01:13 -0300 Subject: [PATCH] 2025.10.12 --- changelog.txt | 3 +++ main.py | 3 ++- trader.py | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 24b9ac3..3863021 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +2025.10.12: +. do_cleanup relocated after generating the safety orders' prices. + 2025.10.11: . Minor simplification in do_cleanup. . Removed a couple of (no longer needed?) pauses. diff --git a/main.py b/main.py index 6bc37b1..0e3e78b 100644 --- a/main.py +++ b/main.py @@ -18,7 +18,7 @@ import exchange_wrapper import trader -version = "2025.10.11" +version = "2025.10.12" ''' Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors @@ -2280,6 +2280,7 @@ def unwrapped_toggle_autoswitch(base,quote): broker.logger.log_this(f"Exception while toggling autoswitch: {e}",1,symbol) return jsonify({"Error": "Halp"}) + def unwrapped_toggle_liquidate_after_switch(base,quote): ''' Signals a trader to enable or disable quitting after switching from short to long. diff --git a/trader.py b/trader.py index e50df88..fde37a7 100755 --- a/trader.py +++ b/trader.py @@ -277,15 +277,15 @@ class trader: self.broker.logger.log_this("Error sending take profit order. Aborting.",1,self.status.get_pair()) return 1 + # Generate the safety prices table + self.status.set_start_price(self.broker.price_to_precision(self.status.get_pair(),self.status.get_quote_spent()/self.status.get_base_bought())) + self.status.set_safety_price_table(self.calculate_safety_prices(self.status.get_start_price(),self.status.get_no_of_safety_orders(),self.config.get_safety_order_deviance())) + # Send cleanup order (if cleanup) self.status.set_pause_reason("start_trader - doing cleanup (if needed)") if self.config.get_cleanup() and not self.config.get_is_short(): #Short traders do not need cleanup. self.do_cleanup() - # Generate the safety prices table - self.status.set_start_price(self.broker.price_to_precision(self.status.get_pair(),self.status.get_quote_spent()/self.status.get_base_bought())) - self.status.set_safety_price_table(self.calculate_safety_prices(self.status.get_start_price(),self.status.get_no_of_safety_orders(),self.config.get_safety_order_deviance())) - # Send the initial batch of safety orders self.status.set_pause_reason("start_trader - sending safety orders") self.broker.logger.log_this("Sending safety orders...",2,self.status.get_pair())