Merge pull request #2114 from CedricSchmeits/negativeSharpeLoss

As -sharp_ratio is returned the value should be nagative.
This commit is contained in:
Matthias 2019-08-09 06:19:59 +02:00 committed by GitHub
commit de99942499
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