alterado de acordo com o curso do udemy

This commit is contained in:
Rafael Rodrigues 2019-06-03 23:05:05 -03:00
parent 4982dda24c
commit 4526f39903

View File

@ -158,15 +158,15 @@ class Hyperopt(Backtesting):
#adding slippage of 0.1% per trade
total_profit = total_profit - 0.0005
expected_yearly_return = total_profit.sum()/days_period
expected_average_return = total_profit.sum()/days_period
if (np.std(total_profit) != 0.):
sharp_ratio = expected_yearly_return/np.std(total_profit)*np.sqrt(365)
sharp_ratio = expected_average_return/np.std(total_profit)*np.sqrt(365)
else:
sharp_ratio = 1.
sharp_ratio = -20
sharp_ratio = -sharp_ratio
# print(expected_yearly_return, np.std(total_profit), sharp_ratio)
# print(expected_average_return, np.std(total_profit), sharp_ratio)
result = sharp_ratio