alterado de acordo com o curso do udemy
This commit is contained in:
parent
4982dda24c
commit
4526f39903
@ -158,15 +158,15 @@ class Hyperopt(Backtesting):
|
|||||||
|
|
||||||
#adding slippage of 0.1% per trade
|
#adding slippage of 0.1% per trade
|
||||||
total_profit = total_profit - 0.0005
|
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.):
|
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:
|
else:
|
||||||
sharp_ratio = 1.
|
sharp_ratio = -20
|
||||||
|
|
||||||
sharp_ratio = -sharp_ratio
|
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
|
result = sharp_ratio
|
||||||
|
Loading…
Reference in New Issue
Block a user