def save_tick_data(self, ticks: List[TickData]) -> bool:
""""""
# Convert bar object to dict and adjust timezone
data = []
for tick in ticks:
tick.datetime = convert_tz(tick.datetime)
d = tick.__dict__
d["exchange"] = d["exchange"].value
d["interval"] = d["interval"].value
d.pop("gateway_name")
d.pop("vt_symbol")
data.append(d)
# Upsert data into database
with self.db.atomic():
for c in chunked(data, 50):
DbTickData.insert_many(c).on_conflict_replace().execute()
函数如上,这里使用了d["interval"],但是TickData里面是没有Interval属性的