by rootSunc
中国股票数据基础设施,覆盖行情、研报、资金面、筹码、公告、龙虎榜、ETF/期权、舆情互动、基本面、行业板块、宏观与风险事件等核心数据。42+A股数据集,日更、自托管、MCP 原生,零注册、零 API Token
# Add to your Claude Code skills
git clone https://github.com/rootSunc/CNEquityLast scanned: 8/16/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-08-16T04:34:23.221Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}CNEquity is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by rootSunc. 中国股票数据基础设施,覆盖行情、研报、资金面、筹码、公告、龙虎榜、ETF/期权、舆情互动、基本面、行业板块、宏观与风险事件等核心数据。42+A股数据集,日更、自托管、MCP 原生,零注册、零 API Token. It has 183 GitHub stars.
Yes. CNEquity passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/rootSunc/CNEquity" and add it to your Claude Code skills directory (see the Installation section above).
CNEquity is primarily written in Python. It is open-source under rootSunc on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh CNEquity against similar tools.
No comments yet. Be the first to share your thoughts!
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
CNEquity 开源、免注册、自托管。它不负责给出交易信号,而是把分散在不同来源、不同口径、不同更新节奏的数据,长期保存在自己的机器或服务器上,并且说明每一行从哪里来、何时采到、截至哪一天可用。
发出一次 API 请求通常不是最费事的部分。真正困难的是长期保持研究口径一致:
幸存者偏差是一个直观例子。下面的实验使用同一个等权买入持有策略和同一段时间,唯一差别是历史股票池里是否保留后来退市的股票。只用今天仍在交易的股票时,2016–2021 年的收益从 5.9% 变成了 12.0%:
那些股票不是收益为零,而是根本没有进入计算。CNEquity 因此把退市股、复权因子、历史成分和 PIT(按当时可获得的信息取数)放在数据层里处理,而不是交给每个下游脚本临时拼接。
项目当前的主线是中国市场的 A 股研究,不追求把所有金融数据都收进来。已注册数据集覆盖:
当前注册表包含 42 个数据集:39 个 curated + 3 个 derived,按研究用途分为 L0–L8 九类。
| 层次 | 研究用途 | 代表数据集 |
|---|---|---|
| L0 | 基础参考 | 证券主数据、交易日历、交易状态 |
| L1 | 行情 | 日线、指数、复权因子、分钟线、分笔、退市事件 |
| L2 | 公司事件 | 公司行为、公告索引、预约披露 |
| L3 | 基本面 | 财报、估值、股本、股东、一致预期 |
| L4 | 资金面 | 北向、融资融券、龙虎榜、大宗交易、资金流 |
| L5 | 结构行业 | 指数成分、行业与板块成分 |
| L6 | 宏观 | 宏观指标、市场宽度 |
| L7 | 舆情与轮动 | 新闻、情绪、人气、板块行情与资金流 |
| L8 | 风险合规 | 解禁日程、监管事件 |
所有 curated 行都带有 source、data_version 和 fetched_at,可以追到来源和采集批次。分钟线、5 分钟线和分笔默认关闭,按需启用;部分只能获取当日快照的数据集不会被伪造成历史序列。
完整字段、主键、历史模式和源端限制见数据集目录。
events:* 是 7×24 事件流组:公告和资讯周末也发,由 cne run events 按自然日跑,
不受交易日门禁限制(见配置 · 事件流调度组)。
| 数据集 | 说明 | 主源 | 备源 | 历史 | 调度组 |
|---|---|---|---|---|---|
| L0 · 基础参考 | |||||
instruments |
证券主数据 | tdx_protocol | baostock | 可回补 | core |
trading_calendar |
交易日历 | tdx_protocol | exchange | 可回补 | core |
trading_status |
交易状态(停复牌/ST) | tdx_protocol | eastmoney | 可回补 | core |
| L1 · 行情 | |||||
adj_factors |
复权因子 | sina | — | 可回补 | — |
commodity_bars ○ |
商品期货主连 | sina | eastmoney | 可回补 | macro_risk |
daily_bars |
日线 | tdx_protocol | eastmoney | 可回补 | core |
delisting_events |
退市事件 | derived | — | 可回补 | — |
index_bars |
指数日线 | tdx_protocol | eastmoney | 可回补 | core |
minute_bars ○ |
1 分钟线 | tdx_protocol | — | 可回补 | intraday |
minute_bars_5m ○ |
5 分钟线 | tdx_protocol | — | 可回补 | intraday |
trade_ticks ○ |
分笔快照 | tdx_protocol | — | 可回补 | ticks |
| L2 · 公司事件 | |||||
announcement_index |
公告索引 | cninfo | — | 可回补 | events:disclosures |
corporate_actions |
公司行为 | eastmoney | tdx_protocol | 可回补(回填走 tdx_protocol) |
core |
earnings_disclosure_schedule |
业绩披露预约 | eastmoney | — | 可回补 | fundamentals |
| L3 · 基本面 | |||||
analyst_consensus |
分析师一致预期 | eastmoney | — | 仅当日 | research |
financial_statement_items |
财务报表科目 | eastmoney | — | 可回补 | fundamentals |
share_structure |
股本结构 | eastmoney | — | 可回补 | fundamentals |
shareholder_counts |
股东户数 | eastmoney | — | 可回补 | fundamentals |
top_holders |
前十大股东 / 流通股东 | eastmoney | — | 可回补 | 按需回填 |
valuation_metrics |
估值指标 | eastmoney | — | 回填 baostock |
capital |
| L4 · 资金面 | |||||
block_trades |
大宗交易 | eastmoney | — | 可回补 | signals |
dragon_tiger |
龙虎榜 | eastmoney | — | 可回补 | signals |
fund_flow |
个股资金流 | eastmoney | — | 仅当日 | capital |
institutional_holdings |
机构持股 | eastmoney | — | 可回补 | research |
margin_trading |
融资融券 | exchange | — | 可回补 | capital |
northbound_flows |
北向资金流向 | eastmoney | — | 可回补 | capital |
northbound_holdings |
北向持股 | eastmoney | — | 可回补 | capital |
| L5 · 结构行业 | |||||
index_constituents |
指数成分 | eastmoney | — | 回填 cni |
fundamentals |
industry_index |
行业指数 | derived | — | 可回补 | — |
industry_members |
行业分类成分 | eastmoney | — | 回填 sw |
fundamentals |
sector_members |
板块成分 | eastmoney | — | 仅当日 | capital |
| L6 · 宏观 | |||||
macro_indicators |
宏观指标 | eastmoney | pboc | 可回补 | macro_risk |
market_breadth |
市场宽度 | derived | — | 可回补 | macro_risk |
| L7 · 舆情 / 轮动 | |||||
economic_calendar ○ |
经济日历 | eastmoney | — | 仅当日 | — |
flash_news_wire |
7×24 快讯 | eastmoney | — | 仅当日 | events:news_wire |
hot_rank |
人气榜 | eastmoney | — | 仅当日 | research |
news_headlines |
新闻标题 | eastmoney | — | 仅当日 | events:news_wire |
sector_bars |
板块行情 | ths | — | 回填 ths |
research |
sector_fund_flow |
板块资金流 | eastmoney | — | 仅当日 | research |
sentiment_scores |
情绪评分 | derived | eastmoney | 可回补 | research |
| L8 · 风险合规 | |||||
regulatory_events |
监管事件 | cninfo | — | 可回补 | events:regulatory |
share_unlock_schedule |
解禁日程 | eastmoney | — | 可回补 | macro_risk |
○ 表示可选数据集,空表不算异常。逐项说明见数据集目录,源端限制见数据源说明。
CNEquity 适合需要反复使用同一份历史数据的研究和数据工作:
如果只是查一只股票的最新价格,直接调用数据接口通常更轻。这个项目更适合需要持续积累、反复查询和复查结果的场景。
需要 Python 3.10+,无需 token、积分或账号:
pip install cnequity
cne demo
cne demo 默认拉取 5 只股票最近约 30 个交易日的真实数据,写入独立目录 data/cnequity-demo/,不会覆盖正式数据湖。需要能访问 TDX 行情主机;如果连接失败,可以先检查:
cne sources probe --only tdx_protocol
完全无法连接 TDX 时,运行 cne demo --sample,可离线验证安装、Parquet 落盘和查询链路。合成行全部标记为 source=mock,不可用于研究。
然后在 Python 中读取:
from cnequity.query import load
bars = load("daily_bars", data_root="data/cnequity-demo")
print(bars.tail())
想直接比较原始价格与后复权口径:
cne demo --research --symbols 600519.SH
pip install cnequity
cne config init # 生成 configs/cnequity.toml
cne init # 全市场标的,默认回溯最近 3 年
cne run daily # 之后每个交易日执行这一条
默认策略是“浅而不窄”:历史先取最近 3 年,但全市场标的一个不缺。这样不会因为只保留今天仍上市的股票,提前把幸存者偏差写进数据湖。每个数据集的真实起点会记录在 coverage_start。
需要更长历史时可以一次拉满,也可以以后补深:
cne init --profile full
# 或对单个数据集补历史
cne backfill daily_bars --start 2016-01-01 --end <coverage_start>
默认初始化通常是小时级、GB 级,实际取决于网络、数据源状态和机器配置。详细安装说明见快速开始和安装指南。
| 研究问题 | 推荐入口 |
|---|---|
| 茅台过去五年复权后涨了多少 | load("daily_bars", symbols=[...], adjust="hfq") |
| 茅台 PE 在自身五年历史中的分位数 | valuation_metrics + 窗口分位 |
| 2018 年财报因子的 IC,且不使用未来数据 | load("financial_statement_items", as_of="2018-04-30") |
| 退市股退市前 60 天的价格形态 | delisting_events + daily_bars |
| 三年前的沪深 300 成分或申万行业 | index_constituents · industry_members |
| 今天的龙虎榜、未来解禁和板块资金流 | dragon_tiger · share_unlock_schedule · sector_fund_flow |
常用查询:
from cnequity.query import load
bars = load(
"daily_bars",
start="2020-01-01",
end="2025-12-31",
symbols=["600519.SH"],
adjust="hfq",
)
roe = load(
"financial_statement_items",
items=["roe"],
as_of="2024-04-30",
)
架构上的边界比较简单:适配器负责把多源数据取回来;编排层负责 DAG、批次和重试;数据先进入 staging,再压实为 curated 并计算 derived;质量层持续审计;查询和服务层只读消费。展开见架构说明。
cne run daily # 执行当天全部日更分组
cne status # 查看 FRESH / STALE / EMPTY
cne serve # 打开 http://127.0.0.1:8787
cne sources probe # 检查上游数据源健康度
cne retry --run-id <run_id> # 只重试失败批次
cne retry --failed-groups # 重试各 daily 分组最新的失败 run
单个 step 失败时,系统会记录 failed batch,其他步骤继续落盘;重试不会把整条任务重新跑一遍。浏览器控制台可以查看覆盖、新鲜度、容量、跑批和质量结果。
挂入 crontab 即可自动日更:
# 交易日收盘后执行;非交易日会自动跳过
30 16 * * 1-5 cd /path/to/lake && cne run daily >> logs/daily.log 2>&1
cne mcp 以只读方式把本地湖提供给模型;采集、重试和清理仍由 CLI 完成。
cne mcp --config "$(pwd)/configs/cnequity.toml"
把上面的命令作为 MCP server 注册到任意兼容客户端即可。大多数客户端使用等价的配置(客户端名称和界面可能不同):
{
"mcpServers": {
"cnequity": {
"command": "cne",
"args": ["mcp", "--config", "/abs/path/to/cnequity.toml"]
}
}
}
--config 必须使用绝对路径。接好后可以直接问:
还没有正式湖时,可以先运行 cne demo,再使用生成的 demo 配置。完整说明见MCP 参考。
A