simplifier multiplier calculation - division by zero eliminated
This commit is contained in:
parent
0422624c5f
commit
28bbd885af
|
|
@ -1690,11 +1690,9 @@ class trader:
|
|||
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)
|
||||
#Logic for multiplier
|
||||
#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"]
|
||||
multiplier = int(percentage_to_switch/100)+1
|
||||
low_boundary = '{:.20f}'.format(minimum_switch_price)[:decimals].center(decimals)
|
||||
if self.status_dict["price"]!=0:
|
||||
multiplier = int(self.status_dict["old_long"]["tp_price"]/self.status_dict["price"])
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue