A Stock Analysis
A股实时行情与分时量能分析
Free Chinese A-share stock data via BaoStock — K-lines, financials, industry classification, no registration required.
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
SkillHub CLI
skillhub install coderwpf/baostockInspect the source and compatibility requirements, then follow its installation steps.
Give your agent the source link and ask it to inspect instructions and dependencies before explaining the installation steps.
BaoStock is a free, open-source securities data platform for Chinese A-shares. No registration or API key needed. Returns pandas.DataFrame.
pip install baostock --upgrade
Verify:
python3 -c "import baostock as bs; lg = bs.login(); print(lg.error_msg); bs.logout()"
Should print login success!.
Every session must call bs.login() before queries and bs.logout() when done:
import baostock as bs
import pandas as pd
lg = bs.login()
# ... queries here ...
bs.logout()
Result sets use .get_data() to get a DataFrame:
rs = bs.query_all_stock()
df = rs.get_data()
Get all stock/index codes for a given trading date.
rs = bs.query_all_stock(day="2024-01-02")
df = rs.get_data()
# columns: code, tradeStatus, code_name
YYYY-MM-DD (default: today). Non-trading days return empty DataFrame.Get historical K-line data (OHLCV + indicators).
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:
sh.600000 or sz.000001
YYYY-MM-DD
d (daily), w (weekly), m (monthly), 5/15/30/60 (minute bars). Index has no minute data.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...
These signals come from indexed source analysis and may lag behind changes. Check the current source files.
# 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...A股实时行情与分时量能分析
A股模拟交易系统 - 数据爬取、存储、策略回测、模拟交易 / A-Share Paper Trading System - Data Fetch, Storage, Backtest, Simulation
Discover, install, update, or create the right skill when a workflow gap appears. Use when a task is repetitive, a role lacks a reliable procedure, an existing skill might save time, ClawHub search/install coul...
AI Automation Agency Blueprint