File: README.md
a-stock-data
一个自包含的 Skill 文件,把分散在 34 个数据源里的 A 股及相关市场原始数据整合成 AI 编程助手直接能用的工具集。你不用再背腾讯 K 线的分段参数、通达信盘后包的二进制格式、东财的 PDF Referer 头、iwencai 的 X-Claw 鉴权——全部封装好了。主源被封还有「备用源速查」可降级。
兼容 Claude Code · Codex · OpenClaw · WorkBuddy · Muse · Grok Bot
Skill 文件本质是结构化 Markdown + 内嵌 Python,任何支持上下文注入的 AI 编程助手都能用。
V3.10.2(2026-10-11 · #58): 修正
full_valuation()的 PE 消化年数:前向 PE 高于 30x 而预测盈利不增长(或下一年预测缺失)时,原来返回 0 年,像是已经消化完;现在返回None,表示无法估算。当年 EPS 缺失或不为正时同样返回None。入口数、来源数不变。V3.10.1(2026-10-07 · #57): 更正 §1.2 腾讯 K 线的成交量单位:科创板(688 / 689)是股,其余是手。此前文档全写成手,照旧文档换算科创板会大 100 倍。同时补上和通达信盘后包、Baostock 按股对账的口径。§1.4 逐笔改走复用连接、自动重试的会话(一次约 70 秒 → 约 25 秒),新增
frame.attrs["complete"],15:31 以后核对盘后定价段有没有缺笔;§13.7 期货日 K 同样自动重试。入口数、来源数、返回的数据都不变。V3.10.0(2026-09-22): 通达信公开服务器的 K 线 / 盘口 / 逐笔命令失效(#52)后,行情层把可用来源排到前面(腾讯 → 腾讯 K 线 → 通达信盘后包 → 腾讯逐笔),mootdx 移到最后留档;新增 §1.4
tencent_ticks()腾讯当日逐笔成交(替代 mootdx 逐笔)和 §13.7futures_kline()新浪期货日 K(主力连续 + 具体合约,补上大商所)。Layer 1 重新编号,旧编号对照见 CHANGELOG。V3.9.0(2026-09-20): 新增期货与大宗商品、事件驱动、可转债三层,并在原有各层补上腾讯 K 线、通达信官网盘后包、新浪研报、ETF 份额、利率曲线等入口,共 25 个;通达信公开服务器的 K 线命令失效(#52)已改走 HTTP。详见 CHANGELOG。
数据覆盖(15 类)
| # | 类别 | 包含数据 | 主要来源 |
|---|---|---|---|
| 1 | 行情 / K 线 | 实时价、PE/PB/市值/换手率、日周月前后复权与 1~60 分钟 K 线、某交易日全市场日线(含成交额)、复权因子、指数 / ETF | 腾讯、通达信官网、百度、新浪 |
| 2 | 研报 | 个股 / 行业研报与 PDF、评级、三年 EPS 预测、一致预期、自然语言检索、研报列表 | 东财、新浪、同花顺、iwencai |
| 3 | 市场信号 | 强势股与题材归因、北向资金、板块归属、资金流向、龙虎榜、限售解禁、行业排名、板块资金流 | 同花顺、东财 |
| 4 | 资金面 / 筹码 | 融资融券、大宗交易、股东户数、分红送转、120 日资金流、筹码分布、ETF 份额 | 东财、上交所、深交所、本地计算 |
| 5 | 新闻 | 个股新闻、财联社电报、7×24 快讯、新闻联播文字稿 | 东财、财联社、华尔街见闻、央视网 |
| 6 | 基础财务 | 季报快照、F10、财报三表、估值历史、上市退市日、申万行业变迁、ST 名单 | 通达信(mootdx)、新浪、baostock、申万、东财 |
| 7 | 公告 | 沪深北全量公告 | 巨潮 |
| 8 | 打板 | 涨停 / 炸板 / 跌停 / 昨涨停池、涨停原因、重点监控池、日内异动 | 东财、同花顺 |
| 9 | ETF 期权 | T 型报价、希腊字母、隐含波动率 | 新浪 |
| 10 | 舆情互动 | 互动易(深市)、上证e互动(沪市)、同花顺热榜、东财人气榜、概念命中 | 巨潮、上证e互动、同花顺、东财 |
| 11 | 宏观与利率 | 社融、PMI、国债与信用债收益率曲线、回购定盘利率、LPR、全球宏观日历 | 人民银行、国家统计局、中债、中国货币网、东财、华尔街见闻 |
| 12 | 指数与交易日历 | 中证 / 国证成分与权重、中证 PE 与股息率、深交所交易日历 | 中证指数、国证指数、深交所 |
| 13 | 期货与大宗商品 | 期货日行情、商品与股指期权、会员持仓排名、实时期货、A50 期指、上海金现货 | 上期所、上期能源、郑商所、中金所、广期所、新浪、上金所 |
| 14 | 事件驱动 | 业绩预告、机构调研、股东增减持、股票回购、股权质押、新股申购日历 | 东财 |
| 15 | 可转债 | 条款、转股价、转股价值、溢价率、上市 / 摘牌状态 | 东财 |
另有 5 个备胎:官方龙虎榜、新浪资金流、公告、沪深官方两融、北交所当前行情,主源被封时降级用。
架构
A 股全栈数据 · 十五层架构 · V3.10.2
│ (优先级:腾讯 / 交易所官方优先,不封 IP;mootdx 行情命令 2026-09 起失效,只用于财务与 F10;
│ 东财只用于独有数据,已内置限流防封)
├── 行情层 腾讯 + 通达信官网 + 百度 + 新浪 实时价 / PE / PB / 市值 + 指数 / ETF + K线(带MA5/10/20)
│ + 复权因子 qfq/hfq ★V3.7
│ + 日周月前后复权与 1~60 分钟 K 线 + 全市场当日日线(含成交额) ★V3.9
│ + 当日逐笔成交(沪深个股 + ETF) ★V3.10
├── 研报层 东财 reportapi + 同花顺 + iwencai + 新浪 个股研报 / 行业研报 / PDF下载 / 一致预期 / NL搜索
│ + 新浪研报列表(第二来源) ★V3.9
├── 信号层 同花顺 + 东财 强势股 + 题材归因 + 北向资金 + 板块归属
│ + 资金流向(push2) + 龙虎榜 + 全市场龙虎榜 + 解禁 + 行业对比 + 板块资金流
├── 资金面 东财 datacenter + push2 融资融券 + 大宗交易 + 股东户数 + 分红送转 + 资金流(分钟+120日)
│ /筹码 本地计算 + 上交所 + 深交所 筹码分布 CYQ ★V3.7 + ETF 份额 ★V3.9
├── 新闻层 东财 + 财联社 + 华尔街见闻 + 央视网 个股新闻 / 财联社电报 / 全球资讯 / 7×24 快讯 / 新闻联播 ★V3.9
├── 基础数据 mootdx + 东财 + 新浪 季报37字段 / F10最新提示 / 财报三表
│ + baostock + 申万 估值历史(PE/PB/PS+换手率+停牌+ST) / 上市退市日 / 申万行业变迁史 ★V3.7
│ + ST 名单 ★V3.9
├── 公告层 巨潮 cninfo + mootdx 沪深北全量公告
├── 打板层 东财 push2ex + 同花顺 涨停池 / 炸板 / 跌停 / 昨涨停 / 涨停原因题材 / 连板梯队
│ + 重点监控池 + 日内异动池 ★V3.6
├── 期权层 新浪 hq.sinajs ETF期权 T型报价 / 希腊字母 / 隐含波动率 IV ★V3.3
├── 舆情互动 巨潮互动易 + 上证e互动 + 同花顺 + 东财 互动易(深市) / 上证e互动(沪市) ★V3.9 / 热榜 / 人气榜 / 概念命中
├── 宏观利率 人民银行 + 统计局 + 中债 + 货币网 + 东财 + 华尔街见闻
│ 社融 / PMI / 收益率曲线 / 回购定盘利率 / LPR / 全球宏观日历 ★V3.9 扩展
├── 指数日历 中证指数 + 国证指数 + 深交所 指数成分 / 权重 / PE与股息率 / 官方交易日历
├── 期货大宗 上期所 + 上期能源 + 郑商所 + 中金所 + 广期所 + 新浪 + 上金所
│ 期货日行情 / 商品与股指期权 / 持仓排名 / 实时期货 / A50 / 上海金 ★V3.9
│ + 期货日 K(主力连续 + 具体合约,含大商所) ★V3.10
├── 事件驱动 东财 datacenter 业绩预告 / 机构调研 / 增减持 / 回购 / 股权质押 / 新股申购 ★V3.9
└── 可转债 东财 datacenter 条款 / 转股价值 / 溢价率 / 上市摘牌状态 ★V3.9十五层之外另附备用源速查 & 降级策略:龙虎榜/资金流/公告备胎,以及沪深官方两融、北交所当前行情与五档备胎。使用范围和真实数据日期见 SKILL.md 对应章节。
快速开始
3 步,2 分钟。
# 1. 创建 skill 目录
mkdir -p ~/.claude/skills/a-stock-data
# 2. 把 SKILL.md 放进去
curl -o ~/.claude/skills/a-stock-data/SKILL.md \
https://raw.githubusercontent.com/simonlin1212/a-stock-data/main/SKILL.md
# 3. 安装依赖(V3.0 不再需要 akshare;V3.9 没有新增依赖)
pip install mootdx requests pandas stockstats numpy baostock xlrd openpyxl启动 Claude Code,说一句「帮我看看 688017 的估值」,自动激活。
Codex / OpenClaw 用户: 把 SKILL.md 的内容贴入你的系统 prompt 或项目上下文文件即可,内嵌的 Python 代码可直接执行。
87 个端点能力清单
共 82 个主入口、5 个备胎。沿用能力入口计数:同一函数的中证/国证或沪深路由不重复计数,辅助函数与仅列入候选的项目不计入。
计数口径: 下方清单共 88 行,按能力入口计 87 个——「东财 行业研报」与「东财 reportapi」为同一端点(仅
qType参数不同)、「同花顺北向(历史)」为本地自缓存(非独立端点),两行不计入;「东财日内异动池」一行含list/count两个端点,多计 1 个。88 − 1 − 1 + 1 = 87。代码转换辅助函数to_joinquant()不计入。
行情层(实时,不封 IP)
| 端点 | 数据 |
|---|---|
| 腾讯财经 | PE(TTM) / PB / 总市值 / 流通市值 / 换手率 / 涨跌停价 / 指数 / ETF |
| 腾讯 K 线 | 沪深日/周/月前后复权 + 1/5/15/30/60 分钟,三个入口轮换;不含北交所(V3.9 新增) |
| 通达信盘后包 | 某交易日沪深北全市场日线含成交额,单个 zip 约 2~3 MB;实测 2022-01-04、2023-01-03 可取,2021-01-04 已没有,未逐日验证;2022-05-06 之前的包没有北交所(V3.9 新增) |
| 腾讯逐笔成交 | 最近一个交易日全部分笔(约 3 秒一笔):时间 / 价格 / 量 / 额 / 买卖方向,沪深个股 + ETF,不含北交所;收盘后自动用当日成交额核对完整性(V3.10 新增,替代 mootdx 逐笔) |
| 百度K线 | 日K线 + MA5/MA10/MA20 均价直接返回(V3.0 新增) |
| 新浪复权因子 | qfq / hfq 因子序列 + 套用到不复权 K 线(V3.7 新增) |
| mootdx 行情(留档) | K线(多周期) + 五档盘口 + 逐笔成交 + 实时报价 46 字段(⚠️ 2026-09 起通达信公开服务器返回空,见 FAQ #52;K 线改用腾讯 K 线 / 盘后包,逐笔改用腾讯逐笔) |
研报层
| 端点 | 数据 |
|---|---|
| 东财 reportapi | 个股研报列表 + 评级 + 三年 EPS 预测 |
| 东财 行业研报 | 行业研报列表(qType=1,同端点)+ 行业名/行业码 + 评级(V3.2.3 新增) |
| 东财 PDF 下载 | 完整研报 PDF(个股/行业通用,已处理 Referer 鉴权) |
| 同花顺一致预期 | 机构一致预期 EPS(直连 basic.10jqka.com.cn) |
| iwencai NL 搜索 | 自然语言跨主题研报检索 |
| 新浪研报列表 | 标题 / 类型 / 机构 / 研究员 / 日期,东财之外的第二来源;无评级与目标价(V3.9 新增,#53) |
信号层
| 端点 | 数据 |
|---|---|
| 同花顺热点 | 当日强势股 + 题材归因 reason tags(编辑部人工标注) |
| 同花顺北向(实时) | 沪股通分钟级流向(深股通近期上游披露收紧仅供参考,权威北向见 HKEX 备胎) |
| 同花顺北向(历史) | 本地自缓存日级历史 |
| 东财板块归属 | 个股所属全部板块(行业/概念/地域混合)+ BK码 + 当日涨跌幅 + 龙头股(V3.2.2 替换百度 PAE,一次请求拿全) |
| 东财资金流向 | 主力 / 大单 / 中单 / 小单 / 超大单分钟级净流入(V3.1 替换百度 PAE) |
| 龙虎榜席位 | 上榜记录 + 买卖席位 TOP5 + 机构动向 |
| 全市场龙虎榜 | 每日全市场上榜股票 + 净买额排名 + 上榜原因 |
| 限售解禁日历 | 历史解禁 + 未来 90 天待解禁预警 |
| 行业板块排名 | 东财行业涨跌/上涨下跌家数(V3.0 替换同花顺,零鉴权) |
| 板块资金流向 | 行业/概念/地域 × 今日/5日/10日 主力净流入额/净占比 + 超大/大/中/小单四档 + 领涨股(V3.5 新增,与行业排名同源) |
资金面 / 筹码层(V3.0 新增)
| 端点 | 数据 |
|---|---|
| 融资融券明细 | 日级融资余额/买入/偿还 + 融券余额/卖出/偿还 |
| 大宗交易 | 成交价/量 + 买卖方营业部 + 溢价率 |
| 股东户数变化 | 季度股东数 + 环比变化 + 户均持股(筹码集中度) |
| 分红送转历史 | 每股派息/送股/转增 + 进度状态 |
| 个股资金流120日 | 主力/大单/中单/小单日级净流入 |
| 筹码分布 CYQ | 获利比例 / 平均成本 / 90-70 成本区间与集中度 / 筹码峰(本地计算,V3.7 新增) |
| ETF 份额 | 上交所按日归档(实测 2022-01-04 仍有数据)/ 深交所当前快照,单位万份(V3.9 新增) |
新闻层
| 端点 | 数据 |
|---|---|
| 个股新闻 | 东财个股新闻流(直连 search-api-web) |
| 财联社电报 | 全市场实时快讯(v1 API + 本地签名零 key,✅V3.4.0 复活,与全球资讯互备) |
| 全球资讯 | 东财全球财经资讯(直连 np-weblist,7×24) |
| 华尔街见闻快讯 | 按频道取 7×24 快讯,带翻页游标(V3.9 新增) |
| 新闻联播 | 当日条目标题 + 文字稿(央视网,当晚约 20:00 后更新;V3.9 新增) |
基础数据 + 公告
| 端点 | 数据 |
|---|---|
| 季报快照 | 37 字段(EPS / ROE / 净利润 / 主营收入...) |
| F10 文本 | 「最新提示」(公告 / 报道 / 大宗 / 两融 / 风险提示摘要);2026-09 起服务端只剩这一类 |
| 东财个股信息 | 行业/总股本/流通股/市值/上市日期(直连 push2) |
| 新浪财报三表 | 资产负债表/利润表/现金流量表(直连 quotes.sina.cn) |
| 巨潮公告 | 沪深北交所全量公告 |
| 估值历史 | 日频 PE/PB/PS/PCF + 换手率 + 停牌 + ST(可回溯至 2016;不支持北交所,V3.7 新增) |
| 上市/退市日 | ipoDate / outDate / 状态(唯一零鉴权退市日源,V3.7 新增) |
| 申万行业变迁史 | 每只股票历次行业调整(消除前视偏差;仅代码无中文名,V3.7 新增) |
| ST 名单 | 沪深京 ST / *ST 当日名单 + 现价;东财不可达时退 baostock(只有沪深、无价格,V3.9 新增) |
打板层(V3.3 新增)
| 端点 | 数据 |
|---|---|
| 东财涨停池 | 连板数 / 几天几板 / 封板资金 / 炸板次数 / 首末封板时间 / 所属行业 |
| 东财炸板池 | 曾涨停后开板 + 振幅 / 涨速 |
| 东财跌停池 | 封单资金 / 连续跌停天数 / 开板次数 / 板上成交额 |
| 东财昨日涨停池 | 昨涨停今表现(自算晋级率 / 赚钱效应) |
| 同花顺涨停揭秘 | 涨停原因题材 / 封板成功率 / 一字·换手·T字板 / 封单额 |
| 东财重点监控池 | 交易所风险警示 / 重点监控名单 + 生效时间窗(V3.6 新增) |
| 东财日内异动池 | 严重异常波动明细 + 按标的聚合异动统计 + 12 条异动规则解释(V3.6 新增) |
ETF 期权层(V3.3 新增)
| 端点 | 数据 |
|---|---|
| 期权合约清单 | 50ETF / 300ETF / 科创50ETF / 500ETF 各月份认购认沽合约 |
| T型报价 | 买卖五档 / 持仓量 / 行权价 / 最新价 / 成交量额 |
| 希腊字母 + IV | Delta / Gamma / Theta / Vega / 隐含波动率 / 理论价值(交易所预算,免本地算 BSM) |
舆情互动层(V3.3 新增)
| 端点 | 数据 |
|---|---|
| 互动易问答 | 投资者提问 + 公司官方回复(巨潮,覆盖深市;AI 问答独家信源:公司如何回应某传闻/利好) |
| 上证e互动 | 沪市投资者提问 + 公司回复,补上互动易不覆盖的沪市(V3.9 新增) |
| 同花顺热榜 | 人气值 / 概念标签 / 排名变化 |
| 东财人气榜 | 排名 + 排名变化 + 名称价格 |
| 东财个股概念命中 | 这只票当下被市场归到哪些概念在炒 + 热度值 |
宏观与利率层(V3.7 新增,V3.9 扩展)
| 端点 | 数据 |
|---|---|
| 人民银行社融 | 社会融资规模增量月度 12 列(人民币贷款/委托/信托/未贴现汇票/企业债/政府债/股票融资/ABS/核销) |
| 国家统计局 PMI | 制造业 / 非制造业商务活动 / 综合产出 + 大中小型企业分档 |
| 中债收益率曲线 | 国债 / 商业银行 AAA / 中短期票据 AAA,3 个月~30 年关键期限(V3.9 新增) |
| 回购定盘利率 | FR001 / FR007 / FR014 与 FDR 同期限(中国货币网,FR 约近 3 年、FDR 约近 1 年;V3.9 新增) |
| LPR | 1 年 / 5 年全历史(含 2013~2019 旧机制逐日报价,V3.9 新增) |
| 全球宏观日历 | 公布值 / 预期 / 前值 / 修正值 / 重要性(华尔街见闻,V3.9 新增) |
指数与交易日历
| 端点 | 数据 |
|---|---|
| 指数成分 | 中证最近成分、国证最近公布的月末成分;保留源侧日期,不提供历史时点回填 |
| 指数权重 | 中证/国证最近公布权重;单位为百分数,不假定与成分同日 |
| 指数估值 | 中证两种股本口径的 PE 和股息率;近期文件,不含 PB、不承诺全历史 |
| 官方交易日历 | 深交所完整自然月交易标志,缺日/未发布/未知标志抛错 |
期货与大宗商品层(V3.9 新增,#49)
| 端点 | 数据 |
|---|---|
| 期货日行情 | 上期所 / 上期能源 / 郑商所 / 中金所 / 广期所官方收盘数据:开高低收、结算价、成交量、持仓量及变化、成交额 |
| 期权日行情 | 商品期权 + 股指期权:行权价、结算价、成交持仓、Delta、隐含波动率(上期所 / 上期能源按系列,郑商所 / 广期所按合约;中金所不公布 Delta 和隐含波动率) |
| 会员持仓排名 | 成交量 / 持买单 / 持卖单前 20 名会员及增减(上期所、上期能源、郑商所、中金所) |
| 实时期货 | 新浪实时价、买卖一档,覆盖六家期货交易所(大商所品种走这里);涨跌停价只有中金所品种有 |
| 期货日 K | 新浪逐日 K 线,主力连续(RB0 / M0,最早到 2005 年)或具体合约(约 2022 年起到期的),六家交易所全覆盖、含大商所;价格与官方日行情一致,结算价不全(V3.10 新增) |
| A50 期指 | 富时中国 A50 连续合约报价 |
| 上海金现货 | 上金所 Au99.99 / Au(T+D) / Ag(T+D) / Pt99.95 等日线 |
大商所官网有 JS 反爬(纯 HTTP 返回 412),官方日行情未接入;大商所品种的历史日 K 用「期货日 K」,实时价用「实时期货」。
事件驱动层(V3.9 新增)
| 端点 | 数据 |
|---|---|
| 业绩预告 | 预告类型、预计金额与变动幅度区间、上年同期、变动原因 |
| 机构调研 | 调研汇总(接待机构数、方式、地点)或逐机构明细 |
| 股东增减持 | 股东、方向、变动股数与比例、变动后持股、均价、渠道 |
| 股票回购 | 方案价格上限、股数与金额区间、已回购股数与金额、进度 |
| 股权质押 | 中国结算周度质押比例、质押股数与市值、笔数(只覆盖沪深) |
| 新股申购日历 | 申购 / 中签 / 缴款 / 上市日期、发行价与市盈率、中签率、首日表现 |
可转债层(V3.9 新增)
| 端点 | 数据 |
|---|---|
| 可转债 | 正股、评级、发行规模、转股价、转股价值、溢价率、上市 / 到期 / 摘牌日与状态 |
备用源(主源被封时降级)
| 端点 | 数据 |
|---|---|
| 官方龙虎榜备胎 | 上交所 + 深交所官方接口,零鉴权权威一手,含营业部席位(东财被封时用) |
| 资金流备胎 | 新浪日度四档单净额(超大/大/中/小单 + 净流入) |
| 公告备胎 | 深市走深交所官方、沪市走东财,均带 PDF 直链(巨潮被封时用) |
| 官方两融备胎 | 上交所/深交所分开查询,金额元、余量股/份;上交所缺融券余额金额时保留为空 |
| 北交所行情备胎 | 全板或单票 OHLC/成交量额/五档快照,强制核对交易日;不提供历史回填,盘中延迟未标定 |
另附十五层主源 → 独立备胎速查表(交易所官方 / 同花顺 F10 / HKEX / 巨潮 webapi / 金十等,全部不同风控面)与「已死透别用」名单,见 SKILL.md「备用源速查 & 降级策略」章节。V3.9 起 K 线主源改为腾讯,当日全市场日线可用通达信盘后包,研报列表可用新浪。
鉴权要求
除 iwencai 外,其余已接入数据源无需用户注册或 API Key;V3.8 的中证、国证和北交所,以及 V3.9 新增的 12 个来源(通达信官网、华尔街见闻、央视网、上证e互动、中债、中国货币网、五家期货交易所、上金所)也不需要用户凭据(北交所使用官网匿名 Cookie)。仅 iwencai 语义搜索需要 API Key(申请地址)。候选增强源不计入上述能力。
使用示例
跟你的 AI 助手说这些话就能激活:
| 场景 | 说什么 |
|---|---|
| 个股估值 | 「帮我估一下 688017,给我 PE / PEG / 消化时间」 |
| 题材归因 | 「今天哪些股票走强,主要是什么题材」 |
| 研报检索 | 「人形机器人产业链最近的研报,特别是丝杠和减速器」 |
| 北向资金 | 「今天北向资金流入流出怎么样」 |
| 概念板块 | 「688017 属于哪些概念板块」 |
| 资金流向 | 「000858 今天主力资金流入还是流出」 |
| 龙虎榜 | 「002475 最近上过龙虎榜吗,哪些营业部在买」 |
| 全市场龙虎榜 | 「今天龙虎榜哪些票净买入最多」 |
| 解禁预警 | 「这只股票未来 3 个月有没有限售解禁」 |
| 行业轮动 | 「今天哪些行业涨幅最大」 |
| 板块资金流 | 「今天主力资金在流入哪些行业/概念板块,近 5 日趋势呢」 |
| 融资融券 | 「600519 最近的融资余额变化趋势」 |
| 大宗交易 | 「这只票最近有没有大宗交易,溢价还是折价」 |
| 股东户数 | 「000858 股东户数在增加还是减少,筹码集中吗」 |
| 分红送转 | 「茅台历年分红派息多少」 |
| ETF 行情 | 「510050 上证50ETF 现在什么价、今天涨跌多少」 |
| 涨停打板 | 「今天涨停多少家、最高几连板、炸板率多少」 |
| 涨停归因 | 「今天涨停的票都是什么题材,哪些是几天几板」 |
| 重点监控池 | 「现在哪些标的被交易所列入重点监控,监控到什么时候」 |
| 日内异动 | 「今天有哪些严重异常波动的票,触发的是哪条异动规则」 |
| 异动 × 监控交叉 | 「今天异动的票里,有没有已经在重点监控名单上的」 |
| ETF 期权 | 「50ETF 平值期权的隐含波动率和 Delta 是多少」 |
| 互动易 | 「比亚迪最近投资者都在问什么,公司怎么回应的」 |
| 市场热度 | 「今天哪些票最热门,被归到什么概念在炒」 |
| 新闻公告 | 「拉一下 300476 最近的新闻和公告」 |
| 市场快讯 | 「用财联社电报看看现在市场上有什么大新闻」 |
| 批量对比 | 「帮我对比这 5 只半导体股的估值」 |
| 筹码分布 | 「600519 现在获利盘多少,平均成本在哪,筹码峰压力位在哪」 |
| 估值历史 | 「茅台现在的 PE 在过去十年是什么分位,顺便看下换手率」 |
| ST / 停牌 | 「000004 历史上哪段时间是 ST,有没有停过牌」 |
| 行业变迁 | 「000001 在 2016 年属于哪个申万行业,跟现在一样吗」 |
| 宏观环境 | 「最新社融和 PMI 什么水平,现在流动性是宽还是紧」 |
| 指数成分 | 「沪深300最近的成分有哪些,文件日期是什么」 |
| 指数权重 | 「创业板指最近公布的权重是多少,注意保留真实日期」 |
| 指数估值 | 「中证沪深300近期 PE 和股息率,两种口径分别列出」 |
| 交易日历 | 「2026 年 9 月哪些日期开市,按深交所官方日历」 |
| 两融备胎 | 「东财不可用,分别取沪深交易所 2026-09-03 的两融明细」 |
| 北交所备胎 | 「从北交所官方取 920021 当前快照,核对交易日」 |
| 前复权 K 线 | 「600519 从 2025 年到现在的前复权日线,再给我 300750 最近 96 根 5 分钟线」 |
| 全市场日线 | 「2026-09-18 沪深北全市场的收盘价和成交额,按成交额排前 20」 |
| 研报第二来源 | 「东财连不上,用新浪看看 600519 最近有哪些研报」 |
| ETF 份额 | 「510300 这半年份额是在增加还是减少」 |
| 7×24 快讯 | 「华尔街见闻 A 股频道最近 50 条快讯」 |
| 新闻联播 | 「今晚新闻联播提到了哪些行业」 |
| ST 名单 | 「现在一共有多少只 ST 和 *ST,北交所有几只」 |
| 沪市问答 | 「浦发银行最近在上证e互动回复了什么」 |
| 利率曲线 | 「今年以来 10 年期国债收益率怎么走的,和 AAA 中短票的利差多少」 |
| 资金面利率 | 「FR007 最近一个月的走势,LPR 上次调整是哪天」 |
| 宏观日历 | 「下周有哪些重要宏观数据要公布;上周公布的数据和预期差多少」 |
| 期货日行情 | 「上期所昨天螺纹钢和铜各合约的结算价和持仓」 |
| 商品期权 | 「上期所铜期权昨天各合约的 Delta 和隐含波动率」 |
| 期货持仓排名 | 「IF2610 前 20 名会员的多空持仓变化」 |
| 大宗商品 | 「豆粕主力现在什么价,A50 期指和上海金呢」 |
| 业绩预告 | 「三季报业绩预告里预增幅度最大的是哪些」 |
| 机构调研 | 「688062 最近被哪些机构调研过」 |
| 增减持 / 回购 | 「这个月有哪些股东在减持,哪些公司正在实施回购」 |
| 股权质押 | 「质押比例最高的公司有哪些」 |
| 新股申购 | 「这周有哪些新股可以申购,发行市盈率多少」 |
| 可转债 | 「现在溢价率最低的可转债有哪些」 |
| 聚宽代码 | 「把这批代码转成聚宽格式」 |
内置 4 套调研流程
| 流程 | 做什么 | 耗时 |
|---|---|---|
| 单票估值 | 实时价 → 一致预期 EPS → 前向 PE / PEG / PE 消化年数 | 30 秒 |
| 批量对比 | 多只股票横向估值排列 | 1 分钟 |
| 主题研报 | iwencai 多关键词 NL 搜索 + 东财 PDF 交叉补充 | 2 分钟 |
| 新标的调研 | 机构覆盖 → 估值 → 概念板块 → 资金流向 → 龙虎榜 → 解禁 → 两融 | 1 分钟 |
数据源优先级(V3.9 重排,按封 IP 风险)
原则:能用腾讯 / 交易所官方,就别用东财。 行情 / K 线 / 实时价 / 市值 / 财务三表能从腾讯、交易所官方或新浪拿到的,一律走它们。mootdx 行情命令 2026-09 起失效(#52),只用于财务快照与 F10。东财只用于它独有、别处拿不到的数据,且全部走
em_get()内置限流。
| 优先级 | 数据源 | 协议 | 封 IP 风险 | 用途 |
|---|---|---|---|---|
| 1(首选) | 腾讯财经 | HTTP | 不封 IP(K 线单入口约 600 次后限流,已三入口轮换) | 实时价 / PE / PB / 市值 / 换手率 / 涨跌停 / 指数 / ETF / 日周月与分钟 K 线 |
| 2 | 交易所 / 官方机构 | HTTP | 极低(避免高频) | 通达信盘后包、沪深北交易所、五家期货交易所、上金所、中债、中国货币网、中证 / 国证、人民银行、国家统计局 |
| 3 | 新浪 / 巨潮 / 同花顺 / 百度 / 财联社 / 华尔街见闻 / 央视网 / 申万 | HTTP | 低 | 财报三表、复权因子、研报列表、实时期货、公告、一致预期、热点与北向、带均线 K 线、快讯、新闻联播、行业变迁 |
| 4 | mootdx(通达信) | TCP 7709 | 不封 IP | 财务快照、F10「最新提示」正常;K 线 / 盘口 / 逐笔 2026-09 起返回空(#52),逐笔改用腾讯 §1.4 |
| 4 | baostock | TCP | 低(免注册) | 估值历史 PE/PB/PS/PCF + 换手率 + 停牌 + ST + 上市退市日(不支持北交所) |
| 需 Key | iwencai | OpenAPI | 低 | NL 语义搜索研报(唯一需要 Key 的来源) |
| 末位(仅独有数据) | 东财 datacenter / push2 / reportapi / search / np-weblist | HTTP | 中 — 有风控会封 IP | 龙虎榜 / 解禁 / 两融 / 大宗 / 股东户数 / 分红 / 资金流 / 研报 PDF / 个股新闻 / 全球资讯 / ST 名单 / LPR / 事件驱动 / 可转债(已统一走 em_get() 限流) |
34 个来源一览
| # | 来源 | 主要用途 |
|---|---|---|
| 1 | 腾讯财经 | 实时估值、指数 / ETF、日周月与分钟 K 线 |
| 2 | mootdx(通达信 TCP) | 财务快照、F10(行情命令已失效,#52) |
| 3 | 东财 datacenter | 龙虎榜、解禁、两融、大宗、股东户数、分红、事件驱动、可转债、LPR |
| 4 | 东财 push2 / push2his | 行业板块、资金流、个股信息、ST 名单 |
| 5 | iwencai | 自然语言研报检索(需 Key) |
| 6 | 东财 reportapi / PDF | 研报列表、评级、PDF |
| 7 | 同花顺热点 | 强势股与题材归因、涨停揭秘、热榜 |
| 8 | 同花顺 hsgtApi | 北向资金 |
| 9 | 百度股市通 | 带均线 K 线 |
| 10 | 新浪财经 | 财报三表、复权因子、ETF 期权、研报列表、实时期货、A50 |
| 11 | 同花顺 basic | 一致预期 EPS |
| 12 | 财联社 | 电报快讯 |
| 13 | 巨潮 cninfo | 公告、互动易 |
| 14 | 上交所官方 | 龙虎榜、五档、两融、ETF 份额 |
| 15 | 深交所官方 | 龙虎榜、公告、五档、两融、交易日历、ETF 份额 |
| 16 | baostock | 估值历史、上市退市日、ST 名单兜底 |
| 17 | 申万研究 | 行业分类变迁史 |
| 18 | 人民银行 | 社融 |
| 19 | 国家统计局 | PMI |
| 20 | 中证指数 | 成分、权重、PE 与股息率 |
| 21 | 国证指数 | 成分、权重 |
| 22 | 北交所官方 | 当前行情与五档 |
| 23 | 通达信官网盘后包 | 某交易日沪深北全市场日线(含成交额) |
| 24 | 华尔街见闻 | 7×24 快讯、全球宏观日历 |
| 25 | 央视网 | 新闻联播条目与文字稿 |
| 26 | 上证e互动 | 沪市投资者问答 |
| 27 | 中债 | 国债与信用债收益率曲线 |
| 28 | 中国货币网 | 回购定盘利率 FR / FDR |
| 29 | 上期所 | 期货 / 期权日行情、持仓排名 |
| 30 | 上期能源 | 原油 / 国际铜等期货期权、持仓排名 |
| 31 | 郑商所 | 期货 / 期权日行情、持仓排名 |
| 32 | 中金所 | 股指 / 国债期货、股指期权、持仓排名 |
| 33 | 广期所 | 工业硅 / 碳酸锂等期货期权日行情 |
| 34 | 上金所 | 黄金 / 白银 / 铂金现货日线 |
架构原则: 除 mootdx 与 baostock(均为 TCP 客户端库)外,全部直连 HTTP API,不经第三方数据封装。东财系接口有访问频率风控,所有调用统一经
em_get()串行限流防封;批量任务请调大EM_MIN_INTERVAL。降级原则: 主源被封/失效时,查 SKILL.md「备用源速查 & 降级策略」。部分核心数据有不同域名、不同风控面的独立备胎;并非所有能力都有备份,取数后仍须检查日期与完整性。
FAQ
Q: 指数权重为什么不是今天?能拿来回测吗?
官方成分与权重可能按不同日期发布,国证这条接口返回月末快照;date 保存源文件日期。当前成分不能代替历史时点成分。本版未接入历史调样,也不把缺失的指数 PB 补为零。
Q: 两融和北交所备胎怎么用?
先执行 SKILL.md 的 Layer 12 完整代码块,再执行「官方两融与北交所行情备胎」代码块。两融按 SH / SZ 分开取,北交所必须传期望交易日;日期不符、分页不全、源未发布均报错。
Q: mootdx 取不到 K 线 / tdx_client() 报「所有 mootdx 服务器均无法取到数据」?(#52)
2026-09-20 逐台实测内置 10 台服务器,TCP 都能连上,财务、除权除息正常,F10 只剩「最新提示」一类,但 K 线、五档盘口、逐笔成交都返回 0 行。这是服务器端的变化,换 mootdx 版本解决不了。替代方案:
- 沪深日 / 周 / 月 K 线(前后复权)和 1~60 分钟 K 线 → §1.2
tencent_kline()- 某交易日沪深北全市场日线(含成交额;北交所日线只能走这里)→ §1.3
tdx_daily_package()- 实时价与五档 → §1.1 腾讯,或「备用源速查」里的交易所官方五档
- 当日逐笔成交 → §1.4
tencent_ticks()(只有最近一个交易日,不含北交所)- 财务快照 / F10「最新提示」→
tdx_client(check='finance'),照常可用;F10 其余 8 类(公司概况、股东研究等)已不返回,替代见 SKILL.md §6.2
tdx_client()在 K 线模式下要先测速,全部失败大约需要 1 分钟才报错。
Q: easy_tdx(PR #54)、同花顺官方 API 等新项目加入了吗?
没有。easy_tdx 是同一通达信协议的另一个客户端库,不是新的数据源,#52 已改走 HTTP 解决,所以 PR #54 不合并;本项目只接可直接取数的来源。同花顺金融 API 需要用户 Key,不接;集合竞价需先处理 Python 3.10+ 兼容性。候选状态见 v3.8.0 与 v3.9.0 整合记录。V3.9 不新增安装依赖。
Q: 能直接回测吗?能接聚宽吗?(#55)
本 skill 只负责取数,不带回测引擎。回测要把数据交给自己的框架或聚宽。
- 代码格式:
norm_ticker()/get_prefix()认聚宽写法600519.XSHG/000001.XSHE;to_joinquant()把任意写法转成聚宽代码。聚宽公开文档没有北交所后缀,北交所代码会直接报错,不做转换。- 复权:聚宽
get_price默认前复权(fq='pre')。对拍时用 §1.2tencent_kline(adjust='qfq'),或用 §1.6 复权因子自己换算。- 防未来函数:历史估值用 §6.5,历史行业归属用 §6.7,历史指数成分要注意 §12 只给当前快照。
Q: 研报只能从东财拿吗?(#53)
不是。§2.4 sina_research_reports() 是第二来源,可按个股或全市场翻页,东财被封时也能用。它只有标题、类型、机构、研究员和日期,没有评级和目标价;评级与目标价仍用东财研报或同花顺一致预期。
Q: 有商品期货和期权吗?大商所呢?(#49)
有,见期货与大宗商品层。上期所、上期能源、郑商所、中金所、广期所的官方期货日行情和期权日行情都有,会员持仓排名覆盖前四家(广期所未接);另有新浪实时期货、A50 期指和上金所现货。大商所官网有反爬,官方日行情没接;大商所品种(豆粕、铁矿石等)的历史日 K 用 V3.10 的 futures_kline('M0')(新浪,主力连续或具体合约),实时价用新浪实时期货。
Q: 沪市公司的互动易问答为什么是空的?
巨潮互动易只覆盖深市公司,沪市公司实测返回 0 条。沪市请用 §10.3 sse_e_interaction()(上证e互动)。部分公司近一个月确实没有回复,返回空表属正常。
Q: 查北交所股票拿不到研报 / 行情价格明显不对?
北交所老号段(43x/83x/87x)已基本作废。2026-07-31 实测:在市 342 只中 336 只已迁至 920xxx(锦波生物 832982→920982、贝特瑞 835185→920185)。老码最坑的地方是不报错——东财研报静默返回 0 篇(看着像"这票没研报"),腾讯行情返回定格在迁移日的僵尸报价(成交量 0,与真实价差 17%~100%+)。V3.6.0 起:tencent_quote() 返回 is_stale / stale_reason 标志,eastmoney_reports() 遇老码直接抛 ValueError 而不是返回空。拿新码:用 push2 北交所全量清单 fs=m:0+t:81+s:2048 按名称反查。V3.9 新入口的北交所边界:腾讯 K 线不支持北交所(直接报错),北交所日线用 §1.3 通达信盘后包;新浪研报会自动加 bj 前缀;股权质押统计不含北交所,传北交所代码直接报错。
Q: 传 SH600519 / 600519.SH 查不到数据?
V3.6.0 前研报层确实如此(reportapi 只认纯 6 位数字,带前缀静默返回 0 篇)。现已新增 norm_ticker() 并在研报层接入,四种写法结果一致;解析不出 6 位数字时抛 ValueError 而非返回空,避免把"代码写错"误读成"这票没数据"。
Q: SKILL.md 这么大,agent 每次加载很费 token?
单文件自包含是本项目的有意产品决策——拷一个文件就能用、离线可携、便于分发,这个形态会长期保持,不做目录化拆分(相关讨论见 #21 / #22 / #29)。两个降耗建议:① v3.3.1 起 description 已收窄触发范围,无需取数的 A 股话题不会再误加载整个文件;② token 敏感的用户可以不把它装成自动触发 skill,改为放进项目目录、需要取数时让 agent 按需读取——文件按十五层组织、章节标题清晰,v3.4.0 起顶部还有「端点路由速查」总表(§→函数→用途→源),agent 按表定位后只读对应层,通常只花几 K token。
Q: 东财接口 403 / 连接重置,是被封了怎么办?
东财系接口(datacenter/push2/push2ex/reportapi/search/np-weblist)共用同一套风控,IP 被封会成片失联。三步:① 停止请求等 30-60 分钟(IP 级临时封通常自动解除),或换网络(手机热点)立刻恢复;② 长批任务确认全部走 em_get() 并调大 EM_MIN_INTERVAL;③ 数据不能等 → 用 SKILL.md「备用源速查 & 降级策略」的独立备胎(交易所官方/新浪/同花顺,不同风控面)。
Q: 财联社快讯不是 V3.2 标注下线了吗?
已复活(V3.4.0)。2026-05 死的是旧 nodeapi 系接口;官方新版 v1/roll/get_roll_list 一直可用,只是强制 sign 校验——sign 纯本地可算(md5(sha1(按 key 字典序拼接的 query 串))),零 key。与东财 7×24 全球资讯互为独立备份。
Q: mootdx 库听说停更了,还能用吗?
库确实烂尾(最后 commit 2024-07,BESTIP bug 无官方修复)。内置的 tdx_client() 已绕开 BESTIP bug;目前只用它取财务与 F10,K 线见上面 #52 那条。
Q: pip install mootdx 把 httpx 降到 0.25.2,和 MCP(要 httpx≥0.27.1)冲突?(#30)
mootdx 上游锁了 httpx<0.26,与 MCP 等工具的 httpx≥0.27 硬冲突,skill 层改不动它的依赖声明。但可以绕过——关键点:mootdx 取行情走的是 TCP 二进制协议(通达信 7709 端口),运行时根本不经过 httpx,httpx<0.26 只是它声明的一个用不到的保守上限。两个务实解法:
--no-deps升 httpx(推荐):装完 mootdx 后pip install --no-deps "httpx>=0.27.1",既满足 MCP,mootdx 也照常工作。pip 会留一条 incompatible 警告,但不影响运行(实测 mootdx 0.11.7 在 httpx 0.28.1 下取数正常)。- 独立 venv 隔离:把跑 mootdx 的部分和跑 MCP 的主环境分到不同 venv,彻底互不干扰。
Q: mootdx 和腾讯有什么区别?
以前互补:mootdx 管价格 / 盘口 / K 线,腾讯管估值(PE / PB / 市值 / 换手率 / 涨跌停价)。#52 之后价格与 K 线都走腾讯,mootdx 只剩财务快照和 F10。两者都不封 IP。
Q: 在海外服务器跑,mootdx 超时?
mootdx 走 TCP 直连通达信行情服务器,需国内 IP 才稳定;#52 之后它只用于财务与 F10,K 线已改走腾讯与通达信盘后包(HTTP)。海外环境建议走代理或切换到 yfinance。
Q: 腾讯 API 字段 43 是 PB 吗?
不是。43 = 振幅%,46 = PB。网上大量教程写错了,这里是实测校准结果。
Q: V3.0 为什么移除 akshare?
akshare 本质是对东财/同花顺/新浪等公开 API 的封装,中间层增加了故障点(版本兼容 bug、pandas 3.0 ArrowInvalid 等)。V3.0 直连底层 HTTP API,零中间依赖,更稳定可控。
Q: 行业板块为什么从同花顺换成东财?
同花顺 stock_board_industry_summary_ths 接口 2026 年初加了反爬 401。东财 push2 行业板块(m:90+t:2)是完美替代,零鉴权且字段更丰富。
Q: iwencai 返回 401?
检查:(1) API Key 有效性 (2) 是否携带了 X-Claw-* Headers。SkillHub 2.0 后强制要求。
Q: 同花顺热点 reason 字段为空?
盘后数据还没更新,15:30 之后再调。个别 ST 股没有人工标注,dropna 过滤即可。
Q: 百度股市通 ResultCode 不稳定?
已知坑——有时返回 int 0,有时返回 string "0"。代码里用 str() 统一比较即可。
Q: 东财资金流/个股新闻偶尔返回空或 HTTP 000?(#18)
部分大陆住宅宽带 IP 会被东财 push2/search-api 连接级间歇风控(表现 HTTP 000 连接被拒、或新闻只返回 passportWeb 无文章)。这不是代码问题——同一代码在其他网络/时段实测正常。对策:隔几分钟重试、换网络环境(手机热点)、调大 EM_MIN_INTERVAL 降频。日级资金流也可用腾讯 K 线或通达信盘后包的量价数据务实替代。
Q: 北向资金历史只有几天?
V2.1 改为本地自缓存。每次调用自动积累,越跑越丰富。首次运行只有当天数据。
Q: 不用 Claude Code,能用吗?
能。SKILL.md 本质是 Markdown + 内嵌 Python 代码。Codex、OpenClaw 或任何 AI 编程助手都能读取。你也可以直接把 Python 代码段复制出来在自己的脚本里跑。
验证
python3 -m unittest discover -s tests -v 直接从 SKILL.md 抽取发布代码,测试日期、字段、代码归属、单位、分页与错误传播,不访问网络(V3.10.2 共 179 条离线测试)。
真实网络测试需显式开启,日期须是源已发布数据的交易日:
# V3.10 的逐笔、期货日 K,以及 §1.2 K 线成交量单位核对(会下载一次通达信盘后包)
ASTOCK_LIVE_V310=1 python3 -m unittest tests.test_v310_sources -v
# V3.9 新增的 25 个入口(31 次真实调用)
ASTOCK_LIVE_V39=2026-09-18 python3 -m unittest tests.test_v39_sources -v
# V3.8 的官方两融与北交所备胎
ASTOCK_LIVE_TRADE_DATE=2026-09-04 ASTOCK_LIVE_MARGIN_DATE=2026-09-03 python3 -m unittest tests.test_official_data -v逐个入口的实测行数与数据边界见 v3.9.0 整合记录;V3.8 的记录见 v3.8.0。
更新日志
见 CHANGELOG.md。
免责声明
本项目仅提供数据获取工具,不构成任何投资建议。股市有风险,投资需谨慎。
License
Apache License 2.0 — 自由使用,注明出处即可。
作者: Simon 林 · X @linsizhen · 邮箱:[email protected]
File: README_en.md
a-stock-data
Full-stack data toolkit for China A-Share market — 15-layer architecture · 87 capability endpoints (82 primary + 5 backups) · 34 data sources · direct HTTP calls except two TCP client libraries (mootdx / baostock)
A self-contained Skill file that consolidates raw A-share and related market data from 34 sources into a ready-to-use toolkit for AI coding assistants. No need to memorize Tencent K-line paging parameters, the binary layout of TDX end-of-day packages, Eastmoney PDF Referer headers, or iwencai X-Claw authentication — it's all handled. And when a primary source bans you, there's a backup-source quick reference to fall back on.
Compatible with Claude Code · Codex · OpenClaw · WorkBuddy · Muse · Grok Bot
The Skill file is structured Markdown + embedded Python. Any AI coding assistant with context injection can use it.
V3.10.2 (2026-10-11 · #58): fixes the PE digestion years in
full_valuation(). When the forward PE is above 30x and forecast earnings are not growing (or next year's forecast is missing), it used to return 0 years, as if the PE were already digested; it now returnsNone, meaning it cannot be estimated. It also returnsNonewhen current EPS is missing or not positive. Entry and source counts are unchanged.V3.10.1 (2026-10-07 · #57): corrects the §1.2 Tencent K-line volume unit: STAR Market (688 / 689) is in shares, everything else is in lots. The docs said lots throughout, so STAR volumes converted per the old docs came out 100× too large. Also adds the rules for reconciling share-level volume with the TDX end-of-day package and Baostock. §1.4 ticks now use a pooled, auto-retrying session (one call ~70 s → ~25 s) and add
frame.attrs["complete"], which from 15:31 on checks for missing after-hours fixed-price trades; §13.7 futures daily K-lines retry too. Entry count, source count and returned data are unchanged.V3.10.0 (2026-09-22): after the TDX public servers stopped serving K-lines, order books and ticks (#52), the quote layer now lists the working sources first (Tencent → Tencent K-lines → TDX end-of-day package → Tencent ticks) and moves mootdx to the end as an archive. New: §1.4
tencent_ticks()— Tencent intraday ticks for the latest trading day, one snapshot about every 3 seconds (replaces mootdx ticks) — and §13.7futures_kline()— Sina futures daily K-lines, continuous or single contract, now covering DCE. Layer 1 is renumbered; the old→new mapping is in the CHANGELOG.V3.9.0 (2026-09-20): three new layers — futures & commodities, event-driven, convertible bonds — plus Tencent K-lines, the TDX official end-of-day package, Sina research reports, ETF shares, yield curves and more in the existing layers: 25 new entries in total. The broken TDX public-server K-line commands (#52) are now routed over HTTP. See the CHANGELOG (Chinese).
Data Coverage (15 categories)
| # | Category | Data | Main sources |
|---|---|---|---|
| 1 | Quotes / K-lines | Live price, PE/PB/market cap/turnover, daily/weekly/monthly forward- and back-adjusted and 1–60-minute K-lines, full-market daily bars for a trading day (with turnover value), adjust factors, index / ETF | Tencent, TDX official site, Baidu, Sina |
| 2 | Research | Stock / industry reports and PDFs, ratings, 3-year EPS forecasts, consensus EPS, natural-language search, report lists | Eastmoney, Sina, THS, iwencai |
| 3 | Market signals | Hot stocks and themes, northbound flow, sector membership, fund flow, dragon-tiger board, lockup expiries, industry ranking, board fund flow | THS, Eastmoney |
| 4 | Capital flow / chips | Margin trading, block trades, shareholder count, dividends, 120-day fund flow, chip distribution, ETF shares | Eastmoney, SSE, SZSE, computed locally |
| 5 | News | Stock news, CLS flash, 7×24 live news, CCTV evening news transcripts | Eastmoney, CLS, Wallstreetcn, CCTV |
| 6 | Fundamentals | Quarterly snapshot, F10, financial statements, valuation history, listing/delisting dates, SW industry history, ST list | TDX (mootdx), Sina, baostock, SW, Eastmoney |
| 7 | Filings | Full filings across SSE / SZSE / BSE | cninfo |
| 8 | Limit-up | Limit-up / break / limit-down / previous-day pools, limit-up reasons, watch list, intraday anomalies | Eastmoney, THS |
| 9 | ETF options | T-quotes, Greeks, implied volatility | Sina |
| 10 | Sentiment | cninfo IRM (Shenzhen), SSE e-Interaction (Shanghai), THS hot list, Eastmoney popularity rank, concept hits | cninfo, SSE e-Interaction, THS, Eastmoney |
| 11 | Macro & rates | Social financing, PMI, government and credit yield curves, repo fixing rates, LPR, global macro calendar | PBoC, NBS, ChinaBond, China Money (CFETS), Eastmoney, Wallstreetcn |
| 12 | Index & calendar | CSI / CNI constituents and weights, CSI PE and dividend yield, SZSE trading calendar | CSI, CNI, SZSE |
| 13 | Futures & commodities | Futures daily quotes, commodity and index options, member position rankings, real-time futures, FTSE China A50, SGE spot | SHFE, INE, CZCE, CFFEX, GFEX, Sina, SGE |
| 14 | Event-driven | Earnings previews, institutional surveys, shareholder buying/selling, buybacks, share pledges, IPO calendar | Eastmoney |
| 15 | Convertible bonds | Terms, conversion price, conversion value, premium, listing / delisting status | Eastmoney |
Plus 5 backups: official dragon-tiger, Sina fund flow, filings, official SSE/SZSE margin data, and BSE current quotes — used when a primary source is blocked.
Architecture
China A-Share Full-Stack Data · 15-Layer Architecture · V3.10.2
│ (Priority: Tencent / exchanges and official bodies first — no IP bans; mootdx quote commands return empty since 2026-09,
│ so it is only used for financials and F10; Eastmoney only for exclusive data, with built-in throttling)
├── Market Data Tencent + TDX site + Baidu + Sina Live price / PE / PB / market cap + Index/ETF + K-lines (w/ MA5/10/20)
│ + adjust factors qfq/hfq ★V3.7
│ + adjusted daily/weekly/monthly & 1–60-min K-lines + full-market daily bars ★V3.9
│ + intraday ticks, ~3 s snapshots (SSE/SZSE stocks + ETFs) ★V3.10
├── Research Eastmoney + THS + iwencai + Sina Stock reports / Industry reports / PDF / Consensus EPS / NL search
│ + Sina report list (second source) ★V3.9
├── Signals THS + Eastmoney Hot stocks + Sector attribution + Northbound flow
│ + Sector membership + Fund flow(push2) + Dragon Tiger + Lockup + Industry + Board fund flow
├── Capital Flow Eastmoney datacenter + push2 Margin trading + Block trades + Holder count + Dividends + Fund flow(min+120d)
│ / Chips computed locally + SSE + SZSE Chip distribution (CYQ) ★V3.7 + ETF shares ★V3.9
├── News Eastmoney + CLS + Wallstreetcn + CCTV Stock news / CLS flash / Global news / 7×24 live / CCTV evening news ★V3.9
├── Fundamentals mootdx + Eastmoney + Sina 37-field quarterly + F10 latest notes + Financial statements
│ + baostock + SW Valuation history (PE/PB/PS + turnover + ST) / listing & delisting / SW industry history ★V3.7
│ + ST list ★V3.9
├── Filings cninfo + mootdx Full filings across SSE / SZSE / BSE
├── Limit-Up Eastmoney push2ex + THS ZT/ZB/DT/prev-ZT pools / limit reasons / consecutive-board ladder
│ + Watch list pool + Intraday price-anomaly pool ★V3.6
├── Options Sina hq.sinajs ETF option T-quotes / Greeks / implied volatility ★V3.3
├── Sentiment cninfo IRM + SSE e-Interaction + THS + Eastmoney Shenzhen Q&A / Shanghai Q&A ★V3.9 / hot lists / popularity / concept hits
├── Macro & Rates PBoC + NBS + ChinaBond + CFETS + Eastmoney + Wallstreetcn
│ Social financing / PMI / yield curves / repo fixing / LPR / macro calendar ★V3.9
├── Index/Calendar CSI + CNI + SZSE Constituents / weights / PE & dividend yields / official trading calendar
├── Futures SHFE + INE + CZCE + CFFEX + GFEX + Sina + SGE
│ Futures daily / commodity & index options / position rank / real-time / A50 / SGE gold ★V3.9
│ + futures daily K-lines (continuous + contracts, incl. DCE) ★V3.10
├── Event-Driven Eastmoney datacenter Earnings previews / surveys / holder trades / buybacks / pledges / IPO calendar ★V3.9
└── Convertibles Eastmoney datacenter Terms / conversion value / premium / listing status ★V3.9The 15 layers include a Backup Sources & Fallback Strategy appendix: dragon-tiger, fund flow and filings, plus official SSE/SZSE margin data and BSE current quotes with five-level books. See SKILL.md for coverage and source dates.
Quick Start
3 steps, 2 minutes.
# 1. Create skill directory
mkdir -p ~/.claude/skills/a-stock-data
# 2. Download SKILL.md
curl -o ~/.claude/skills/a-stock-data/SKILL.md \
https://raw.githubusercontent.com/simonlin1212/a-stock-data/main/SKILL.md
# 3. Install dependencies (V3.0: akshare no longer needed; V3.9 adds none)
pip install mootdx requests pandas stockstats numpy baostock xlrd openpyxlLaunch Claude Code and say "Check the valuation of 688017" — the skill activates automatically.
Codex / OpenClaw users: Paste the contents of SKILL.md into your system prompt or project context file. The embedded Python code is ready to execute.
87 Endpoints
There are 82 primary entries and 5 backups. Counts refer to capability entries: CSI/CNI or SSE/SZSE routes within one function count once; helpers and research candidates are excluded.
Counting convention: the tables below have 88 rows but count as 87 capability endpoints — "Eastmoney Industry Reports" shares the same endpoint as "Eastmoney reportapi" (only the
qTypeparameter differs) and "THS Northbound (historical)" is a local self-built cache (not a separate endpoint), so neither is counted; the single "EM Intraday Anomaly Pool" row covers two endpoints (list/count), adding one back. 88 − 1 − 1 + 1 = 87. The ticker helperto_joinquant()is not counted.
Market Data (real-time, no IP ban)
| Endpoint | Data |
|---|---|
| Tencent Finance | PE(TTM) / PB / Market Cap / Float Cap / Turnover / Price Limits / Index / ETF |
| Tencent K-lines | SSE/SZSE daily/weekly/monthly forward- and back-adjusted + 1/5/15/30/60-minute bars, rotating across three Tencent hosts; no BSE (V3.9 new) |
| TDX End-of-Day Package | Every SSE/SZSE/BSE security's daily bar for one trading day, incl. turnover value; one 2–3 MB zip; 2022-01-04 and 2023-01-03 tested available, 2021-01-04 gone, not every day verified; packages before 2022-05-06 have no BSE files (V3.9 new) |
| Tencent Ticks | All ticks of the latest trading day (~3-second snapshots, not Level-2 trade-by-trade): time / price / volume / value / buy-sell side, SSE/SZSE stocks + ETFs, no BSE; after the close the total is checked against the day's turnover (V3.10 new, replaces mootdx ticks) |
| Baidu K-line | Daily K-line + MA5/MA10/MA20 moving averages included (V3.0 new) |
| Sina Adjust Factors | qfq / hfq factor series + applying them to unadjusted candles (V3.7 new) |
| mootdx Market Data (archive) | Candlesticks (multi-period) + order book + ticks + 46-field quote (⚠️ TDX public servers return empty since 2026-09, see FAQ #52; use Tencent K-lines / the end-of-day package for bars and Tencent Ticks for trades) |
Research Reports
| Endpoint | Data |
|---|---|
| Eastmoney reportapi | Single-stock report list + ratings + 3-year EPS forecasts |
| Eastmoney Industry Reports | Industry report list (qType=1, same endpoint) + industry name/code + rating (V3.2.3) |
| Eastmoney PDF | Full research report PDF, stock & industry (Referer auth handled) |
| THS Consensus EPS | Institutional consensus EPS (direct basic.10jqka.com.cn) |
| iwencai NL Search | Natural language cross-topic report search |
| Sina Report List | Title / type / broker / analysts / date — a second source besides Eastmoney; no ratings or targets (V3.9 new, #53) |
Signals
| Endpoint | Data |
|---|---|
| THS Hot Stocks | Today's strong stocks + sector attribution tags (editorial annotations) |
| THS Northbound (real-time) | Shanghai Connect minute-level flow (Shenzhen Connect unreliable since upstream disclosure tightening — see HKEX backup for authoritative data) |
| THS Northbound (historical) | Local self-cached daily history |
| Eastmoney Sector Membership | All sectors a stock belongs to (industry/concept/region mixed) + BK code + daily change + leading stock (V3.2.2, replaced Baidu PAE, one request) |
| Eastmoney Fund Flow | Main / Large / Medium / Small / Super-large order minute-level net inflow (V3.1, replaced Baidu PAE) |
| Dragon Tiger Board | Appearance records + Top 5 buy/sell brokerages + institutional activity |
| Daily Dragon Tiger (Full Market) | All stocks on daily board + net buy ranking + appearance reasons |
| Lockup Expiry Calendar | Historical releases + 90-day upcoming expiry alerts |
| Industry Ranking | Eastmoney industry change/up/down counts (V3.0, replaced THS 401) |
| Board Fund Flow | Industry/concept/region × today/5d/10d main net inflow & ratio + super-large/large/medium/small tiers + leading stock (V3.5, same endpoint as Industry Ranking) |
Capital Flow / Ownership (V3.0 New)
| Endpoint | Data |
|---|---|
| Margin Trading | Daily margin balance / buy / repay + short selling balance |
| Block Trades | Deal price/volume + buyer/seller brokerages + premium rate |
| Shareholder Count | Quarterly holder count + QoQ change + avg shares per holder |
| Dividend History | Per-share cash dividend / bonus shares / transfer shares |
| 120-Day Fund Flow | Main / large / medium / small order daily net inflow |
| Chip Distribution (CYQ) | Profit ratio / average cost / 90-70 cost range & concentration / chip peak (computed locally, V3.7 new) |
| ETF Shares | SSE daily archive (2022-01-04 still available in testing) / SZSE current snapshot, in 10k units (V3.9 new) |
News
| Endpoint | Data |
|---|---|
| Stock News | Eastmoney per-stock news (direct search-api-web) |
| CLS Flash | Market-wide real-time flash (v1 API + local signature, zero key, ✅revived in V3.4.0, mutual backup with Global News) |
| Global News | Eastmoney global finance news (direct np-weblist, 7×24) |
| Wallstreetcn Live | 7×24 live news by channel, with a paging cursor (V3.9 new) |
| CCTV Evening News | Xinwen Lianbo item titles + transcripts (cctv.com, updated after about 20:00 Beijing time; V3.9 new) |
Fundamentals + Filings
| Endpoint | Data |
|---|---|
| Quarterly Snapshot | 37 fields (EPS / ROE / Net Profit / Revenue...) |
| F10 Text | "Latest notes" (filings / news / block trades / margin / risk alerts digest); since 2026-09 the server only returns this category |
| Eastmoney Stock Info | Industry / total shares / float / market cap / listing date (direct push2) |
| Sina Financial Statements | Balance sheet / Income statement / Cash flow (direct quotes.sina.cn) |
| cninfo Filings | Full filings across all exchanges |
| Valuation History | Daily PE/PB/PS/PCF + turnover + suspension + ST flag (back to 2016; Beijing Exchange not supported, V3.7 new) |
| Listing / Delisting Date | ipoDate / outDate / status (only zero-auth source for delisting dates, V3.7 new) |
| SW Industry History | Every industry reclassification per stock (removes look-ahead bias; codes only, no Chinese names, V3.7 new) |
| ST List | Today's SSE/SZSE/BSE ST and *ST stocks with price; falls back to baostock (SSE/SZSE only, no price) when Eastmoney is unreachable (V3.9 new) |
Limit-Up / Limit-Down (V3.3 new)
| Endpoint | Data |
|---|---|
| EM Limit-Up Pool | Consecutive boards / N-day-M-board / seal fund / break count / seal time / industry |
| EM Break-Board Pool | Opened after limit-up + amplitude / speed |
| EM Limit-Down Pool | Seal fund / consecutive limit-down / open count / board turnover |
| EM Prev-Day Limit-Up Pool | Yesterday's limit-up performance today (promotion rate / profit effect) |
| THS Limit-Up Insight | Limit reason themes / seal success rate / board type / seal amount |
| EM Watch List Pool | Exchange risk-warning / watch list + validity window (new in V3.6) |
| EM Intraday Anomaly Pool | Severe price-anomaly detail + per-stock aggregated counts + all 12 anomaly rules decoded (new in V3.6) |
ETF Options (V3.3 new)
| Endpoint | Data |
|---|---|
| Option Contract List | 50ETF / 300ETF / STAR50 ETF / 500ETF call & put contracts by month |
| T-Quote | Bid/ask 5 levels / open interest / strike / last / volume |
| Greeks + IV | Delta / Gamma / Theta / Vega / implied vol / theoretical value (exchange-computed, no local BSM) |
Sentiment & Interaction (V3.3 new)
| Endpoint | Data |
|---|---|
| Investor Q&A (IRM) | Investor questions + official company replies (cninfo, Shenzhen-listed companies; unique source: how a company responds to rumors/news) |
| SSE e-Interaction | Investor questions + replies for Shanghai-listed companies, which cninfo IRM does not cover (V3.9 new) |
| THS Hot List | Popularity / concept tags / rank change |
| EM Popularity Rank | Rank + rank change + name/price |
| EM Stock Concept Hits | Which concepts the market is grouping this stock under + heat |
Macro & Rates (V3.7 new, extended in V3.9)
| Endpoint | Data |
|---|---|
| PBoC Social Financing | Aggregate Financing to the Real Economy, monthly, 12 columns (RMB/entrusted/trust loans, undiscounted acceptances, corporate & government bonds, equity financing, ABS, write-offs) |
| NBS PMI | Manufacturing / non-manufacturing / composite PMI + large / medium / small enterprise breakdown |
| ChinaBond Yield Curves | Government / commercial bank AAA / short-term note AAA, 3 months to 30 years (V3.9 new) |
| Repo Fixing Rates | FR001 / FR007 / FR014 and the matching FDR tenors (China Money; FR about 3 years, FDR about 1 year of history; V3.9 new) |
| LPR | 1-year / 5-year full history (incl. the daily quotes of the 2013–2019 regime; V3.9 new) |
| Global Macro Calendar | Actual / forecast / previous / revised values and importance (Wallstreetcn; V3.9 new) |
Index Data and Trading Calendar
| Endpoint | Data |
|---|---|
| Index Constituents | Latest CSI constituents and latest published CNI month-end constituents; actual source dates, no historical membership backfill |
| Index Weights | Latest published CSI/CNI weights in percentage points; dates may differ from constituents |
| Index Valuation | CSI PE and dividend yields under two share-capital conventions; recent file, no PB or full-history guarantee |
| Official Trading Calendar | Complete SZSE calendar month; missing days, unpublished months and unknown flags raise errors |
Futures & Commodities (V3.9 new, #49)
| Endpoint | Data |
|---|---|
| Futures Daily | Official closing data from SHFE / INE / CZCE / CFFEX / GFEX: OHLC, settlement, volume, open interest and its change, turnover |
| Options Daily | Commodity and index options: strike, settlement, volume and open interest, Delta, implied volatility (per series on SHFE / INE, per contract on CZCE / GFEX; CFFEX publishes neither Delta nor IV) |
| Member Position Rank | Top 20 members by volume / long / short positions and their changes (SHFE, INE, CZCE, CFFEX) |
| Real-Time Futures | Sina real-time price and best bid/ask across all six futures exchanges (use this for DCE contracts); price limits for CFFEX contracts only |
| Futures Daily K-lines | Sina daily bars for a continuous series (RB0 / M0, back to 2005) or a single contract (those expiring from about 2022), all six exchanges incl. DCE; prices match the official daily data, settlement prices are incomplete (V3.10 new) |
| FTSE China A50 | FTSE China A50 continuous futures quote |
| SGE Spot | Shanghai Gold Exchange Au99.99 / Au(T+D) / Ag(T+D) / Pt99.95 and more, daily bars |
DCE's website uses a JavaScript challenge (plain HTTP gets 412), so its official daily quotes are not integrated; use Futures Daily K-lines for DCE history and Real-Time Futures for live prices.
Event-Driven (V3.9 new)
| Endpoint | Data |
|---|---|
| Earnings Previews | Preview type, expected amount and change ranges, prior-year figure, reasons |
| Institutional Surveys | Survey summary (number of institutions, method, venue) or per-institution detail |
| Shareholder Trades | Holder, direction, shares and percentage changed, holdings afterwards, average price, channel |
| Share Buybacks | Price cap, planned share and amount ranges, shares and amount bought so far, progress |
| Share Pledges | CSDC weekly pledge ratio, pledged shares and value, number of pledges (SSE/SZSE only) |
| IPO Calendar | Subscription / lottery / payment / listing dates, issue price and PE, winning rate, first-day performance |
Convertible Bonds (V3.9 new)
| Endpoint | Data |
|---|---|
| Convertible Bonds | Underlying stock, rating, issue size, conversion price, conversion value, premium, listing / maturity / delisting dates and status |
Backup Sources (fallback when a primary source fails)
| Endpoint | Data |
|---|---|
| Official Dragon-Tiger Backup | SSE + SZSE official APIs, zero-auth, authoritative first-party, incl. brokerage seats (when Eastmoney is banned) |
| Fund Flow Backup | Sina daily 4-tier order net flow (super-large / large / medium / small + net inflow) |
| Filings Backup | SZSE official for Shenzhen tickers, Eastmoney for Shanghai, both with direct PDF links (when cninfo is banned) |
| Official Margin Backup | Query SSE/SZSE separately; CNY amounts and share/unit quantities; missing SSE short balance remains null |
| BSE Quote Backup | Board-wide or single-symbol OHLC, volume, amount and five-level snapshot; validates session date; no historical backfill or verified intraday latency |
Plus a per-layer primary → independent-backup table (exchange official / THS F10 / HKEX / cninfo webapi / Jin10 — all on different rate-limit planes) and a "confirmed dead" list — see the "Backup Sources & Fallback Strategy" section in SKILL.md. From V3.9 the primary K-line source is Tencent, full-market daily bars can come from the TDX package, and report lists can come from Sina.
Authentication
All integrated sources except iwencai require no user registration or API key. CSI, CNI and BSE (V3.8) and the 12 sources added in V3.9 (TDX official site, Wallstreetcn, CCTV, SSE e-Interaction, ChinaBond, China Money, the five futures exchanges, SGE) need no user credentials; BSE establishes an anonymous site cookie. Only iwencai semantic search requires an API key (apply here). Optional research candidates are excluded from these capabilities.
Usage Examples
Just tell your AI assistant:
| Scenario | Prompt |
|---|---|
| Valuation | "Estimate 688017 — give me PE / PEG / payback period" |
| Sector Attribution | "Which stocks are strong today and what sectors are driving them" |
| Research Reports | "Latest reports on humanoid robot supply chain, especially ball screws and reducers" |
| Northbound Flow | "How's northbound capital flow looking today" |
| Concept Blocks | "What concept sectors does 688017 belong to" |
| Fund Flow | "Is institutional money flowing into or out of 000858 today" |
| Dragon Tiger Board | "Has 002475 appeared on the dragon tiger board recently, which brokerages are buying" |
| Daily Dragon Tiger | "Which stocks had the highest net buy on today's dragon tiger board" |
| Lockup Expiry | "Any lockup expiries coming up in the next 3 months for this stock" |
| Industry Rotation | "Which industries are up the most today, where is money flowing" |
| Margin Trading | "What's the recent trend in margin balance for 600519" |
| Block Trades | "Any recent block trades for this stock, premium or discount" |
| Shareholder Count | "Is 000858 shareholder count increasing or decreasing" |
| Dividends | "How much has Moutai paid in dividends over the years" |
| ETF Quote | "What's the price of 510050 (SSE 50 ETF) and today's change" |
| Limit-Up Sentiment | "How many stocks hit limit-up today, highest consecutive boards, break rate" |
| Limit-Up Themes | "What themes drove today's limit-ups, which are multi-day boards" |
| Watch List Pool | "Which stocks are on the exchange watch list right now, and until when" |
| Intraday Anomalies | "Which stocks had severe price anomalies today, and which rule did they trigger" |
| Anomaly × Watch List | "Of today's anomaly stocks, which are already on the watch list" |
| ETF Options | "What's the implied vol and Delta of the at-the-money 50ETF option" |
| Investor Q&A | "What are investors asking BYD recently and how did the company respond" |
| Market Heat | "Which stocks are hottest today and what concepts are they grouped under" |
| News & Filings | "Pull recent news and filings for 300476" |
| Market Flash | "Any big market news right now on the CLS flash feed" |
| Batch Compare | "Compare valuations of these 5 semiconductor stocks" |
| Chip Distribution | "How much of 600519 is in profit, where's the average cost and the chip peak" |
| Valuation History | "What percentile is Moutai's PE over the past decade, and show turnover too" |
| ST / Suspension | "When was 000004 flagged ST, and has it ever been suspended" |
| Industry Drift | "Which SW industry was 000001 in back in 2016 — same as today?" |
| Macro Backdrop | "What's the latest social financing and PMI — is liquidity loose or tight" |
| Index Constituents | "List the latest CSI 300 constituents and their source date" |
| Index Weights | "Show the latest published ChiNext weights, preserving their actual date" |
| Index Valuation | "Show recent CSI 300 PE and dividend yields, with both conventions separately" |
| Trading Calendar | "Which days in September 2026 are open, according to SZSE?" |
| Margin Backup | "Eastmoney is unavailable; fetch SSE and SZSE margin data separately for 2026-09-03" |
| BSE Backup | "Fetch the current official BSE snapshot for 920021 and verify its session date" |
| Adjusted K-lines | "Forward-adjusted daily bars for 600519 since 2025, plus the latest 96 five-minute bars for 300750" |
| Full-Market Daily | "Close and turnover value for every SSE/SZSE/BSE security on 2026-09-18, top 20 by turnover" |
| Second Report Source | "Eastmoney is down — use Sina to list recent reports on 600519" |
| ETF Shares | "Has 510300's share count grown or shrunk over the past six months" |
| 7×24 Live News | "Latest 50 items from the Wallstreetcn A-share channel" |
| CCTV Evening News | "Which industries did tonight's Xinwen Lianbo mention" |
| ST List | "How many ST and *ST stocks are there now, and how many on the BSE" |
| Shanghai Q&A | "What has SPD Bank replied on SSE e-Interaction recently" |
| Yield Curves | "How has the 10-year government bond yield moved this year, and what's the spread to AAA short-term notes" |
| Money-Market Rates | "FR007 over the past month, and when did the LPR last change" |
| Macro Calendar | "Which major macro releases are due next week; how did last week's releases compare with forecasts" |
| Futures Daily | "Yesterday's settlement prices and open interest for SHFE rebar and copper contracts" |
| Commodity Options | "Delta and implied volatility for yesterday's SHFE copper options" |
| Position Rank | "Top 20 members' long/short position changes in IF2610" |
| Commodities | "Where's soybean meal trading now, and the A50 futures and SGE gold" |
| Earnings Previews | "Which Q3 earnings previews show the biggest expected increase" |
| Institutional Surveys | "Which institutions have surveyed 688062 recently" |
| Holder Trades / Buybacks | "Which shareholders are selling this month, and which companies are buying back shares" |
| Share Pledges | "Which companies have the highest pledge ratios" |
| IPO Calendar | "Which IPOs can I subscribe to this week, and at what issue PE" |
| Convertible Bonds | "Which convertible bonds have the lowest conversion premium right now" |
| JoinQuant Tickers | "Convert these tickers to JoinQuant format" |
4 Built-in Research Workflows
| Workflow | What it does | Time |
|---|---|---|
| Single Stock Valuation | Live price → Consensus EPS → Forward PE / PEG / PE payback years | 30 sec |
| Batch Comparison | Side-by-side valuation ranking | 1 min |
| Thematic Research | iwencai multi-keyword NL search + Eastmoney PDF cross-reference | 2 min |
| New Target Research | Coverage → Valuation → Concepts → Fund flow → Dragon tiger → Lockup → Margin | 1 min |
Data Source Priority (V3.9 re-ranked by IP-ban risk)
Principle: if Tencent or an exchange / official body has it, don't use Eastmoney. Quotes, K-lines, live prices, market cap and financial statements available from Tencent, official sources or Sina must come from them. mootdx quote commands return empty since 2026-09 (#52), so mootdx is only used for financial snapshots and F10. Eastmoney is only for its exclusive data, all routed through the throttled
em_get().
| Priority | Source | Protocol | IP Ban Risk | Use |
|---|---|---|---|---|
| 1 (top) | Tencent Finance | HTTP | Never banned (one K-line host rate-limits after ~600 calls; three hosts rotate) | Live price / PE / PB / market cap / turnover / price limits / index / ETF / daily-weekly-monthly and minute K-lines |
| 2 | Exchanges / official bodies | HTTP | Very low (avoid bursts) | TDX package, SSE / SZSE / BSE, five futures exchanges, SGE, ChinaBond, China Money, CSI / CNI, PBoC, NBS |
| 3 | Sina / cninfo / THS / Baidu / CLS / Wallstreetcn / CCTV / SW | HTTP | Low | Financial statements, adjust factors, report lists, real-time futures, filings, consensus EPS, hot stocks and northbound, K-lines with MAs, live news, evening news, industry history |
| 4 | mootdx (TDX) | TCP 7709 | Never banned | Financial snapshots and F10 "latest notes" work; K-lines / order book / ticks return empty since 2026-09 (#52); ticks now come from Tencent §1.4 |
| 4 | baostock | TCP | Low (no registration) | Valuation history PE/PB/PS/PCF + turnover + suspension + ST + listing/delisting dates (no Beijing Exchange) |
| Key required | iwencai | OpenAPI | Low | NL semantic report search (the only source that needs a key) |
| last (exclusive only) | Eastmoney datacenter / push2 / reportapi / search / np-weblist | HTTP | Medium — has rate-limit risk | Dragon-tiger / lockup / margin / block trades / shareholders / dividends / fund flow / report PDFs / news / ST list / LPR / event-driven / convertibles (all via em_get()) |
All 34 sources
| # | Source | Main use |
|---|---|---|
| 1 | Tencent Finance | Live valuation, index / ETF, daily-weekly-monthly and minute K-lines |
| 2 | mootdx (TDX TCP) | Financial snapshots, F10 (quote commands broken, #52) |
| 3 | Eastmoney datacenter | Dragon-tiger, lockups, margin, block trades, shareholders, dividends, event-driven, convertibles, LPR |
| 4 | Eastmoney push2 / push2his | Industry boards, fund flow, stock info, ST list |
| 5 | iwencai | Natural-language report search (key required) |
| 6 | Eastmoney reportapi / PDF | Report lists, ratings, PDFs |
| 7 | THS hot stocks | Hot stocks and themes, limit-up insight, hot list |
| 8 | THS hsgtApi | Northbound flow |
| 9 | Baidu Finance | K-lines with moving averages |
| 10 | Sina Finance | Financial statements, adjust factors, ETF options, report lists, real-time futures, A50 |
| 11 | THS basic | Consensus EPS |
| 12 | CLS (Cailianpress) | Flash news |
| 13 | cninfo | Filings, IRM Q&A |
| 14 | SSE official | Dragon-tiger, order book, margin, ETF shares |
| 15 | SZSE official | Dragon-tiger, filings, order book, margin, trading calendar, ETF shares |
| 16 | baostock | Valuation history, listing/delisting dates, ST-list fallback |
| 17 | SW Research | Industry classification history |
| 18 | PBoC | Social financing |
| 19 | NBS | PMI |
| 20 | CSI | Constituents, weights, PE and dividend yield |
| 21 | CNI | Constituents, weights |
| 22 | BSE official | Current quotes and order book |
| 23 | TDX official end-of-day package | Full-market SSE/SZSE/BSE daily bars for a trading day (with turnover value) |
| 24 | Wallstreetcn | 7×24 live news, global macro calendar |
| 25 | CCTV | Xinwen Lianbo items and transcripts |
| 26 | SSE e-Interaction | Shanghai investor Q&A |
| 27 | ChinaBond | Government and credit yield curves |
| 28 | China Money (CFETS) | Repo fixing rates FR / FDR |
| 29 | SHFE | Futures / options daily, position rank |
| 30 | INE | Crude oil / international copper futures and options, position rank |
| 31 | CZCE | Futures / options daily, position rank |
| 32 | CFFEX | Index / bond futures, index options, position rank |
| 33 | GFEX | Industrial silicon / lithium carbonate futures and options daily |
| 34 | SGE | Gold / silver / platinum spot daily |
Architecture: Except mootdx and baostock (both TCP client libraries), all sources use direct HTTP API calls with no third-party data wrapper in between. Eastmoney APIs are rate-limited; all calls go through
em_get()for serial throttling. For batch jobs, increaseEM_MIN_INTERVAL.Fallback: When a primary source fails, check the "Backup Sources & Fallback Strategy" section in SKILL.md. Some core data types have independent backups on different domains with separate rate limits. Not every capability has a backup; always verify dates and completeness after fetching.
FAQ
Why are index weights not dated today? Can they be used for historical backtests?
Constituents and weights may be published on different dates. The CNI endpoint returns a month-end snapshot; date is the source date. Current membership is not historical membership. This release does not integrate adjustment history or substitute zero for missing index PB.
How do I run the two new backups?
Execute the full Layer 12 code block in SKILL.md, then the official margin/BSE backup block. Query margin data separately for SH and SZ; BSE requires the expected session date. Date mismatches, incomplete pagination and unpublished data raise errors.
mootdx returns no K-lines / tdx_client() says no server can return data (#52)
Tested on 2026-09-20 on each of the 10 built-in servers: all accept TCP connections and return financials and ex-rights data, F10 only returns the "latest notes" category, and K-lines, order books and ticks come back with 0 rows. This is a server-side change; switching mootdx versions does not help. Alternatives:
- SSE/SZSE daily / weekly / monthly K-lines (adjusted) and 1–60-minute bars → §1.2
tencent_kline()- Full-market SSE/SZSE/BSE daily bars for one trading day (with turnover value; the only daily-bar route for BSE) → §1.3
tdx_daily_package()- Live price and order book → §1.1 Tencent, or the official exchange books in the backup table
- Intraday ticks → §1.4
tencent_ticks()(latest trading day only, no BSE)- Financial snapshots / F10 "latest notes" →
tdx_client(check='finance'), which still works; the other 8 F10 categories (company profile, shareholders, etc.) are no longer returned — see SKILL.md §6.2 for replacementsIn K-line mode
tdx_client()probes servers first, so a full failure takes about a minute to raise.
Are easy_tdx (PR #54) and the official THS API included?
No. easy_tdx is another client for the same TDX protocol, not a new data source, and #52 is solved over HTTP, so PR #54 is not merged; this project only integrates sources it can query directly. The THS service requires a user key; auction integration needs Python 3.10+ compatibility work. See the v3.8.0 and v3.9.0 integration records (Chinese). V3.9 adds no installation dependencies.
Can I backtest with it? Does it work with JoinQuant? (#55)
This skill fetches data; it has no backtesting engine. Feed the data into your own framework or JoinQuant.
- Tickers:
norm_ticker()/get_prefix()accept JoinQuant codes600519.XSHG/000001.XSHE;to_joinquant()converts any supported form to JoinQuant codes. JoinQuant's public docs list no BSE suffix, so BSE codes raise an error instead of being guessed.- Adjustment: JoinQuant
get_pricedefaults to forward adjustment (fq='pre'). Compare against §1.2tencent_kline(adjust='qfq'), or apply the §1.6 adjust factors yourself.- Look-ahead bias: use §6.5 for historical valuation and §6.7 for historical industry membership; §12 index constituents are current snapshots only.
Is Eastmoney the only research-report source? (#53)
No. §2.4 sina_research_reports() is a second source that pages by stock or across the market and keeps working when Eastmoney blocks you. It has title, type, broker, analysts and date but no ratings or price targets; use Eastmoney reports or THS consensus for those.
Are commodity futures and options covered? What about DCE? (#49)
Yes, see Futures & Commodities. Official futures and options daily data come from SHFE, INE, CZCE, CFFEX and GFEX; member position rankings cover the first four (not GFEX). Sina real-time futures, FTSE China A50 and SGE spot are included too. DCE's website blocks scripted access, so its official daily quotes are not integrated; for DCE contracts such as soybean meal and iron ore use V3.10's futures_kline('M0') (Sina, continuous or single contract) for history and Sina real-time futures for live prices.
Why are cninfo IRM answers empty for Shanghai-listed companies?
cninfo IRM only covers Shenzhen-listed companies; Shanghai tickers return 0 rows. Use §10.3 sse_e_interaction() (SSE e-Interaction) for Shanghai. Some companies genuinely have no replies in the last month, so an empty table can be correct.
Verification
python3 -m unittest discover -s tests -v extracts the shipped code directly from SKILL.md and checks dates, fields, symbol routing, units, pagination and error propagation without network access (179 offline tests as of V3.10.2).
Live tests are opt-in; the date must be a trading day the sources have already published:
# V3.10's tick and futures K-line entries, plus the §1.2 K-line volume-unit check (downloads one TDX end-of-day package)
ASTOCK_LIVE_V310=1 python3 -m unittest tests.test_v310_sources -v
# the 25 entries added in V3.9 (31 live calls)
ASTOCK_LIVE_V39=2026-09-18 python3 -m unittest tests.test_v39_sources -v
# the V3.8 official margin and BSE backups
ASTOCK_LIVE_TRADE_DATE=2026-09-04 ASTOCK_LIVE_MARGIN_DATE=2026-09-03 python3 -m unittest tests.test_official_data -vPer-entry row counts and data boundaries are in the v3.9.0 integration record; V3.8 is in v3.8.0 (both Chinese).
Changelog
See CHANGELOG.md.
Disclaimer
This project provides data access tools only and does not constitute investment advice. Investing involves risk.
License
Author: Simon Lin · X @linsizhen · Email: [email protected]
File: docs/source-integration-v3.8.0.md
[Binary file]
File: docs/source-integration-v3.9.0.md
A 股数据源整合记录 · v3.9.0
调研:2026-09-19;实现与验收:2026-09-20。
基线:v3.8.0,GitHub main 提交 8e5985c。
本版处理的 issue / PR
| 编号 | 问题 | 处理 |
|---|---|---|
| #52 | mootdx 取不到 K 线 | 服务器端变化:内置 10 台逐台实测,TCP 都可达,财务 / 除权除息正常,F10 只剩「最新提示」一类,K 线 / 五档 / 逐笔返回 0 行。tdx_client(check='finance') 让财务类调用按财务快照 + F10 类别表验活;§6.2 改为先 F10C 列类别;K 线改走 §1.5 腾讯、§1.6 通达信官网盘后包 |
| #49 | 商品期货 / 期权 | 新增 Layer 13:五家期货交易所官方日行情与期权、四家(上期所 / 上期能源 / 郑商所 / 中金所)持仓排名,新浪实时期货(含大商所)、A50、上金所 |
| #53 | 研报只有东财一个来源 | 新增 §2.4 新浪研报列表 |
| #55 | 聚宽代码与回测 | norm_ticker() / get_prefix() 认 .XSHG / .XSHE;新增 to_joinquant();FAQ 写明本 skill 不带回测引擎 |
| PR #54 | 用 easy_tdx 替换 mootdx | 不合并。本项目只接直接可取的数据源,不引入同协议的另一个客户端库;#52 由 HTTP 路径解决 |
纳入本版
| 层 | 函数 | 数据提供方 | 与原版关系 | 数据边界 |
|---|---|---|---|---|
| 1 行情 | tencent_kline |
腾讯 | 已有源的新端点 | 沪深日周月前 / 后复权 + 1~60 分钟;不含北交所;前复权是等差口径,遇 ≤0 价格抛错 |
| 1 行情 | tdx_daily_package |
通达信官网 | 新源 | 某交易日沪深北全市场日线含成交额;实测 2022-01-04、2023-01-03 可取,2021-01-04 已没有,未逐日验证;2022-05-06 之前的包没有北交所 |
| 2 研报 | sina_research_reports |
新浪 | 已有源的新端点 | 只有列表,无评级与目标价;内置 6 秒间隔 |
| 4 资金面 | etf_shares |
上交所、深交所 | 已有源的新端点 | 上交所按日期,实测 2022-01-04 仍有 382 只、2023-01-03 有 446 只;深交所只有当前快照 |
| 5 新闻 | wallstreetcn_lives |
华尔街见闻 | 新源 | 按频道 7×24 快讯,可翻页 |
| 5 新闻 | cctv_news |
央视网 | 新源 | 新闻联播条目与文字稿,当晚约 20:00 后更新 |
| 6 基础 | st_stock_list |
东财(baostock 兜底) | 已有源的新端点 | 沪深京当日快照;东财不可达时退 baostock,只有沪深、无价格 |
| 10 舆情 | sse_e_interaction |
上证e互动 | 新源 | 只收沪市代码;公司近期无回复时返回空表 |
| 11 宏观利率 | chinabond_yield_curve |
中债 | 新源 | 国债 / 银行 AAA / 中短票 AAA;单次超 1 年官网静默返回 0 行,函数按 360 天切片。起点:国债 2006-03-01、中短票 2006-12-25、银行 2009-12-24,逐段核对日期、按起点核对返回的每一天曲线齐全(整天缺失无日历可判),all 按起点核对每天曲线是否齐全 |
| 11 宏观利率 | repo_fixing_rates |
中国货币网 | 新源 | FR 约近 3 年、FDR 约近 1 年 |
| 11 宏观利率 | lpr_history |
东财 | 已有源的新端点 | 1 年 / 5 年全历史 |
| 11 宏观利率 | macro_calendar |
华尔街见闻 | 复用新源 | 公布值 / 预期 / 前值 |
| 13 期货 | futures_daily |
上期所、上期能源、郑商所、中金所、广期所 | 5 个新源 | 大商所官网有 JS 反爬(HTTP 412),未接入 |
| 13 期货 | options_daily |
同上 | 复用新源 | 商品期权与股指期权;Delta 为交易所公布值;隐含波动率上期所 / 上期能源按系列、郑商所 / 广期所按合约;中金所两项都不公布(2026-09-18 实测 692 行全空) |
| 13 期货 | futures_position_rank |
上期所、上期能源、郑商所、中金所 | 复用新源 | 广期所、大商所未接 |
| 13 期货 | futures_realtime |
新浪 | 已有源的新端点 | 覆盖六家交易所,大商所品种只能走这里 |
| 13 期货 | a50_futures |
新浪 | 已有源的新端点 | 富时中国 A50 连续合约 |
| 13 期货 | sge_spot |
上金所 | 新源 | 黄金 / 白银 / 铂金现货日线 |
| 14 事件 | earnings_forecast · institution_survey · holder_trades · share_buyback · equity_pledge · ipo_calendar |
东财 datacenter | 已有源的新端点 | 统一严格模式:「返回数据为空」给空表,其他错误码抛错;equity_pledge 只覆盖沪深 |
| 15 可转债 | convertible_bonds |
东财 datacenter | 已有源的新端点 | 摘牌日不晚于今天才算已摘牌、上市日不晚于今天才算交易中(东财会提前填上未来的日期,2026-09-20 实测 113710 上市日为 09-23);退市板块转债(404xxx)没有上市日和摘牌日,按交易市场判为已摘牌;判断不了的标 unknown |
沿用仓库的能力入口计数:新增 25 个公共函数,60→85(主入口 55→80,备胎仍为 5);层数 12→15;来源 22→34。
新增 12 个来源:通达信官网、华尔街见闻、央视网、上证e互动、中债、中国货币网、上期所、上期能源、郑商所、中金所、广期所、上金所。
腾讯、新浪、东财、沪深交易所已在原来的 22 个来源里,不重复计数。to_joinquant() 是代码转换辅助函数,不计入。
可复查的端点发现线索
- AKShare:期货交易所日行情、持仓排名、上金所、中债、货币网等端点格式
- jing2uo/tdx2db:通达信官网盘后包地址与
.cod/.md1布局 - Xiaoyuan-Liu/national-team-position:上交所 ETF 份额归档接口
实现直接访问提供方域名,未增加这些项目作为依赖。
本机真实数据验证
运行环境:macOS,Python 3.9.6,2026-09-20。数据日期用 2026-09-18(周五)。
| 请求 | 返回行数 | 检查 |
|---|---|---|
tencent_kline("600519", start="2025-01-01") |
417 | 自动分段、日期去重 |
tencent_kline("300750", period="m5", count=96) |
96 | 分钟线换手率按基点 ÷100 |
tdx_daily_package("2026-09-18") |
52314 | 沪 27810 / 深 24128 / 京 376;600519 收盘 1257.12、000001 收盘 11.70、300750 收盘 301.95,与 tencent_kline(adjust='') 一致 |
tdx_daily_package("2022-01-04") |
21726 | 没有北交所文件,只返回沪深;深市 00/30 股票 2563 只都在,比现在少的是 19/10 开头的债券回购代码;000001 收盘 16.66、300750 收盘 568.88,与腾讯不复权一致 |
sina_research_reports("600519") |
38 | 标题、机构、研究员 |
sina_research_reports("920982") |
39 | 函数自动加 bj 前缀;只给数字时新浪返回「没有找到」 |
etf_shares("2026-09-18", "SH") |
912 | 上交所日度归档 |
wallstreetcn_lives("a-stock-channel", limit=50) |
50 | 频道与翻页游标 |
cctv_news("2026-09-18", with_content=False) |
14 | 条目列表 |
st_stock_list() |
208 | 沪 83 / 深 122 / 京 3;当次 push2 经代理失败,自动切到 push2delay |
sse_e_interaction("600519") / ("600000") |
0 / 4 | 600519 页面本身写着近 1 个月暂无回复 |
chinabond_yield_curve("2026-01-01", curve="all") |
534 | 三条曲线 |
repo_fixing_rates("FR") |
748 | 2023-09-18 至 2026-09-18 |
lpr_history() |
1537 | 1 年 / 5 年 |
macro_calendar("2026-09-14", "2026-09-20") |
195 | 公布值 / 预期 / 前值 |
futures_daily(d, ex) SHFE / INE / CZCE / CFFEX / GFEX |
238 / 63 / 243 / 28 / 48 | 上期所 / 上期能源 / 郑商所核对文件里的交易日;中金所 CSV 没有交易日列,用同目录 index.xml 每行的 tradingday 核对,并逐合约比对成交量 / 收盘价 / 持仓量(2010、2015、2022、2026 年实测两者逐合约一致);广期所行里没有交易日字段,核对它回显的请求参数(周六请求返回空表并报「非交易日」,不会回退到最近交易日) |
options_daily(d, "SHFE") / ("CFFEX") |
6546 / 692 | Delta、隐含波动率 |
futures_position_rank(d, "CFFEX", symbol="IF2610") |
20 | 前 20 名会员;全市场 8 个品种 440 行。2015-04-15 旧文件(排名段前还有会员类别合计段)120 行、只含当时已上市的 IF / TF / T;2010-04-16 首日 20 行 |
futures_realtime(["RB0", "M0", "IF0"]) |
3 | 含大商所豆粕 |
a50_futures() / sge_spot("Au99.99") |
1 / 2368 | |
earnings_forecast(report_date="2026-09-30") / institution_survey("688062", detail=True) / holder_trades(direction="减持", start="2026-09-01") / share_buyback(progress="实施中") / equity_pledge() / ipo_calendar(limit=30) |
108 / 500 / 311 / 371 / 2212 / 30 | 机构调研为单只股票的逐机构明细,其余为全市场;质押 2212 条中没有北交所 |
convertible_bonds() |
317 | 代码唯一,状态按上市日、摘牌日与交易市场判断;314 只交易中、3 只 upcoming,退市板块 5 只不在默认结果里 |
实现过程中实测发现并修复的问题(均已加回归测试):
- 腾讯 K 线对北交所只返回最新 1 根日线,区间和分钟线为空(920021 / 920982 / 920185)。函数改为遇北交所直接报错,指向 §1.6。
- 新浪研报查北交所必须写
bj920982,只给数字会得到「没有找到」空页,看起来像该股没有研报。 - 质押统计全市场 2212 条没有一只北交所;北交所代码改为报错,不返回空表。
- 2022-05-06 之前的通达信盘后包没有北交所文件(二分实测 2022-05-05 没有、2022-05-06 有),原实现会整包报错。
现在只对这之前的日期放行,之后缺北交所文件报错,不把沪深当成全市场。 - 盘后包不是只保留最近一段:最早能取到 2021-08-16(2021-08-02 返回 404),2022-01-04、2023-01-03 都能取到。
11 个包里各市场有价记录的最小值为沪 16202、深 3641(2022 年以前深市大部分代码当日无价)、京 87,函数按沪 1 万 / 深 3000 / 京 50 设下限,
代码表与行情块条数一致、代码和块序号都不重复、代码全是 6 位数字、价格与成交额没有 NaN / inf(11 个包实测均如此),函数对这几条都做了核对。 - 上交所 ETF 份额接口把每页压到 2000 条(请求 10000 也回
pageSize=2000),2026-09-18 共 912 条;函数要求条数等于pageHelp.total。 - 新浪研报每页序号都从 1 编起;翻过末页、以及没有研报的股票,页面都写「没有找到相关内容」。上证e互动问答为空时,公司维度写「近1个月暂无回复 / 暂无提问」,
全市场翻过末页写「暂时没有问答内容」。华尔街见闻宏观日历 31 周 5976 条没有重复 id。 - 中金所、广期所的数据地址只能走 HTTP:2026-09-20 用 curl 8.7.1 与 Python requests 实测,中金所 443 握手即断(SSL_ERROR_SYSCALL),
广期所 443 返回的是*.unionpayintl.com的证书。交易日靠来源自己核对:中金所日行情 / 期权用同目录index.xml,持仓排名用行内交易日,广期所用回显的请求参数。 - 通达信 F10 只剩「最新提示」一类(内置 10 台服务器逐台实测)。§6.2 示例原来写死 9 个类别名,请求不存在的类别时 mootdx 返回 dict,
切片直接 TypeError;现改为先用F10C列出实际类别,tdx_client(check='finance')同时核对财务快照、类别表里有「最新提示」、并实际读出非空正文(000001 实测 21494 字)。 - 上金所行情 7 个品种约 1.5 万条记录价格全是数字,无成交的时段填 0;函数剔除 0,空值 / NaN 报错。
- 广期所返回里没有
delivMonth的只有小计 / 总计行(2022-12-22、2026-09-18 实测;周六只回一行总计),合约行缺这个字段报错,不当成非交易日。
验证方法
python3 -m unittest discover -s tests -v离线测试从 SKILL.md 里取出发布代码直接执行(定义 get_prefix / norm_ticker / to_joinquant / em_get / bs_session / tdx_client 的代码块,加上 16 个 v39-* 标记块),不访问网络。tests/test_v39_sources.py 新增 115 条(114 条离线 + 1 条联网,联网默认跳过),覆盖 #52 验活分流、#55 聚宽代码、盘后包解析、腾讯三入口切换与实际来源、东财空结果与错误码区分及翻页不完整、网络与非 JSON 错误、来源数值与日期认不出、
宏观日历零值与整周缺失、东财翻页满页与总条数、深交所 ETF 与东财 clist 翻页途中快照变化、腾讯分段缺字段、ST 名单沪深与北交所都不能为空、上期所剔除能源品种的对照文件、
中金所已上市品种缺文件与表头列顺序、中金所日行情 index.xml 交易日核对、广期所请求回显、中债曲线段内日期与齐全性、宏观日历段内日期、
腾讯复权 key 优先与段内日期、深交所 / 东财页数总数拒收布尔值、东财 payload / data 结构、上证e互动公司列表结构与末页标记、盘后包压缩损坏、
盘后包各市场下限、代码格式、代码 / 序号唯一与非有限数值、腾讯与宏观日历重复条目、腾讯价格空值 / NaN 与行结构、事件驱动逐行核对筛选条件、上证e互动问答空结果提示、新浪研报整页解析、上交所 ETF 总数、
数值字段拒收布尔值、可选行列表的 falsy 结构、上期所 / 广期所 / 上金所 / 华尔街见闻快讯的返回结构、盘后包名称解码、上证e互动时间字段、ETF 份额与 LPR 的空值、品种字母与持仓排名表头、新浪无变量页、宏观日历参数、ST 名单只在连不上时退到 baostock、F10 验活(类别与正文)、参数组合检查(质押、期货实时、宏观日历区间)、可转债状态、显式沪市指数代码、北交所边界,以及 Python 3.9 语法。
每个修复都做过变异检查:把修复改回去,对应测试会失败。八轮审计的修复,加上三次复跑变异时自查发现的问题(腾讯行结构变成对象时会漏出 KeyError;分钟线与中债曲线的测试断言太宽,被逐行异常转换顶替),共 209 处,发布前在最终代码上复跑适用的 190 处:186 处全部失败;4 处改坏后仍被另一道检查拦住,属于双重保护(东财第 1 页空页检查被「非末页必须满页」拦住,质押按代码查询的指数代码拦截被 _em_event_filter 先拦住,期权 INSTRUMENTID 存在性检查被逐行读取加统一异常契约拦住,ST 名单改回 .get() 读字段被同一处的代码 / 市场号 / 名称校验拦住);其余 19 处针对的代码已在后续轮次重写,由新一轮变异覆盖。
联网测试需显式启用,日期须是源已发布数据的交易日:
ASTOCK_LIVE_V39=2026-09-18 python3 -m unittest tests.test_v39_sources -v本次没有重跑旧版 60 个入口的全部真实请求;它们的历史验证日期保留在原章节。
未接入
| 候选 | 原因 |
|---|---|
| 大商所官网日行情 | JS 挑战型反爬,纯 HTTP 返回 412;大商所品种用 futures_realtime |
| easy_tdx(PR #54) | 同一通达信协议的另一个客户端库,不是新的数据源 |
| 开盘啦 | App 私有接口,需要伪造设备号 |
| 乐咕市场宽度 | 第三方统计页面,字段抽取不稳定 |
| 需要注册或 Key 的平台 | 不符合零注册原则(iwencai 为历史例外) |
File: .github/FUNDING.yml
buy_me_a_coffee: simonlin1212
custom: