Claude Code skill for BaoStock — free A-share market data API with 23 endpoints, 9 documented pitfalls, and pandas 2.0+ compatibility fixes
English | 中文
baostock-skill
Claude Code skill for BaoStock — free A-share market data API with 23 endpoints, 9 documented pitfalls, and pandas 2.0+ compatibility fixes.
What It Does
Gives Claude Code complete knowledge of the BaoStock Python API for China A-share securities data. When you ask Claude to fetch stock data, write a data pipeline, or debug BaoStock code, it knows every API, parameter, return field, and common pitfall.
23 APIs covered across 5 categories:
| Category | APIs | Examples | |----------|------|----------| | Market Data | 3 | K-line (daily/weekly/monthly/minute), index, all securities | | Basic Info | 5 | Stock info, industry classification, SSE 50/CSI 300/CSI 500 constituents | | Dividends | 2 | Dividend data, adjustment factors | | Quarterly Financial | 8 | Profitability, growth, solvency, cash flow, DuPont, express/forecast reports | | Macroeconomic | 5 | Deposit/loan rates, reserve ratio, money supply (monthly/annual) |
9 documented pitfalls including pandas 2.0+ crash fix, stdout pollution suppression, and string-to-numeric conversion patterns.
Installation
Method 1: Claude Code Plugin (Recommended)
# Add as marketplace
/plugin marketplace add atompilot/baostock-skill
Install the plugin
/plugin install baostock@baostock-skill
Method 2: Manual Skill Install
# Clone and symlink
git clone https://github.com/atompilot/baostock-skill.git ~/.claude/skills/baostock-skill
Or copy the skill file directly
mkdir -p ~/.claude/skills/baostock
curl -o ~/.claude/skills/baostock/SKILL.md \
https://raw.githubusercontent.com/atompilot/baostock-skill/master/skills/baostock/SKILL.md
Method 3: OpenClaw / Playbooks
# Install via playbooks registry
npx playbooks add skill atompilot/baostock-skill --skill baostock
Or install via clawhub
npx clawhub install baostock
Restart Claude Code / OpenClaw to activate.
Usage
Once installed, Claude Code automatically uses this skill when working with BaoStock. Examples:
> Help me fetch daily K-line data for sh.600000 from 2024
> Write a script to download quarterly financial data for all CSI 300 stocks
> Why is my BaoStock code crashing with pandas 2.0?
> Get dividend history for Kweichow Moutai
What Claude Learns
- Every API signature with all parameters and return fields
- Code patterns that work with pandas 2.0+ (avoiding the
DataFrame.append()crash) - 9 common pitfalls — string return types, empty turnover rates, stdout pollution, minute bar time parsing, adjustment method differences, connection recovery, index minute bar limitations, ETF coverage gaps
- Correct frequency/adjustflag values — no guessing
"d"vs"daily"or"3"vs"none"
Project Structure
baostock-skill/
├── .claude-plugin/
│ ├── marketplace.json # Plugin marketplace registration
│ └── plugin.json # Plugin metadata
├── plugins/
│ └── baostock/
│ └── skills/
│ └── baostock/
│ └── SKILL.md # Skill file (plugin path)
├── skills/
│ └── baostock/
│ └── SKILL.md # Skill file (manual install path)
├── playbook.md # OpenClaw playbook entry
├── README.md
├── README.zh-CN.md
└── LICENSE
Compatibility
| Platform | Supported | Install Method | |----------|-----------|----------------| | Claude Code | Yes | Plugin or manual skill | | OpenClaw | Yes | Playbook | | Claude Code (Codex mode) | Yes | Plugin | | Any MCP-compatible agent | Yes | Read SKILL.md as context |
Related
- BaoStock Official — The data platform
- baostock on PyPI —
pip install baostock - atompilot/claude-code-plugins — More Claude Code plugins
License
MIT © atompilot