Overview
- Skill Key
- coderwpf/baostock
- Author
- coderwpf
- Source Repo
- openclaw/skills
- Version
- 1.0.0
- Source Path
- skills/coderwpf/baostock
- Latest Commit SHA
- 2e3fc64044b15fa7c962553ff9696efbe5925822
Free Chinese A-share stock data via BaoStock — K-lines, financials, industry classification, no registration required.
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 baostock 技能。 若已安装,则直接安装 baostock 技能。
# BaoStock (证券宝 — 免费A股数据平台)
[BaoStock](https://www.baostock.com) is a free, open-source securities data platform for Chinese A-shares. No registration or API key needed. Returns `pandas.DataFrame`.
## Install
```bash
pip install baostock --upgrade
```
Verify:
```bash
python3 -c "import baostock as bs; lg = bs.login(); print(lg.error_msg); bs.logout()"
```
Should print `login success!`.
## Usage pattern
Every session must call `bs.login()` before queries and `bs.logout()` when done:
```python
import baostock as bs
import pandas as pd
lg = bs.login()
# ... queries here ...
bs.logout()
```
Result sets use `.get_data()` to get a DataFrame:
```python
rs = bs.query_all_stock()
df = rs.get_data()
```
## Core APIs
### 1. query_all_stock — List all securities
Get all stock/index codes for a given trading date.
```python
rs = bs.query_all_stock(day="2024-01-02")
df = rs.get_data()
# columns: code, tradeStatus, code_name
```
- **day** — Date string `YYYY-MM-DD` (default: today). Non-trading days return empty DataFrame.
### 2. query_history_k_data_plus — K-line data
Get historical K-line data (OHLCV + indicators).
```python
rs = bs.query_history_k_data_plus(
"sh.601398",
"date,code,open,high,low,close,volume,amount,pctChg",
start_date="2024-01-01",
end_date="2024-06-30",
frequency="d",
adjustflag="3"
)
df = rs.get_data()
```
**Parameters:**
- **code** — Stock code, format `sh.600000` or `sz.000001`
- **fields** — Comma-separated field names (see below)
- **start_date** / **end_date** — `YYYY-MM-DD`
- **frequency** — `d` (daily), `w` (weekly), `m` (monthly), `5`/`15`/`30`/`60` (minute bars). Index has no minute data.
- **adjustflag** — `1` (forward adj), `2` (backward adj), `3` (no adj, default)
**Available fields (daily):**
`date`, `code`, `open`, `high`, `low`, `close`, `preclose`, `volume`, `amount`, `adjustflag`, `turn` (turnover rate), `tradestatus`, `pctChg` (change %), `peTTM`, `pbMRQ`, `psTTM`, `pcfNcfTTM`, `isS...
caoyumin97
Structured problem analysis and communication using system mapping and hierarchical logic. Use when a request involves messy, multi-factor problems, root-cause analysis, intervention design, feedback loops or delays, or when a clear top-line recommendation with logically grouped support is required.
chaimengphp
Query real-time and historical financial data across equities and crypto—prices, market moves, metrics, and trends for analysis, alerts, and reporting.
cerbug45
AI Wallet Payment System Skill Guide
bywallace
Read and manage Kubera.com portfolio data (net worth, assets, debts, allocation, holdings). Use when a user asks about their finances, net worth, portfolio, investments, holdings, asset allocation, or wants to update asset values in Kubera. Works with any AI agent or CLI that can run Python scripts.
c-goro
Expense tracking and accounting for AI agents. Log purchases, set budgets, generate spending reports, and manage multi-currency finances — all stored locally. Privacy.com card import, natural language queries, CSV/JSON export. Use when agents make purchases and need a financial audit trail.
c0rv0s
Short-form video for AI agents. Generate videos using the latest models, pay with USDC via x402.