agentsclimarketplace

Astock data source

Skill ZICXR/A-Stock-Skills/skills/01-infra/astock-data-source

A 股多源数据源统一管理 (v2.0 - 多源 fallback)。当用户需要获取股票行情/K线/财务数据/新闻/公告/资金流等任何 A 股数据,或需要稳定的 API 封装 (含自动重试/限流/降级/缓存) 时,Claude 应优先使用此 Skill。这是其他所有 Skill 的基础数据源。**v2.0 已修复住宅 IP 数据源问题**。From its SKILL.md

Install
npx -y skills add ZICXR/A-Stock-Skills --skill astock-data-source

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 17 stars17 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
  • runs commandsInstructs the agent to run 4 commands, including `python main.py healthcheck` and 3 more.

SKILL.md

3.0 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

A 股多源数据源管理 Skill (v2.0)

何时使用

  • 用户需要获取股票数据
  • 用户需要稳定的 API 封装
  • 用户在住宅网络环境下使用
  • 任何需要 A 股数据的 Skill

⚠️ 重要更新 (v2.0)

修复了住宅 IP 数据源被封问题:

优先级数据源实测可用备注
1️⃣ifzq gtimg (腾讯)✅ 90%+住宅 IP 首选
2️⃣新浪 hq.sinajs.cn✅ 80%+全市场列表也用这个
3️⃣东财 push2.eastmoney❌ 30%经常被封, 仅作备用
4️⃣akshare✅ 85%聚合源, fallback

自动 fallback 机制:

  • 每个数据源连续失败 3 次自动跳过
  • 支持多源切换, 不再硬抛"所有数据源失败"
  • 修复了 Windows GBK 编码问题
  • 修复了 akshare 内部代理问题

🏃 快速验证 (网络环境测试)

# 测试你的网络环境
python main.py healthcheck

# 输出示例:
# === 数据源健康检查 ===
#   ✅ ifzq_gtimg
#   ✅ sina_hq
#   ❌ eastmoney_push2 (被风控, 已自动跳过)
#   ✅ sina 全市场: 5028 只

提供能力

行情

  • get-realtime --code X - 单股实时 (多源)
  • get-realtime-all - 全 A 股实时 (用新浪)
  • get-kline --code X --days N - K 线 (用 ifzq)

指数

  • get-index-realtime - 主要指数
  • get-index-kline --symbol X - 指数 K 线

其他

  • get-stock-info --code X - 股票信息
  • get-news --code X - 个股新闻
  • healthcheck - 数据源健康检查

使用方式

命令行 (新规范)

# ✅ 正确: 用 --code 命名参数
python main.py get-realtime --code 601991
python main.py get-kline --code 601991 --days 60

# ✅ 正确: --list 列出方法
python main.py --list

# ❌ 旧版 (已废弃): 位置参数
python main.py get-realtime 601991

Python API

from skills.01-infra.astock-data-source.main import (
    get_realtime, get_realtime_all, get_kline
)

# 单股 (自动多源 fallback)
quote = get_realtime("601991")

# 全 A 股
all_stocks = get_realtime_all()

# K 线
df = get_kline("601991", days=60)

故障速查

现象原因解决
ProxyError: 7890代理挡住外网切到 ifzq/sina
RemoteDisconnected东财被封等待 3 次后自动切
UnicodeEncodeError (Win)GBK 编码已自动修复
所有数据源失败网络隔离运行 healthcheck 检查

依赖

requests>=2.28.0
akshare>=1.12.0
pandas>=1.5.0

实测状态

  • 2026-06-21: 住宅 IP 验证通过, ifzq + sina 稳定可用
  • 2026-05-03: 旧版在住宅 IP 100% 失败 (已修复)

What ships with it: 4 files

24.1 KB alongside SKILL.md, 1 of them executable

references/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.