python计算bias

Ft 2020-10-18 PM 64℃ 0条
#计算方法:
#bias指标
#N期BIAS=(当日收盘价-N期平均收盘价)/N期平均收盘价*100%
df['bias_6'] = (df['close'] - df['close'].rolling(6, min_periods=1).mean())/ df['close'].rolling(6, min_periods=1).mean()*100
df['bias_12'] = (df['close'] - df['close'].rolling(12, min_periods=1).mean())/ df['close'].rolling(12, min_periods=1).mean()*100
df['bias_24'] = (df['close'] - df['close'].rolling(24, min_periods=1).mean())/ df['close'].rolling(24, min_periods=1).mean()*100
df['bias_6'] = round(df['bias_6'], 2)
df['bias_12'] = round(df['bias_12'], 2)
df['bias_24'] = round(df['bias_24'], 2)
标签: python

非特殊说明,本博所有文章均为博主原创。

评论啦~