switch price
This commit is contained in:
parent
d52d98c877
commit
6115b1460e
|
|
@ -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
|
||||
|
|
|
|||
2
main.py
2
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
|
||||
|
|
|
|||
18
trader.py
18
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_price<low_price:
|
||||
low_boundary_color = bright_green
|
||||
low_boundary = '{:.20f}'.format(minimum_switch_price)[:decimals].center(decimals)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
prices = f"{low_boundary_color}{low_boundary}{white}|{price_color}{mid_boundary}{white}|{target_price_color}{high_boundary}{white}|{pct_color}{pct_to_profit_str}%{white}"
|
||||
line1 = f"{p}{pair_color}{self.pair.center(13)}{white}| {safety_order_string} |{prices}| Uptime: {self.seconds_to_time(self.status_dict['deal_uptime'])}"
|
||||
if self.is_boosted:
|
||||
line1 = f"{line1} | BOOSTED"
|
||||
|
|
@ -1678,7 +1691,6 @@ class trader:
|
|||
try:
|
||||
#When adding a trader, this line always throws an exception since status_dict["price"] is not yet populated
|
||||
percentage_to_switch = (self.status_dict["old_long"]["tp_price"]-self.status_dict["price"])*100/self.status_dict["price"]
|
||||
#line1 = f"{line1} {round(percentage_to_switch,2)}%"
|
||||
multiplier = int(percentage_to_switch/100)+1
|
||||
if multiplier>1:
|
||||
line1 = f"{line1}x{multiplier}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue