stock-unified
多源统一股票数据接口,整合通达信(pytdx)/同花顺/东方财富(新版API)/akshare五大股票数据源,自动降级切换。用于A股实时行情查询、K线历史、板块排行与成分股、财务数据、板块搜索等场景。当用户查询股价、板块排行、成分股、K线、财务数据时使用。 Skill: stock-unified Owner: clementgu Summary: 多源统一股票数据接口,整合通达信(pytdx)/同花顺/东方财富(新版API)/akshare五大股票数据源,自动降级切换。用于A股实时行情查询、K线历史、板块排行与成分股、财务数据、板块搜索等场景。当用户查询股价、板块排行、成分股、K线、财务数据时使用。 Tags: latest:1.0.2 Version history: v1.0.2 | 2026-10-09T00:12:34.149Z | auto - Removed skill-card.md file. - Made changes to scripts/unified_stock.py. - No user-facing features changed; primarily maintenance and cleanup. v1.0.1 | 2026-07-23T05:
Rank
62
Safety
84
Downloads
1.1k
Updated
Oct 11, 2026
Version
1.0.2
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 11, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 11, 2026
- Adoption signal
- 1.1K downloadsadoption · observed Oct 11, 2026
- Latest release
- 1.0.2release · observed Oct 9, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s17fsz3rx9wrnw593kpx5w87jn85c6qc:stock-unified- Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-clementgu-stock-unified/snapshot"
Documentation
CLAWHUB
18,514 characters of source documentation, loaded on request.
Extracted files
4 files captured from the source.
SKILL.md
---
name: stock-unified
description: 多源统一股票数据接口,整合通达信(pytdx)/同花顺/东方财富(新版API)/akshare五大股票数据源,自动降级切换。用于A股实时行情查询、K线历史、板块排行与成分股、财务数据、板块搜索等场景。当用户查询股价、板块排行、成分股、K线、财务数据时使用。
---
# 🐂 UnifiedStock — 多源统一股票数据接口 v3.0
A股 5 大数据源自动整合:通达信(pytdx) + 东方财富(新版datacenter API) + 同花顺(ths) + akshare + 新浪财经。
**🆕 v3.0 更新**:
- ✅ 实时行情改新浪优先(快+稳),通达信补充交易时段数据
- ✅ 指数代码支持:000001→上证指数、399001→深证成指、399006→创业板指等
- ✅ 开盘前智能显示:⏰ 未开盘 + 昨收价,不再空白
- ✅ 上证的盘前参考价自动识别并显示
## 安装依赖
```bash
pip install pytdx akshare requests pandas
```
## 数据源自动降级策略
```
实时行情: 新浪财经(sina) → 通达信(pytdx) → akshare
K线历史: 通达信(pytdx) → akshare
板块排行: 同花顺(ths) → akshare
板块成分股: 东方财富(datacenter) → akshare
财务数据: akshare
```
每个源挂了自动换下一个,无需手动指定。
## 快速上手指南
### 1️⃣ 查实时行情(支持股票+指数)
```bash
python3 scripts/unified_stock.py --realtime 000001,600839,002156
```
⚠️ `000001` 自动识别为上证指数(不是平安银行), `399001` → 深证成指
输出:代码、最新价、涨跌幅、昨收、成交量、未开盘标记
### 2️⃣ 查K线
```bash
python3 scripts/unified_stock.py --kline 600839 --days 30
```
默认最近 10 天,支持任意天数。
### 3️⃣ 板块排行
```bash
python3 scripts/unified_stock.py --sector-top 20
```
输出行业板块 Top N:涨跌幅、涨跌家数、资金净流入、领涨股。
### 4️⃣ 板块成分股
```bash
# 先搜板块代码
python3 scripts/unified_stock.py --search 半导体
# 再查成分股
python3 scripts/unified_stock.py --sector-stocks 917
python3 scripts/unified_stock.py --sector-stocks 917 --live # 带实时行情
```
板块代码说明:917=半导体概念, 891=国产芯片, 952=第三代半导体, 1137=存储芯片
### 5️⃣ 财务数据
```bash
python3 scripts/unified_stock.py --financial 600839
```
### 6️⃣ JSON 输出
所有命令支持 `--json` 参数,方便程序调用:
```bash
python3 scripts/unified_stock.py --realtime 600839 --json
python3 scripts/unified_stock.py --sector-top 10 --json
```
### 7️⃣ 数据源检测
```bash
python3 scripts/unified_stock.py --status
```
## 板块代码参考(常用)
| 代码 | 板块 | 成分股数 |
|------|------|---------|
| 917 | 半导体概念 | ~480 |
| 891 | 国产芯片 | ~250 |
| 952 | 第三代半导体 | ~150 |
| 1137 | 存储芯片 | ~80 |
| 1037 | 消费电子 | ~200 |
| 1201 | 电子 | ~300 |
可用 `--search` 搜索任意关键词找到代码。
## 架构
```
统一入口 unified_stock.py
├── 实时行情 → tdx_get_quotes() [通达信]
├── K线 → tdx_get_kline() [通达信]
├── 板块排行 → ths_industry_summary() [同花顺]
├── 板块成分股 → east_get_board_stocks() [东方财富]
├── 财务数据 → ak_get_financial() [akshare]
└── 状态检测 → get_status() [全部源]
```
Python API:
```python
from unified_stock import get_realtime, get_kline, get_sector_top, get_sector_stocks
# 查行情
quotes = get_realtime(["600839", "002156", "002475"])
# 查K线
kline = get_kline("600839", days=30)
# 板块排行
sectors = get_sector_top(20)
# 板块成分股(带实时价)
stocks = get_sector_stocks("917", live=True)
# 数据源状态
status = get_status()
```_meta.json
{
"ownerId": "kn7ey9xh63pt0m136bgmx0s67n85dkt5",
"slug": "stock-unified",
"version": "1.0.2",
"publishedAt": 1791504754149
}references/data_sources.md
# 数据源参考 ## 数据源映射 | 数据源 | 库/协议 | 功能 | 状态 | |--------|---------|------|------| | **通达信** | pytdx (TCP:7709) | 实时行情、K线、五档盘口 | ✅ 稳定 | | **东方财富** | datacenter API (HTTPS) | 板块成分股(1500+板块) | ✅ 新版API | | **同花顺** | akshare _ths 系列 | 板块排行、板块详情 | ✅ 稳定 | | **akshare** | HTTP | 财务数据、排名、IPO等 | ✅ 通用 | ## API端点备忘 ### 东方财富新版API ``` 端点: https://datacenter.eastmoney.com/api/data/v1/get 报表: RPT_BOARD_CONSTITUENT 字段: BOARD_CODE,BOARD_NAME,SECURITY_CODE,SECUCODE 筛选: filter=(BOARD_CODE="917") ``` ### 通达信 ``` 主机: 60.12.136.250:7709 (自动探测最佳服务器) ``` ## 已知限制 1. **盘前实时行情为0** (09:30-15:00 才有数据) 2. 同花顺板块数据约延迟 5 分钟 3. 东方财富 datacenter API 每日请求限制
skill-card.md
## Description: Retrieves Chinese stock and sector quotes, historical prices, and financial data through multiple public market-data providers with automatic fallback. This skill is ready for commercial/non-commercial use. ## Publisher: [clementgu](https://clawhub.ai/user/clementgu) ### License/Terms of Use: MIT-0 ## Use Case: Agents and developers use this skill to look up Chinese stock and index prices, historical candles, sector rankings and constituents, and financial data. Additional commands cover ETFs, futures, and market breadth. ### Deployment Geography for Use: Global ## Known Risks and Mitigations: Risk: Market-data queries send requested symbols and network metadata to external finance providers. Mitigation: Use only where outbound requests to those providers are acceptable; avoid querying sensitive holdings or watchlists. Risk: Additional finance commands are not fully described in the skill overview. Mitigation: Review the script help before enabling or relying on those commands. Risk: Provider data can be delayed, unavailable, or subject to request limits. Mitigation: Check timestamps and corroborate important figures with an authoritative market source before acting. ## Reference(s): - [ClawHub stock-unified release](https://clawhub.ai/clementgu/skills/stock-unified) - [Data source reference](references/data_sources.md) - [Eastmoney market-data endpoint](https://datacenter.eastmoney.com/api/data/v1/get) ## Skill Output: **Output Type(s):** [Text, JSON] **Output Format:** [Plain text tables or JSON] **Output Parameters:** [1D] **Other Properties Related to Output:** [Market-data results depend on provider availability and may be delayed.] ## Skill Version(s): 1.0.2 (source: ClawHub release evidence) ## Ethical Considerations: Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/clementgu/skills/stock-unified",
"sourceUrl": "https://clawhub.ai/clementgu/skills/stock-unified",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T10:39:08.677Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-clementgu-stock-unified/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-clementgu-stock-unified/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-11T10:39:08.677Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.1K downloads",
"href": "https://clawhub.ai/clementgu/stock-unified",
"sourceUrl": "https://clawhub.ai/clementgu/stock-unified",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-11T10:39:08.677Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.0.2",
"href": "https://clawhub.ai/clementgu/stock-unified",
"sourceUrl": "https://clawhub.ai/clementgu/stock-unified",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-10-09T00:12:34.149Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-clementgu-stock-unified/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-clementgu-stock-unified/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.0.2",
"description": "- Removed skill-card.md file. - Made changes to scripts/unified_stock.py. - No user-facing features changed; primarily maintenance and cleanup.",
"href": "https://clawhub.ai/clementgu/stock-unified",
"sourceUrl": "https://clawhub.ai/clementgu/stock-unified",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-10-09T00:12:34.149Z",
"isPublic": true
}
]
}Record generated Oct 11, 2026.
