Esempio n. 1
0
def genOne(code):
    #print code
    #先清理5分钟分时redis
    stock.FenshiCodeCache(code).delKey()
    try:
        #通过日线来取最近的5天
        df_hisdat = stock.getHisdatDataFrameFromRedis(code)
        df_hisdat = df_hisdat.tail()
        start_day = agl.datetime_to_date(df_hisdat.index[0])
        end_day = agl.datetime_to_date(df_hisdat.index[-1])

        df_fenshi = stock.getFenshiDfUseRedis(code, start_day,
                                              end_day).dropna()
    except:
        return
    stock.FenshiCodeCache(code).set(df_fenshi)
Esempio n. 2
0
def getOneMinFenshiFromRedis(code):
    """获取1分钟分时线
    return: df"""
    return stock.FenshiCodeCache(code).getBankuaiFenshiZhishu()
Esempio n. 3
0
def getFiveMinFenshiFromRedis(code):
    """获取5分钟分时线
    return: df"""
    return stock.FenshiCodeCache(code).getBankuaiFenshiZhishu().resample(
        "5min")