From quant-skills
Fetches free, no-registration A-share stock data via BaoStock: K-line, financials, industry classification, index constituents, and trade calendar. Activates when user needs A-stock market data or mentions baostock.
How this skill is triggered — by the user, by Claude, or both
Slash command
/quant-skills:baostockThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- 本 Skill 用于:通过 BaoStock 接口获取 A 股市场数据、财务指标和股票信息
references/README.mdreferences/api.mdreferences/markdown/StockBasicInfoAPI.mdreferences/markdown/dataExplain.mdreferences/markdown/depositRate.mdreferences/markdown/dividInfo.mdreferences/markdown/factorInfo.mdreferences/markdown/home.mdreferences/markdown/hs300Stock.mdreferences/markdown/index.mdreferences/markdown/indexData.mdreferences/markdown/loanRate.mdreferences/markdown/localdatafactorInfo.mdreferences/markdown/pythonAPI.mdreferences/markdown/reserveRatio.mdreferences/markdown/seasonBalance.mdreferences/markdown/seasonCashFlow.mdreferences/markdown/seasonDupont.mdreferences/markdown/seasonExpress.mdreferences/markdown/seasonForecast.mdBAOSTOCK_SERVER_IP:自定义服务器 IP(用于 nginx 代理等场景)BAOSTOCK_SERVER_PORT:服务器端口,默认 10030python scripts/market_data.py --type kline --code sh.600000 --start 2024-01-01 --end 2024-01-31python scripts/financial_data.py --type profit --code sh.600000 --year 2023 --quarter 4python scripts/stock_info.py --type all_stocks --date 2024-01-02python scripts/stock_info.py --type index_stocks --index hs300python scripts/stock_info.py --type industrypython scripts/stock_info.py --type trade_dates --start 2024-01-01 --end 2024-12-31--file 指定代码列表文件--frequency 参数(d/w/m/5/15/30/60)--adjust 参数(1=后复权,2=前复权,3=不复权)python scripts/market_data.py --type kline --code sh.600519 --start 2024-03-01 --end 2024-03-31 --frequency d --adjust 2python scripts/financial_data.py --type profit --code sh.601398 --year 2023 --quarter 4python scripts/stock_info.py --type index_stocks --index hs300python scripts/market_data.py --type kline --code sh.600519,sz.000001,sh.600036 --start 2024-01-01 --end 2024-12-31 --output stocks.csvimport baostock as bs
import pandas as pd
# 登录系统
lg = bs.login()
# 获取日K线数据
rs = bs.query_history_k_data_plus(
"sh.600519",
"date,code,open,high,low,close,volume,amount",
start_date='2024-01-01', end_date='2024-12-31',
frequency="d", adjustflag="2"
)
# 转换为 DataFrame
data_list = []
while (rs.error_code == '0') & rs.next():
data_list.append(rs.get_row_data())
df = pd.DataFrame(data_list, columns=rs.fields)
# 登出系统
bs.logout()
| 特性 | baostock | tushare | jqdatasdk | akshare |
|---|---|---|---|---|
| 费用 | 免费 | 免费/付费 | 需注册积分 | 免费 |
| 注册要求 | ❌ 不需要 | ✅ 需要 | ✅ 需要 | ❌ 不需要 |
| 数据范围 | A股为主 | 全面(含宏观) | A股+因子 | 全面(含加密货币) |
| K线数据 | ✅ | ✅ | ✅ | ✅ |
| 财务数据 | ✅ | ✅ | ✅ | ✅ |
| 分钟线 | ✅ | ✅ | ✅ | ✅ |
| 实时行情 | ❌ | ❌ | ❌ | ✅ |
| 特色数据 | 交易日历 | 宏观/Shibor | 因子数据 | 龙虎榜/北向/加密货币 |
bs.login() 即可使用sh.600000(上海)、sz.000001(深圳)、bj.430047(北京)bs.login() 开始、bs.logout() 结束.astype(float) 转换npx claudepluginhub lzwme/finance-quant-skills --plugin quant-skillsFetches A-share market data, financials, and macro indicators via Tushare API. Provides scripts for daily K-line, income statements, and index data. Requires Tushare token.
Queries A-share securities data (K-line, financials, macro, industry) via the free BaoStock Python API, returning pandas DataFrames.
Queries Chinese A-share data via local akshare Python library: real-time quotes, historical K-lines (daily/weekly/monthly/minute), adjusted prices, shareholder counts, announcements. Uses EM/Sina APIs, outputs CSV/JSON.