better readability, kept np.sqrt(365) which results in annualized sharpe ratio
This commit is contained in:
parent
2cd7b329ce
commit
e8439ae0bc
@ -43,12 +43,11 @@ class SharpeHyperOptLossDaily(IHyperOptLoss):
|
|||||||
* 100.0
|
* 100.0
|
||||||
)
|
)
|
||||||
|
|
||||||
if (np.std(sum_daily["profit_percent"]) != 0.):
|
total_profit = sum_daily["profit_percent"]
|
||||||
sharp_ratio = (
|
expected_returns_mean = total_profit.mean()
|
||||||
sum_daily["profit_percent"].mean()
|
|
||||||
/ np.std(sum_daily["profit_percent"])
|
if (np.std(total_profit) != 0.):
|
||||||
* np.sqrt(365)
|
sharp_ratio = expected_returns_mean / np.std(total_profit) * np.sqrt(365)
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Define high (negative) sharpe ratio to be clear that this is NOT optimal.
|
# Define high (negative) sharpe ratio to be clear that this is NOT optimal.
|
||||||
sharp_ratio = -20.0
|
sharp_ratio = -20.0
|
||||||
|
Loading…
Reference in New Issue
Block a user