修复同步后停牌残留反复触发完整性修复 - #213
Open
yushenglin01 wants to merge 1 commit into
Open
Conversation
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.
问题与复现
开启实时行情时,历史完整性门禁会把已完成 batch 同步的日期继续判定为停机前盘中快照,并反复创建修复任务。实际分区主体已是权威 batch 数据,仅残留极少数停牌股票在 09:15 写入的零成交实时行。
根因
open/high=0填成昨收价,导致停牌零成交记录被伪装成有效日 K。quote_ts;任意一条当日 15:00 前记录都会把整个分区判为快照。open/high=0停牌判据过滤。解决方案
volume=0且amount=0的历史遗留行,避免污染 MA、ATR 等指标。兼容性
性能
正常全 null 或收盘后分区仍只读取 Parquet 元数据。只有最大
quote_ts命中盘中时才读取quote_ts/volume/amount三列做二次判定;该逻辑只在启动检查、开启实时行情和管道完整性检查时执行,不进入实时轮询热路径。验证
uv run --frozen pytest tests/test_data_integrity.py -q:29 passeduv run --frozen ruff check --select F ...:通过git diff --check:通过current_data_issues=[]container_integrity_issues=[],HTTP 200界面证据
本 PR 无前端界面改动。修复前开启实时行情会提示 2026-08-24、2026-08-26、2026-08-27 为盘中快照;修复后同一数据目录扫描为空,不再创建重复修复任务。
风险与回滚
主要风险是第三方数据源将零成交日作为有效交易日返回;当前仅在
volume和amount同时为 0 时按停牌过滤,并保留“可疑实时行占主体”时继续 fail-closed 的门禁。回滚可直接撤销本提交,未引入数据迁移。