← Back to Skills Marketplace
clementgu

🐂 UnifiedStock — 多源统一股票数据接口

by Clement Gu · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
55
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install stock-unified
Description
多源统一股票数据接口,整合通达信(pytdx)/同花顺/东方财富(新版API)/akshare五大股票数据源,自动降级切换。用于A股实时行情查询、K线历史、板块排行与成分股、财务数据、板块搜索等场景。当用户查询股价、板块排行、成分股、K线、财务数据时使用。
README (SKILL.md)

🐂 UnifiedStock — 多源统一股票数据接口

A股 5 大数据源自动整合:通达信(pytdx) + 东方财富(新版datacenter API) + 同花顺(ths) + akshare + 新浪财经。

安装依赖

pip install pytdx akshare requests pandas

数据源自动降级策略

实时行情:    通达信(pytdx) → akshare
K线历史:    通达信(pytdx) → akshare
板块排行:    同花顺(ths) → akshare
板块成分股:  东方财富(datacenter) → akshare
财务数据:    akshare

每个源挂了自动换下一个,无需手动指定。

快速上手指南

1️⃣ 查实时行情

python3 scripts/unified_stock.py --realtime 600839,002156,002475

输出:代码、最新价、涨跌幅、昨收、开盘、最高、最低、成交量

2️⃣ 查K线

python3 scripts/unified_stock.py --kline 600839 --days 30

默认最近 10 天,支持任意天数。

3️⃣ 板块排行

python3 scripts/unified_stock.py --sector-top 20

输出行业板块 Top N:涨跌幅、涨跌家数、资金净流入、领涨股。

4️⃣ 板块成分股

# 先搜板块代码
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️⃣ 财务数据

python3 scripts/unified_stock.py --financial 600839

6️⃣ JSON 输出

所有命令支持 --json 参数,方便程序调用:

python3 scripts/unified_stock.py --realtime 600839 --json
python3 scripts/unified_stock.py --sector-top 10 --json

7️⃣ 数据源检测

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:

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()
Usage Guidance
This appears safe for ordinary stock-data lookup. Use a Python virtual environment for the dependencies, expect outbound network access to financial-data providers, and review the full script/package if you need high assurance because the displayed source excerpt was truncated.
Capability Analysis
Type: OpenClaw Skill Name: stock-unified Version: 1.0.0 The skill bundle provides a legitimate unified interface for Chinese stock market data, integrating sources like Tongdaxin (pytdx), EastMoney, and AkShare. The main script `scripts/unified_stock.py` implements standard data fetching logic using well-known financial APIs and libraries, with no evidence of malicious behavior, data exfiltration, or prompt injection. The hardcoded IP (60.12.136.250) is a recognized public Tdx server commonly used in the financial analysis community.
Capability Assessment
Purpose & Capability
The stated purpose is A-share stock quote, K-line, sector, and financial-data lookup, and the visible code implements read-only market-data retrieval from named public data sources.
Instruction Scope
The documented commands are user-directed CLI/API calls for specific stock symbols, sectors, status checks, and JSON output; there is no evidence of hidden autonomous actions or goal redirection.
Install Mechanism
There is no install spec, but SKILL.md instructs users to install unpinned Python packages with pip. This is common for a Python data tool but means users rely on current package-index versions.
Credentials
The skill contacts external financial-data providers, including pytdx/通达信, 东方财富, 同花顺/akshare, and 新浪财经. This is proportionate to its purpose, but queried symbols and search terms may be sent to those services.
Persistence & Privilege
The provided artifacts show no credential requirements, background persistence, privileged operations, local indexing, destructive actions, or account mutation.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install stock-unified
  3. After installation, invoke the skill by name or use /stock-unified
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
首发版本: 整合通达信/东方财富/同花顺/akshare五大数据源,统一实时行情/板块/财务接口,自动降级切换
Metadata
Slug stock-unified
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 🐂 UnifiedStock — 多源统一股票数据接口?

多源统一股票数据接口,整合通达信(pytdx)/同花顺/东方财富(新版API)/akshare五大股票数据源,自动降级切换。用于A股实时行情查询、K线历史、板块排行与成分股、财务数据、板块搜索等场景。当用户查询股价、板块排行、成分股、K线、财务数据时使用。 It is an AI Agent Skill for Claude Code / OpenClaw, with 55 downloads so far.

How do I install 🐂 UnifiedStock — 多源统一股票数据接口?

Run "/install stock-unified" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 🐂 UnifiedStock — 多源统一股票数据接口 free?

Yes, 🐂 UnifiedStock — 多源统一股票数据接口 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 🐂 UnifiedStock — 多源统一股票数据接口 support?

🐂 UnifiedStock — 多源统一股票数据接口 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 🐂 UnifiedStock — 多源统一股票数据接口?

It is built and maintained by Clement Gu (@clementgu); the current version is v1.0.0.

💬 Comments