fix: 分钟线增量改回溯窗口,修复历史空洞被永久跳过 (#7)#8
Closed
xbfighting wants to merge 1 commit into
Closed
Conversation
cli.py: 增量起点从 latest+1 改为 latest-30 天。原有逻辑在 TDX .lc5 拉取滞后场景下会形成永久空洞——后置日期入库后 cursor 推进,前置缺日 再也回不来。回溯窗口配合 ON CONFLICT DO NOTHING 自动补缺,零副作用。 scripts/backfill_minute_gaps.py: 一次性脚本,全量重读修复旧数据。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
Compliance CheckDone Criteria按 Issue #7 核心诉求 — (a) 修旧空洞 (b) 防再发生 (c) 不破坏现有 sync 流程:
Standards Check
Violations FoundNone. Risks
VerdictAPPROVE Rationale三条 Done Criteria 均满足,边界处理正确;无代码质量或安全问题;改动均在范围内。 |
Owner
Author
|
实测观察到的空洞 100% 是市场停牌,非 pipeline bug。详见 issue #7 评论。30 天回溯窗口对当前问题是 over-engineering,关闭 PR。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复 #7。
latest + 1→latest - 30(LOOKBACK_DAYS=30)。配合 ON CONFLICT DO NOTHING 自动补 TDX.lc5拉取滞后造成的空洞。.lc5修旧空洞。不在本 PR 范围(独立 follow-up):
sync_all_daily_data用全局 max 而非 per-stock,类似但不同的隐患get_latest_datetime_by_code只查 minute5 表导致的多表 cursor 不一致 — 当前 PR 通过回溯窗口已自然缓解Test plan
SELECT DATE(date), COUNT(DISTINCT code) FROM minute60_data WHERE date >= '2026-04-25' GROUP BY DATE(date) ORDER BY DATE(date);python scripts/backfill_minute_gaps.py --dry-run --code sz000001确认流程python scripts/backfill_minute_gaps.py --code sz000001单只回填,对比该股票 04-28/29 数据是否补上python scripts/backfill_minute_gaps.py,重新跑复现 SQL 确认空洞消失python main.py sync看耗时增加是否可接受(预期 +30-60s)🤖 Generated with Claude Code