diff --git a/changelog.txt b/changelog.txt index 4f6f105..6c5c199 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +2025.09.08: +. Re-enabled long to short autoswitch. + 2025.09.07: . Increased wait time after sending market orders. diff --git a/main.py b/main.py index 93c3621..c8009d0 100644 --- a/main.py +++ b/main.py @@ -18,7 +18,7 @@ import exchange_wrapper import trader -version = "2025.09.07" +version = "2025.09.09" ''' 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 53ebdab..0f08865 100755 --- a/trader.py +++ b/trader.py @@ -1135,7 +1135,13 @@ class trader: self.switch_to_long(already_received_quote=self.status.get_quote_spent()) if not self.config.get_liquidate_after_switch(): self.restart = True - return 1 + return 1 + #Check for autoswitch (long->short) + if not self.config.get_is_short() and self.status.get_so_amount()==self.status.get_no_of_safety_orders() and self.config.get_autoswitch(): + self.switch_to_short() + self.status.save_to_file(is_backup=True) + self.restart = True + return 0 #Extract ids from order list self.status.set_pause_reason("filtering open orders") @@ -1262,14 +1268,6 @@ class trader: self.pause = False self.update_status(True) - #Check for autoswitch (long->short) - #Commented out because i'm not sure where this should go - #if not self.config.get_is_short() and self.status.get_so_amount()==self.status.get_no_of_safety_orders() and self.config.get_autoswitch(): - # self.switch_to_short() - # self.status.save_to_file(is_backup=True) - # self.restart = True - # return 0 - #Render status line(s) self.status.set_status_string(self.generate_status_strings())