frequence = "30min"
elif frequence in ["60min", "60m"]:
frequence = "60min"
__data = []
code = QA_util_code_tolist(code)
cursor = collections.find({
"code": {"$in": code}, "time_stamp": {
"$gte": QA_util_time_stamp(start),
"$lte": QA_util_time_stamp(end)
}, "type": frequence
}, {"_id": 0}, batch_size=10000)
if format in ["dict", "json"]:
return [data for data in cursor]
for item in cursor:
__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["datetime"], item["time_stamp"], item["date"], item["type"]])
__data = DataFrame(__data, columns=[
"code", "open", "high", "low", "close", "up_count", "down_count", "volume", "amount", "datetime", "time_stamp", "date", "type"])__data["datetime"] = pd.to_datetime(__data["datetime"])
__data = __data.set_index("datetime", drop=False)
if format in ["numpy", "np", "n"]:
return numpy.asarray(__data)
elif format in ["list", "l", "L"]:
After Change
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(datetime=pd.to_datetime(__data["datetime"]))
// __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["datetime"], item["time_stamp"], item["date"], item["type"]])
// __data = DataFrame(__data, columns=[