data_handler.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:pyktrader2 作者: harveywwu 项目源码 文件源码
def FISHER(df, n, smooth_p = 0.7, smooth_i = 0.7):
    roll_high = pd.rolling_max(df.high, n)
    roll_low  = pd.rolling_min(df.low, n)
    price_loc = (df.close - roll_low)/(roll_high - roll_low) * 2.0 - 1
    sm_price = pd.Series(pd.ewma(price_loc, com = 1.0/smooth_p - 1, adjust = False), name = 'FISHER_P')
    fisher_ind = 0.5 * np.log((1 + sm_price)/(1 - sm_price))
    sm_fisher = pd.Series(pd.ewma(fisher_ind, com = 1.0/smooth_i - 1, adjust = False), name = 'FISHER_I')
    return pd.concat([sm_price, sm_fisher], join='outer', axis=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号