As -sharp_ratio is returned the value should be nagative.

This leads in a high positive result of the loss function, as it is a minimal optimizer
This commit is contained in:
Cedric Schmeits 2019-08-08 22:10:51 +02:00 committed by GitHub
parent 02b2de5c73
commit 8ad5afd3a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ class SharpeHyperOptLoss(IHyperOptLoss):
sharp_ratio = expected_yearly_return / np.std(total_profit) * np.sqrt(365)
else:
# Define high (negative) sharpe ratio to be clear that this is NOT optimal.
sharp_ratio = 20.
sharp_ratio = -20.
# print(expected_yearly_return, np.std(total_profit), sharp_ratio)
return -sharp_ratio