Rechercher

PythonReactSEOPDF
OpenClaw

baostock

Free Chinese A-share stock data via BaoStock — K-lines, financials, industry classification, no registration required.

coderwpf0 installations selon la source☆ 0 Étoiles du dépôtv1.0.0

Installation

Suivez les instructions du dépôt pour votre agent. Consultez les fichiers et dépendances avant l’installation.

SkillHub CLI

skillhub install coderwpf/baostock

Examinez la source et la compatibilité, puis suivez les étapes d’installation.

Donnez le lien à votre agent et demandez-lui d’examiner instructions et dépendances avant d’expliquer les étapes.

Voir la source ↗Guides

Instructions

BaoStock (证券宝 — 免费A股数据平台)

BaoStock is a free, open-source securities data platform for Chinese A-shares. No registration or API key needed. Returns pandas.DataFrame.

Install

pip install baostock --upgrade

Verify:

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:

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()

Core APIs

1. query_all_stock — List all securities

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
  • 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).

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...

Informations sur la source

Source
github
Repository
openclaw/skills
Path
skills/coderwpf/baostock
Version
1.0.0
Commit
2e3fc64044b15fa7c962553ff9696efbe5925822
Source de classification
rules
Statut
active
Visibilité
public

Ces informations proviennent de l’analyse indexée et peuvent être anciennes. Vérifiez les fichiers actuels.

Contenu extrait

SKILL.md
# 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...

Skills associés

OpenClaw

a-stock-trader

bombfuock

A股模拟交易系统 - 数据爬取、存储、策略回测、模拟交易 / A-Share Paper Trading System - Data Fetch, Storage, Backtest, Simulation

OpenClaw

adaptive-skill-factory

505768069-rgb

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...