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)
def getOneMinFenshiFromRedis(code): """获取1分钟分时线 return: df""" return stock.FenshiCodeCache(code).getBankuaiFenshiZhishu()
def getFiveMinFenshiFromRedis(code): """获取5分钟分时线 return: df""" return stock.FenshiCodeCache(code).getBankuaiFenshiZhishu().resample( "5min")