过去200天的(负)动量,即加入反转。
df2 = attribute_history(etf, 200, '1d', ['close'])
y2= df2['log'] = np.log(df2.close)
x2 = df2['num'] = np.arange(df2.log.size)
slope2, intercept2 = np.polyfit(x2, y2, 1)
annualized_returns2 = math.pow(math.exp(slope2), 250) - 1
r_squared2 = 1 - (sum((y2 - (slope2 * x2 + intercept2))**2) / ((len(y2) - 1) * np.var(y2, ddof=1)))
score= score - annualized_returns2 * r_squared2 / 6
---为什么除以6,哪位老师知道?
2023-11-08