diff --git a/changelog.txt b/changelog.txt index 8222e8b..76bbf0a 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,6 @@ 2024.12.01: . Added "generated_at" entry: When generating a config file, the generated timestamp is saved in the config file. +. If the switch price is lower than the next SO price, it displays it in green instead of the next SO price. 2024.11.30: . Added "forced_restart_if_retries_exhasted" option to the config file of a trader. If set to true, the trader will always restart if the first order of the deal diff --git a/main.py b/main.py index b3bc6b8..2c477c3 100644 --- a/main.py +++ b/main.py @@ -22,7 +22,7 @@ In case the permissions of the certificate changes, reset them this way: # ll /etc/letsencrypt/ ''' -version = "2024.11.30" +version = "2024.12.01" ''' 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 0321bee..c7ca8aa 100755 --- a/trader.py +++ b/trader.py @@ -1627,6 +1627,7 @@ class trader: high_price = self.status_dict["take_profit_price"] low_boundary = '{:.20f}'.format(low_price)[:decimals].center(decimals) + low_boundary_color = red mid_boundary = '{:.20f}'.format(mid_price)[:decimals].center(decimals) high_boundary = '{:.20f}'.format(high_price)[:decimals].center(decimals) @@ -1667,8 +1668,20 @@ class trader: pct_color = yellow if percentage_to_profit>high_percentage: pct_color = red - - prices = f"{red}{low_boundary}{white}|{price_color}{mid_boundary}{white}|{target_price_color}{high_boundary}{white}|{pct_color}{pct_to_profit_str}%{white}" + + if self.is_short and "old_long" in self.status_dict: + #Switch price + try: + 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"] + minimum_switch_price = (old_target - self.status_dict["quote_spent"])/base_left + if old_target-self.status_dict["quote_spent"]>0 and base_left>0 and minimum_switch_price1: line1 = f"{line1}x{multiplier}"