better readability, kept np.sqrt(365) which results in annualized sharpe ratio

This commit is contained in:
Yazeed Al Oyoun 2020-02-02 06:20:09 +01:00
parent 2cd7b329ce
commit e8439ae0bc

View File

@ -43,12 +43,11 @@ class SharpeHyperOptLossDaily(IHyperOptLoss):
* 100.0
)
if (np.std(sum_daily["profit_percent"]) != 0.):
sharp_ratio = (
sum_daily["profit_percent"].mean()
/ np.std(sum_daily["profit_percent"])
* np.sqrt(365)
)
total_profit = sum_daily["profit_percent"]
expected_returns_mean = total_profit.mean()
if (np.std(total_profit) != 0.):
sharp_ratio = expected_returns_mean / np.std(total_profit) * np.sqrt(365)
else:
# Define high (negative) sharpe ratio to be clear that this is NOT optimal.
sharp_ratio = -20.0