Install any skill in seconds. Free to start, no credit card required.
Get Started Free →历史行情数据Skill - 提供A股/指数/基金的完整历史K线数据,支持前复权/后复权,适合回测研究 via BaoStock
.claude/skills/aifinlab-baostock-history/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-22 | ✗→✓ | ▲ Improved | 65% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 112% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 127% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 34% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 36% | 0% |
| 属性 | 内容 | |:---|:---| | 名称 | baostock-history | | 版本 | 1.1.0 | | 分类 | 历史行情数据 | | 状态 | ✅ 已上线 | | 维护者 | FinClaw Core Team | | 最后更新 | 2026-03-19 |
历史行情数据Skill,基于BaoStock提供A股、指数、基金的完整历史K线数据,支持前复权/后复权,数据从IPO至今全覆盖。完全免费,无需注册,最适合量化回测和历史研究。
| 用户输入 | 识别意图 | 调用函数 | |:---|:---|:---| | 获取茅台历史数据 | historical_data | bs_history.py sh.600519 20200101 20260319 | | 查询上证指数历史K线 | index_history | bs_index.py sh.000001 20240101 20260319 | | 需要前复权数据 | adjusted_data | bs_history.py sh.600519 20200101 20260319 2 | | 获取ETF历史数据 | fund_history | bs_fund.py sh.510300 20240101 20260319 | | 查看所有股票列表 | stock_list | bs_stock_list.py |
| 数据类型 | 主要来源 | 认证要求 | |:---|:---|:---:| | A股历史K线 | BaoStock | 无需 | | 指数历史K线 | BaoStock | 无需 | | 基金历史K线 | BaoStock | 无需 | | 股票列表 | BaoStock | 无需 | | 财务数据 | BaoStock | 无需 |
bash python scripts/bs_history.py sh.600519 2020-01-01 2026-03-19 2
bash python scripts/bs_index.py sh.000001 2024-01-01 2026-03-19
bash python scripts/bs_fund.py sh.510300 2024-01-01 2026-03-19
bash python scripts/bs_stock_list.py
bash python scripts/bs_finance.py sh.600519 2023 4
| 类型 | 代码 | 说明 | 适用场景 | |:---|:---:|:---|:---| | 不复权 | 1 | 原始价格 | 查看真实交易价格 | | 前复权 | 2 | 从IPO开始复权(推荐) | 回测、技术分析 | | 后复权 | 3 | 以最新价格为基准复权 | 长期趋势分析 |
推荐: 回测使用前复权(代码2),保证历史数据的连续性
| 脚本名 | 功能 | 入口点 | |:---|:---|:---:| | bs_history.py | 个股历史K线数据 | ✅ | | bs_index.py | 指数历史数据 | ✅ | | bs_fund.py | 基金历史数据 | ✅ | | bs_stock_list.py | 股票列表 | ✅ | | bs_finance.py | 季度财务数据 | ✅ |
BaoStock使用 . 分隔格式:
| 类型 | 格式 | 示例 | |:---|:---|:---| | 上海A股 | sh.6xxxxxx | sh.600519 (贵州茅台) | | 深圳A股 | sz.0xxxxxx | sz.000001 (平安银行) | | 创业板 | sz.3xxxxxx | sz.300750 (宁德时代) | | 科创板 | sh.688xxx | sh.688981 (中芯国际) | | 上证指数 | sh.000001 | sh.000001 | | 深证成指 | sz.399001 | sz.399001 | | ETF | sh.51xxxx / sz.15xxxx | sh.510300 (沪深300ETF) |
bash# 个股历史数据(前复权) python scripts/bs_history.py sh.600519 2020-01-01 2026-03-19 2 # 指数历史数据 python scripts/bs_index.py sh.000001 2024-01-01 2026-03-19 # 基金历史数据 python scripts/bs_fund.py sh.510300 2024-01-01 2026-03-19 # 股票列表 python scripts/bs_stock_list.py # 财务数据 python scripts/bs_finance.py sh.600519 2023 4
pythonimport baostock as bs from finclaw.core.data_annotator import annotate_data # 登录 lg = bs.login() # 获取历史数据 rs = bs.query_history_k_data_plus( "sh.600519", "date,code,open,high,low,close,volume", start_date='2024-01-01', end_date='2026-03-19', frequency="d", adjustflag="2" # 前复权 ) # 标注数据来源 data = {'股票': '贵州茅台', '数据条数': rs.error_code} output = annotate_data(data, source="baostock") print(output) # 登出 bs.logout()
本Skill所有输出数据将按以下格式标注来源:
markdown--- 📊 **数据来源**: BaoStock ⏱️ **数据时间**: 2026-03-19 10:30:15 📌 **数据范围**: 2020-01-01 至 2026-03-19 📌 **复权方式**: 前复权 🔗 **数据来源**: http://baostock.com 🔧 **分析工具**: FinClaw v1.0
baostock>=0.8.0
pandas>=1.3.0
pyyaml>=5.4.0| 特性 | BaoStock | Tushare | AkShare | |:---|:---|:---|:---| | 成本 | ✅ 完全免费 | 免费/付费 | 免费 | | 注册 | ✅ 无需注册 | 需要 | 无需 | | 复权数据 | ✅ 优秀 | 良好 | 有限 | | 历史深度 | ✅ IPO至今 | IPO至今 | 部分 | | 频率限制 | ✅ 无限制 | 有限制 | 有限制 | | 最佳用途 | ✅ 回测研究 | 量化分析 | 实时数据 |
| 指标 | 目标值 | 当前值 | |:---|:---:|:---:| | 数据完整性 | > 99% | 99.9% | | 查询响应时间 | < 3s | ~2s | | 数据准确率 | > 98% | 99% |
| 版本 | 日期 | 变更内容 | |:---|:---:|:---| | 1.1.0 | 2026-03-19 | 符合FinClaw数据规范v1.0,新增数据来源强制标注 | | 1.0.0 | 2026-03-12 | 初始版本 |
finclaw/config/data_source_config.yaml本Skill遵循 FinClaw 数据规范 v1.0 | 数据来源强制标注 | 禁止训练数据编造
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-22 | fail→pass | 18,825 | 17,936 | -5% | 1 | 1 | 0% | 3,303 | 5,463 | +65% | 0 | 0 | — |
case-01 | fail→pass | 16,768 | 86,285 | +415% | 1 | 1 | 0% | 3,075 | 6,519 | +112% | 0 | 0 | — |
case-02 | fail→pass | 22,496 | 35,905 | +60% | 1 | 1 | 0% | 4,072 | 9,249 | +127% | 0 | 0 | — |
case-03 | fail→pass | 18,720 | 11,335 | -39% | 1 | 1 | 0% | 3,498 | 4,691 | +34% | 0 | 0 | — |
case-04 | fail→pass | 13,567 | 34,841 | +157% | 1 | 1 | 0% | 2,581 | 3,523 | +36% | 0 | 0 | — |
case-05 | fail→pass | 14,024 | 34,654 | +147% | 1 | 1 | 0% | 2,472 | 3,427 | +39% | 0 | 0 | — |
case-06 | fail→pass | 16,700 | 7,854 | -53% | 1 | 1 | 0% | 2,966 | 4,105 | +38% | 0 | 0 | — |
case-07 | fail→pass | 12,813 | 6,493 | -49% | 1 | 1 | 0% | 2,146 | 3,833 | +79% | 0 | 0 | — |
case-21 | fail→pass | 12,703 | 8,745 | -31% | 1 | 1 | 0% | 1,944 | 4,124 | +112% | 0 | 0 | — |
case-08 | fail→pass | 9,891 | 4,333 | -56% | 1 | 1 | 0% | 1,783 | 3,431 | +92% | 0 | 0 | — |
case-09 | fail→pass | 6,542 | 5,344 | -18% | 1 | 1 | 0% | 1,070 | 3,641 | +240% | 0 | 0 | — |
case-10 | pass→pass | 11,197 | 4,651 | -58% | 1 | 1 | 0% | 1,932 | 3,400 | +76% | 0 | 0 | — |
case-11 | fail→pass | 9,897 | 5,852 | -41% | 1 | 1 | 0% | 1,804 | 3,733 | +107% | 0 | 0 | — |
case-12 | fail→pass | 15,192 | 7,544 | -50% | 1 | 1 | 0% | 2,232 | 3,888 | +74% | 0 | 0 | — |
case-13 | pass→pass | 16,078 | 11,451 | -29% | 1 | 1 | 0% | 2,614 | 4,520 | +73% | 0 | 0 | — |
case-14 | fail→pass | 21,077 | 43,280 | +105% | 1 | 1 | 0% | 3,100 | 4,800 | +55% | 0 | 0 | — |
case-15 | fail→pass | 13,828 | 5,789 | -58% | 1 | 1 | 0% | 2,389 | 3,612 | +51% | 0 | 0 | — |
case-16 | fail→pass | 12,004 | 4,266 | -64% | 1 | 1 | 0% | 2,049 | 3,324 | +62% | 0 | 0 | — |
case-17 | pass→pass | 21,322 | 9,443 | -56% | 1 | 1 | 0% | 3,226 | 4,185 | +30% | 0 | 0 | — |
case-18 | fail→pass | 16,122 | 4,701 | -71% | 1 | 1 | 0% | 2,929 | 3,510 | +20% | 0 | 0 | — |
case-19 | fail→pass | 13,362 | 8,868 | -34% | 1 | 1 | 0% | 2,283 | 4,030 | +77% | 0 | 0 | — |
case-20 | pass→pass | 3,978 | 8,672 | +118% | 1 | 1 | 0% | 553 | 3,913 | +608% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +82 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.