Adjust handling of zero stdev in loss functions

This commit is contained in:
hroff-1902
2020-03-10 13:44:16 +03:00
parent c49fefc94d
commit 73c19da4b9
4 changed files with 4 additions and 4 deletions

View File

@@ -51,7 +51,7 @@ class SharpeHyperOptLossDaily(IHyperOptLoss):
expected_returns_mean = total_profit.mean()
up_stdev = total_profit.std()
if (up_stdev != 0.):
if up_stdev != 0:
sharp_ratio = expected_returns_mean / up_stdev * math.sqrt(days_in_year)
else:
# Define high (negative) sharpe ratio to be clear that this is NOT optimal.