simplifier multiplier calculation - division by zero eliminated
This commit is contained in:
parent
0422624c5f
commit
28bbd885af
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue