def getindexdaily(self,code,start,end):
total=[]
startdate = datetime.datetime.strptime(start, "%Y-%m-%d")
enddate=datetime.datetime.strptime(end, "%Y-%m-%d")
series={"date":[],"open":[],"close":[],"high":[],"low":[],"volume":[]}
for stockdaily in self.index[code].find({"date": {"$gte": startdate,"$lt":enddate}}).sort("date"):
series["date"].append(stockdaily["date"])
series["open"].append(stockdaily["open"])
series["close"].append(stockdaily["close"])
series["high"].append(stockdaily["high"])
series["low"].append(stockdaily["low"])
series["volume"].append(stockdaily["volume"])
totaldata=zip(series['date'],series['open'],series['close'],series['high'],series['low'],series['volume'])
df = pd.DataFrame(list(totaldata))
df.index=df.date
return df
评论列表
文章目录