Пример #1
0
def prepare_index(stock,begin,end):
    linelog('prepare hour:%s' % stock.code)
    t = get_hour(stock.code,begin,end)
    stock.hour = t[CLOSE].copy()
    stock.hour_open = t[OPEN].copy()
    stock.hour_low = t[LOW].copy()
    stock.hour_high = t[HIGH].copy()
    stock.hour_v = t[VOLUME].copy()
    stock.hour[range4(len(stock.hour))] = np.cast['int32'](stock.transaction[CLOSE])   #消除第4小时数据收盘与当日收盘价的差异,日收盘价为最后均价
    down =stock.hour_high - stock.hour < (stock.hour-stock.hour_open)*2/3
    ol = stock.hour > stock.hour_open
    stock.up1 =  xfollow(hour2day1(gand(down,ol)),stock.transaction[VOLUME])
    stock.open2 = hour2day2(stock.hour_open)
Пример #2
0
def prepare_hour(stock,begin,end):
    linelog('prepare hour:%s' % stock.code)
    t = get_hour(stock.code,begin,end)
    stock.hour = t[CLOSE].copy()
    #stock.hour_open = t[OPEN].copy()
    #stock.hour_low = t[LOW].copy()
    #stock.hour_high = t[HIGH].copy()
    #stock.hour_v = t[VOLUME].copy()
    stock.hour[range4(len(stock.hour))] = stock.transaction[CLOSE]   #消除第4小时数据收盘与当日收盘价的差异,日收盘价为最后均价
    prepare_hmacd(stock)
    stock.hmxc = hour2day(xc0s(t[OPEN],stock.hour,t[HIGH],t[LOW],ma1=13) > 0)
    mdiff,mdea = macd_ruv3(t[OPEN],stock.hour,t[HIGH],t[LOW],t[VOLUME])
    mxc = cross(mdea,mdiff) > 0
    stock.xru3 = hour2day(mxc)
    mdiff,mdea = macd_ruv(t[OPEN],stock.hour,t[HIGH],t[LOW],t[VOLUME])
    mxc = cross(mdea,mdiff) > 0
    stock.xru = hour2day(mxc)
    ma3 = ma(stock.hour,3)
    ma7 = ma(stock.hour,7)
    ma13 = ma(stock.hour,13)
    ma30 = ma(stock.hour,30)
    stock.ma4_up = hour2day(gand((ma3>ma7),gand(ma7>ma13),gand(ma13>ma30),strend(ma3)>0,strend(ma7)>0,strend(ma13)>0,strend(ma30)>0))