Skip to content

fix: 股票列表纳入科创板 688 与创业板 301 段#9

Merged
xbfighting merged 2 commits into
masterfrom
fix/stock-list-688-301
Jun 12, 2026
Merged

fix: 股票列表纳入科创板 688 与创业板 301 段#9
xbfighting merged 2 commits into
masterfrom
fix/stock-list-688-301

Conversation

@xbfighting

@xbfighting xbfighting commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • 上海正则 688\d{4} 共 7 位,永远匹配不上 6 位的科创代码——科创板自项目建立起被静默排除(正则里写了 688,原意就是要包含)。改为 ^(60\d{4}|688\d{3})$
  • 深圳正则补 301(创业板注册制段,2021 年起已发行数百只)
  • 科创板 .day 读取兜底:pytdx get_security_type 不识别 688,get_df 会 raise NotImplementedError 被逐股票循环吞掉——仅修正则 688 仍 0 行入库。先检查 sec_type,不支持时走 _read_day_file_raw 直接解析二进制(系数与 SH_A_STOCK 一致)。此实现移植自 PR fix: 修复 SQLite 写入时 pd.Timestamp 绑定错误 #6@jaden1q84),commit 已 Co-authored-by 致谢
  • 分钟线 TdxLCMinBarReader 无类型检查,688 的 .lc5 不受影响
  • 北证 vipdoc/bj/ 目录本期不纳入

与 PR #6 的关系

PR #6 包含同样的正则修复与 raw 解析(实现一致),但同时混入了表结构改造(code 加 .SZ/.SH 后缀)、volume/amount 单位变更、默认前复权、日线专用包重构等大型变更,本 PR 仅取最小修复集。

Test plan

  • 正则单测 18 用例:000/001/002/300/301/60x/605/688 纳入;689(CDR)/B股(900/200)/ETF(510/159)/转债(113/123)/北证(43/83/92)/TDX指数(880) 排除
  • _read_day_file_raw 合成数据验证:与 pytdx get_df(SH_A_STOCK) 输出逐字节相等
  • 在 TDX 机器上跑 python main.py stock-list --db-only,确认 stock_info 新增 sh688/sz301
  • python main.py sync,确认 daily_data 出现 688/301 全历史
  • 抽查:SELECT LEFT(code,5), COUNT(DISTINCT code) FROM daily_data WHERE code ~ '(sh688|sz301)' GROUP BY 1

🤖 Generated with Claude Code

xbfighting and others added 2 commits June 12, 2026 17:42
- 上海正则 688\d{4} 共 7 位永远匹配不上 6 位代码,科创板自始被静默排除;改为 ^(60\d{4}|688\d{3})$
- 深圳正则补 301(创业板注册制段)
- 689(CDR)/B股/ETF/转债/北证/TDX指数段维持排除(18 用例正则单测通过)
- 北证 vipdoc/bj 目录本期不纳入

影响:下次 sync 将增量拉取 688/301 全历史日线+分钟线;
上市满一年(ma233)后才进入 wavecrest 强弱计算

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pytdx get_security_type 不识别 688(code_head '68' 无分支,返回 None),
get_df 会 print 噪音 + raise NotImplementedError,被 cli 逐股票循环吞掉——
仅修股票列表正则后 688 仍会 0 行入库。

先检查 sec_type,不支持时走 _read_day_file_raw 直接解析二进制,
系数与 pytdx SH_A_STOCK 一致(价格/volume ×0.01, amount 原样)。
合成数据验证:与 pytdx get_df 输出逐字节相等。
分钟线 TdxLCMinBarReader 无类型检查,不受影响。

实现移植自 PR #6(jaden1q84),致谢。

Co-Authored-By: jaden1q84 <jaden1q84@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@xbfighting xbfighting merged commit ea18b26 into master Jun 12, 2026
0 of 3 checks passed
@xbfighting xbfighting deleted the fix/stock-list-688-301 branch June 12, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant