Filter_Stock_CHN.py 文件源码

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

项目:StockRecommendSystem 作者: doncat99 项目源码 文件源码
def macd_rule(df, index = -1):
    try:  
        if not {'macd_dif', 'macd_dea', 'macd'}.issubset(df.columns):
            df = MACD(df)
    except Exception as e: 
        print(e)
        return False

    input_1 = -3
    input_2 = 0.05

    # df['macd_dif_1'] = df['macd_dif'].shift(1)
    # df['macd_dea_1'] = df['macd_dea'].shift(1)

#(df['macd_dif'][-input_3:].min() < input_2) & \

    return (df['macd_dif'][index] > input_1) & \
           (df['macd_dif'][index] < input_2) & \
           (df['macd_dif'][index] > df['macd_dea'][index]) & \
           ((df['macd_dea'][index-1] > df['macd_dif'][index-1]) | (abs(df['macd_dea'][index-1] - df['macd_dif'][index-1]) < 0.007))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号