Address ZeroDivisionExceptiond

closes #4764 closes #4617
This commit is contained in:
Matthias
2021-04-20 21:41:18 +02:00
parent b230558294
commit 9f6f3e0862
2 changed files with 5 additions and 0 deletions

View File

@@ -547,6 +547,8 @@ class LocalTrade():
rate=(rate or self.close_rate),
fee=(fee or self.fee_close)
)
if self.open_trade_value == 0.0:
return 0.0
profit_ratio = (close_trade_value / self.open_trade_value) - 1
return float(f"{profit_ratio:.8f}")