VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 17
声望: 0

收盘价对时间t的线性回归预测值

df['linearreg']=ta.LINEARREG(df.close, timeperiod=14)

# 收盘价对时间t的线性回归预测值
df['linearreg'] = ta.LINEARREG(df.close, timeperiod=14)
# 时间序列预测值
df['tsf'] = ta.TSF(df.close, timeperiod=14)
df['stdev'] = ta.STDDEV(df.close, timeperiod=5, nbdev=1)
# 画图
# df.loc['2020-01-01':, ['close', 'linearreg', 'tsf']].plot(figsize=(20, 10))

df.loc['2020-01-01':, ['close', 'linearreg', 'tsf', 'stdev']].plot(figsize=(18, 8),
                                              subplots=True, layout=(2, 2))
plt.subplots_adjust(wspace=0, hspace=0.2)

description

description

Administrator
avatar
加入于:
帖子: 4502
声望: 322

感谢分享!精华送上

© 2015-2022 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】