simplifier multiplier calculation - division by zero eliminated

This commit is contained in:
Nicolás Sánchez 2024-12-27 10:39:12 -03:00
parent 0422624c5f
commit 28bbd885af
1 changed files with 3 additions and 5 deletions

View File

@ -1691,10 +1691,8 @@ class trader:
if old_target-self.status_dict["quote_spent"]>0 and base_left>0 and minimum_switch_price<low_price: 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_color = bright_green
low_boundary = '{:.20f}'.format(minimum_switch_price)[:decimals].center(decimals) low_boundary = '{:.20f}'.format(minimum_switch_price)[:decimals].center(decimals)
#Logic for multiplier if self.status_dict["price"]!=0:
#When adding a trader, this line always throws an exception since status_dict["price"] is not yet populated multiplier = int(self.status_dict["old_long"]["tp_price"]/self.status_dict["price"])
percentage_to_switch = (self.status_dict["old_long"]["tp_price"]-self.status_dict["price"])*100/self.status_dict["price"]
multiplier = int(percentage_to_switch/100)+1
except Exception as e: except Exception as e:
print(e) print(e)