请问我想用周频的收益率作为标签,shift(close,n)/shift(close, -1)中的n应该怎么选呢?


(sujiangx) #1

请问我想用周频的收益率作为标签,shift(close,n)/shift(close, -1)中的n应该怎么选呢?


(tiantianz) #2

还是应该获得周频的数据进行计算


(adhaha111) #3

您好,如果按照您表达式的意思:shift(close_0, -5) / close_0 - 1 可以实现 5 天的收益率,但如果您想要周频的,就得对日线数据进行重采样,得到周线数据再拿到其收益率