Пример #1
0
def prepare_common_common(s):
    o = s.transaction[OPEN]
    c = s.transaction[CLOSE]
    v = s.transaction[VOLUME]
    s.open = s.transaction[OPEN]
    s.close = s.transaction[CLOSE]
    s.vol = s.transaction[VOLUME]
    s.high = s.transaction[HIGH]
    s.low = s.transaction[LOW]
    s.ma0 = ma(c,3)
    s.ma1= ma(c,7)
    s.ma2 = ma(c,13)
    s.ma3 = ma(c,30)
    s.ma4 = ma(c,60)
    s.ma5 = ma(c,120)
    s.t5 = strend(s.ma5) > 0
    s.t4 = strend(s.ma4) > 0
    s.t3 = strend(s.ma3) > 0
    s.t2 = strend(s.ma2) > 0
    s.t1 = strend(s.ma1) > 0
    s.t0 = strend(s.ma0) > 0
    s.ksize = np.array(list(d1k.ksize(o,c)))
    s.ksign = np.array(list(d1k.ksign(o,c)))
    s.above = gand(s.ma2>s.ma3,s.ma3>s.ma4,s.ma4>s.ma5)
    #将golden和above分开
    s.golden = gand(s.g20 >= s.g60+1000,s.g60 >= s.g120+1000,s.g20>=3000,s.g20<=8000)
    s.thumb = gand(s.g20 >= s.g60,s.g60 >= s.g120,s.g120 >= s.g250,s.g20>=3000,s.g20<=8000)
    s.magic = gand(s.g5>s.g60,s.g20 >= s.g60,s.g60 >= s.g120,s.g120 >= s.g250,s.g20<8000)
    s.svap_ma_67 = svap_ma(v,c,67)
    #s.vap_ma_67 = vap_pre(v,c,67)
    #s.svap_ma_67_1 = svap_ma(v,c,67,weight=1)        
    s.svap_ma_67_2 = svap_ma(v,c,67,weight=2)        
    s.ks = subd(c) * BASE / rollx(c)
    s.diff,s.dea = cmacd(c)
    s.atr = atr(c,s.transaction[HIGH],s.transaction[LOW],20)
    s.atr2 = atr2(c,s.transaction[HIGH],s.transaction[LOW],20)
Пример #2
0
def prepare_atr(stocks):
    for s in stocks:
        s.atr = atr(s.transaction[CLOSE],s.transaction[HIGH],s.transaction[LOW],20)