Merge pull request #276 from kevin9327/fix/quotes-flush-quote-ts

fix(kline): 实时行情覆写当日日K分区时补写 quote_ts
This commit is contained in:
wshy
2026-09-09 09:04:28 +08:00
committed by GitHub
2 changed files with 41 additions and 0 deletions
+4
View File
@@ -318,11 +318,15 @@ def sync_daily_by_quotes(repo: KlineRepository) -> int:
"close": q.get("last_price"),
"volume": q.get("volume"),
"amount": q.get("amount"),
# 快照时刻标记: data_integrity 靠 quote_ts 区分盘中快照与盘后权威历史,
# 缺失会让盘中覆写的分区在停机后被当成完整历史, 永远不进修复。
"quote_ts": q.get("timestamp"),
})
df = pl.DataFrame(records)
if df.is_empty():
return 0
df = df.with_columns(pl.col("quote_ts").cast(pl.Int64, strict=False))
# 分区日期用北京交易日 (与 quote_service._build_daily 的 cn_today 一致),
# 避免 UTC 服务器在盘中把日分区写成服务器本地日期。