From e49945ddbcf152319b620b3ad1db1a83b61dbf55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Mon, 21 Jul 2025 16:18:06 -0300 Subject: [PATCH] 2025.07.21 --- changelog.txt | 3 +++ main.py | 2 +- trader.py | 8 +++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 7bf2f3e..570281d 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +2025.07.21: +. Corrected an error in switch_to_long. + 2025.07.18: . Changed Waitress' logging level to ERROR. diff --git a/main.py b/main.py index 8b5f8e0..3e133eb 100644 --- a/main.py +++ b/main.py @@ -16,7 +16,7 @@ import exchange_wrapper import trader -version = "2025.07.18" +version = "2025.07.21" ''' Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors diff --git a/trader.py b/trader.py index bd824cb..df0dd7a 100755 --- a/trader.py +++ b/trader.py @@ -632,6 +632,10 @@ class trader: #Sell all base currency self.liquidate_base(ignore_profits=ignore_old_long, already_received_quote=already_received_quote) + + if self.config.get_liquidate_after_switch(): + self.quit = True + return 1 #Rewrite config file (if it exists) if os.path.isfile(f"configs/{self.base}{self.quote}.bak") and os.path.isfile(f"configs/{self.base}{self.quote}.json"): @@ -1001,9 +1005,7 @@ class trader: #Sell all base (market), report the profits and restart the trader self.status.set_pause_reason("automatic_switch") self.switch_to_long(already_received_quote=self.status.get_quote_spent()) - if self.config.get_liquidate_after_switch(): - self.quit = True - else: + if not self.config.get_liquidate_after_switch(): self.restart = True return 1