abcbase.py 文件源码

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

项目:zStock 作者: superxhy 项目源码 文件源码
def KDJ_CN(high, low, close, fastk_period=9, slowk_period=3, fastd_period=3) :
        len1 = len(high)
        len2 = len(low)
        len3 = len(close)
        if len1 != len2 or len1 != len3:
            print ("KDJ_CN input invalid for len:%s %s %s " %(str(len1),str(len2),str(len3)))
            return np.array(np.nan),np.array(np.nan),np.array(np.nan)
        kValue, dValue = tl.STOCHF(high, low, close, fastk_period, fastd_period=fastd_period, fastd_matype=0)

        kValue = np.array(map(lambda x : SecurityDataSrcBase.SMA_CN(kValue[:x], slowk_period), range(1, len(kValue) + 1)))
        dValue = np.array(map(lambda x : SecurityDataSrcBase.SMA_CN(kValue[:x], fastd_period), range(1, len(kValue) + 1)))

        jValue = 3 * kValue - 2 * dValue

        func = lambda arr : np.array([0 if x < 0 else (100 if x > 100 else x) for x in arr])

        kValue = func(kValue)
        dValue = func(dValue)
        jValue = func(jValue)
        return kValue, dValue, jValue
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号