"code": {"$in": code}, "date_stamp": {
"$lte": QA_util_date_stamp(end),
"$gte": QA_util_date_stamp(start)}}, {"_id": 0}, batch_size=10000)
if format in ["dict", "json"]:
return [data for data in cursor]
//for item in cursor:
__data = pd.DataFrame([item for item in cursor])
__data = __data.assign(date=pd.to_datetime(__data["date"]))
// __data.append([str(item["code"]), float(item["open"]), float(item["high"]), float(
// item["low"]), float(item["close"]), int(item["up_count"]), int(item["down_count"]), float(item["vol"]), float(item["amount"]), item["date"]])
After Change
res = pd.DataFrame([item for item in cursor])
try:
res = res.assign(volume=res.vol, date=pd.to_datetime(
res.date)).drop_duplicates((["date", "code"])).query("volume>1").set_index("date", drop=False)
except:
res = None