akshare-a-stock
A股量化数据分析工具,基于AkShare库获取A股、港股、美股行情、财务数据、板块分析等。用于回答关于股票查询、行情数据、财务分析、资金流向、龙虎榜、涨停跌停、新股IPO、融资融券等问题。
Best use case
akshare-a-stock is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
A股量化数据分析工具,基于AkShare库获取A股、港股、美股行情、财务数据、板块分析等。用于回答关于股票查询、行情数据、财务分析、资金流向、龙虎榜、涨停跌停、新股IPO、融资融券等问题。
Teams using akshare-a-stock should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/akshare-a-stock/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How akshare-a-stock Compares
| Feature / Agent | akshare-a-stock | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
A股量化数据分析工具,基于AkShare库获取A股、港股、美股行情、财务数据、板块分析等。用于回答关于股票查询、行情数据、财务分析、资金流向、龙虎榜、涨停跌停、新股IPO、融资融券等问题。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
AI Agents for Startups
Explore AI agent skills for startup validation, product research, growth experiments, documentation, and fast execution with small teams.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
SKILL.md Source
# A股量化 - AkShare 数据接口
> AkShare v1.18.48 | 数据来源:东方财富、同花顺、新浪、巨潮资讯等
## 快速开始
```bash
uv pip install akshare
```
```python
import akshare as ak
```
## 注意事项
1. 数据仅供学术研究,不构成投资建议
2. 部分接口返回数据量大,建议使用 `df.head()` 或切片
3. 实时行情接口较慢(⚠️ >15s),建议加超时处理
4. 日期格式统一为 `YYYYMMDD`(如 `"20250101"`),分钟线为 `"YYYY-MM-DD HH:MM:SS"`
5. 股票代码不带前缀(如 `"000001"` 而非 `"SZ000001"`)
6. **⚠️ 查个股必须用个股接口,禁止用全市场接口筛选!**
- ✅ `stock_bid_ask_em(symbol="600227")` — 个股盘口,~3s
- ✅ `stock_individual_info_em(symbol="600227")` — 个股基本信息,~3s
- ✅ `stock_zh_a_hist(symbol="600227", ...)` — 个股历史K线,~5s
- ❌ `stock_zh_a_spot_em()` — 全A行情 ~70s,仅用于需要全市场扫描的场景
---
## 1. 实时行情
### 全市场行情 ⚠️ 较慢
```python
ak.stock_zh_a_spot_em() # 沪深京全部A股 (~70s, 5800+ rows)
ak.stock_sh_a_spot_em() # 沪A股 (~28s, 2400+ rows)
ak.stock_sz_a_spot_em() # 深A股
ak.stock_bj_a_spot_em() # 北证A股
ak.stock_cy_a_spot_em() # 创业板
ak.stock_kc_a_spot_em() # 科创板
ak.stock_new_a_spot_em() # 新股
```
### 港股/美股
```python
ak.stock_hk_spot_em() # 港股实时 ⚠️ 较慢
ak.stock_us_spot_em() # 美股实时 ⚠️ 较慢
ak.stock_zh_ah_spot_em() # AH股对比
```
### 个股详情
```python
ak.stock_individual_info_em(symbol="000001") # 个股基本信息
ak.stock_individual_spot_xq(symbol="000001") # 雪球个股行情
ak.stock_bid_ask_em(symbol="000001") # 五档盘口
```
### 指数行情
```python
ak.stock_zh_index_spot_em() # A股指数实时
ak.stock_zh_index_daily_em(symbol="sh000001") # 指数日线
```
---
## 2. 历史K线
### 日/周/月K线
```python
ak.stock_zh_a_hist(
symbol="000001", # 股票代码
period="daily", # daily/weekly/monthly
start_date="20250101",
end_date="20250301",
adjust="qfq" # qfq前复权 / hfq后复权 / ""不复权
)
```
### 分钟K线
```python
ak.stock_zh_a_hist_min_em(
symbol="000001",
period="1", # 1/5/15/30/60
start_date="2025-03-27 09:30:00",
end_date="2025-03-27 15:00:00",
adjust=""
)
```
### 港股/美股K线
```python
ak.stock_hk_hist(symbol="00700", period="daily", start_date="20250101", end_date="20250301", adjust="qfq")
ak.stock_us_hist(symbol="AAPL", period="daily", start_date="20250101", end_date="20250301", adjust="qfq")
ak.stock_hk_hist_min_em(symbol="00700", period="1", start_date="2025-03-27 09:30:00", end_date="2025-03-27 16:00:00")
ak.stock_us_hist_min_em(symbol="AAPL", period="1", start_date="2025-03-27 09:30:00", end_date="2025-03-27 16:00:00")
```
---
## 3. 板块分析
### 板块列表
```python
ak.stock_board_industry_name_em() # 行业板块行情
ak.stock_board_concept_name_em() # 概念板块行情
```
### 板块成分股
```python
ak.stock_board_industry_cons_em(symbol="银行") # 行业板块个股
ak.stock_board_concept_cons_em(symbol="人工智能") # 概念板块个股
```
### 板块历史K线
```python
ak.stock_board_industry_hist_em(symbol="银行", period="daily", start_date="20250101", end_date="20250301")
ak.stock_board_concept_hist_em(symbol="人工智能", period="daily", start_date="20250101", end_date="20250301")
```
### 板块资金流向
```python
ak.stock_fund_flow_industry(indicator="今日") # 行业资金流
ak.stock_fund_flow_concept(indicator="今日") # 概念资金流
ak.stock_sector_fund_flow_rank(indicator="今日", sector_type="行业资金流") # 板块排名
```
---
## 4. 资金流向
### 个股资金流
```python
ak.stock_individual_fund_flow(stock="000001", market="sz") # 个股资金流向
ak.stock_individual_fund_flow_rank(indicator="今日") # 个股排名
```
### 大盘资金流
```python
ak.stock_market_fund_flow() # 大盘资金流向
ak.stock_main_fund_flow() # 主力资金流向
```
### 历史资金流
```python
ak.stock_fund_flow_individual(stock="000001", market="sz") # 历史资金流
ak.stock_sector_fund_flow_hist(symbol="银行") # 板块历史资金流
```
---
## 5. 龙虎榜
```python
ak.stock_lhb_detail_em(start_date="20250320", end_date="20250328") # 龙虎榜详情
ak.stock_lhb_stock_detail_em(symbol="000001") # 个股龙虎榜
ak.stock_lhb_stock_statistic_em() # 龙虎榜统计
ak.stock_lhb_jgstatistic_em() # 机构统计
ak.stock_lhb_yybph_em() # 营业部排行
```
---
## 6. 涨停/跌停
```python
ak.stock_zt_pool_em(date="20250327") # 涨停池
ak.stock_zt_pool_dtgc_em(date="20250327") # 跌停池(仅最近30个交易日)
ak.stock_zt_pool_strong_em(date="20250327") # 强势股池
ak.stock_zt_pool_previous_em(date="20250327") # 昨日涨停
ak.stock_zt_pool_sub_new_em(date="20250327") # 次新股涨停
ak.stock_zt_pool_zbgc_em(date="20250327") # 涨停不打开
```
---
## 7. 新股/IPO
```python
ak.stock_new_ipo_cninfo() # 新股列表(巨潮)
ak.stock_ipo_declare_em() # 新股申购(东财)
ak.stock_ipo_info() # IPO信息
ak.stock_ipo_review_em() # IPO审核
ak.stock_ipo_summary_cninfo() # IPO汇总
```
---
## 8. 融资融券
```python
ak.stock_margin_sse(start_date="20250301", end_date="20250328") # 沪市融资融券
ak.stock_margin_szse(date="20250301") # 深市融资融券(旧参数)
ak.stock_margin_detail_sse(date="20250301") # 沪市明细
ak.stock_margin_detail_szse(date="20250301") # 深市明细
ak.stock_margin_account_info() # 融资融券账户
ak.stock_margin_ratio_pa() # 两融余额占比
```
---
## 9. 财务数据
### 财务摘要
```python
ak.stock_financial_abstract_ths(symbol="000001", indicator="按报告期") # 同花顺财务摘要
```
### 三大报表
```python
ak.stock_profit_sheet_by_report_em(symbol="000001") # 利润表
ak.stock_balance_sheet_by_report_em(symbol="000001") # 资产负债表
ak.stock_cash_flow_sheet_by_report_em(symbol="000001") # 现金流量表
```
### 业绩数据
```python
ak.stock_yjbb_em(date="20240930") # 业绩报表
ak.stock_yjyg_em(date="20240930") # 业绩预告
ak.stock_yjkb_em(date="20240930") # 业绩快报
ak.stock_lrb_em(date="20240930") # 利润表
ak.stock_zcfz_em(date="20240930") # 资产负债表
ak.stock_xjll_em(date="20240930") # 现金流量表
```
### 财务指标
```python
ak.stock_financial_analysis_indicator(symbol="000001") # 主要财务指标(⚠️ 可能超时)
ak.stock_financial_analysis_indicator_em(symbol="000001.SZ", indicator="按报告期") # 东财版
ak.stock_sy_em(symbol="000001") # 收益指标
ak.stock_yysj_em(symbol="000001") # 营收数据
ak.stock_fhps_em(symbol="000001") # 分红配送
```
---
## 10. 股东与公司
### 股东数据
```python
ak.stock_zh_a_gdhs(symbol="000001") # 股东户数
ak.stock_gdfx_free_top_10_em(symbol="000001") # 十大流通股东
ak.stock_gdfx_top_10_em(symbol="000001") # 十大股东
ak.stock_main_stock_holder(symbol="000001") # 主要股东
```
### 公司信息
```python
ak.stock_individual_info_em(symbol="000001") # 公司概况
ak.stock_individual_basic_info_xq(symbol="000001") # 雪球公司信息
ak.stock_changes_em(symbol="000001") # 公司变动
ak.stock_repurchase_em(symbol="000001") # 股票回购
```
### 高管/机构
```python
ak.stock_hold_management_detail_em(symbol="000001") # 高管持股
ak.stock_institute_hold(symbol="000001") # 机构持仓
ak.stock_institute_recommend() # 机构推荐
ak.stock_analyst_rank_em() # 分析师排名
```
---
## 11. 限售解禁
```python
ak.stock_restricted_release_queue_em() # 限售解禁队列
ak.stock_restricted_release_summary_em() # 限售解禁汇总
ak.stock_restricted_release_detail_em(symbol="000001") # 个股解禁详情
```
---
## 12. 沪深港通
```python
ak.stock_hsgt_hist_em(symbol="沪股通") # 历史净买入
ak.stock_hsgt_sh_hk_spot_em(symbol="沪股通") # 实时数据
ak.stock_hsgt_fund_flow_summary_em() # 资金汇总
ak.stock_hsgt_board_rank_em() # 板块排名
```
---
## 13. 市场估值
```python
ak.stock_a_all_pb() # 全A市净率
ak.stock_a_ttm_lyr() # 全A市盈率(无参数,返回全市场)
ak.stock_dxsyl_em() # 股息率 ⚠️ 较慢
ak.stock_zh_valuation_baidu(symbol="000001", indicator="总市值") # 百度估值
ak.stock_zh_valuation_comparison_em(symbol="000001") # 估值对比
```
---
## 14. 研报与新闻
```python
ak.stock_research_report_em() # 研报列表
ak.stock_news_em(symbol="000001") # 个股新闻
ak.stock_hot_keyword_em() # 热门关键词
ak.stock_hot_rank_em() # 热搜排名
ak.stock_comment_em(symbol="000001") # 股吧评论
```
---
## 15. 指数成分
```python
ak.index_stock_cons_csindex(symbol="000300") # 中证指数成分(如沪深300)
ak.index_stock_cons_weight_csindex(symbol="000300") # 成分股权重
ak.index_stock_cons_sina(symbol="000300") # 新浪版
```
---
## 常用股票代码
| 名称 | 代码 | 市场 |
|------|------|------|
| 平安银行 | 000001 | sz |
| 贵州茅台 | 600519 | sh |
| 宁德时代 | 300750 | sz |
| 比亚迪 | 002594 | sz |
| 招商银行 | 600036 | sh |
| 腾讯控股 | 00700 | hk |
| 苹果 | AAPL | us |
| 沪深300 | 000300 | index |
## 常用日期
查询最新数据时,用近期交易日日期(如 `"20250327"`)。获取当日日期可用 Python `datetime`。
## 详见
更多接口参见 [references/api-reference.md](references/api-reference.md)Related Skills
openclaw-stock-skill
使用 data.diemeng.chat 提供的接口查询股票日线、分钟线、财务指标等数据,支持 A 股等市场。
us-stock-analyst
Professional US stock analysis with financial data, news, social sentiment, and multi-model AI. Comprehensive reports at $0.02-0.10 per analysis.
stock-watchlist
Query real-time stock prices, basic quote fields, and manage a Markdown watchlist for A-share, Hong Kong, and US stocks. Use when users ask in Chinese or by ticker/code to search stocks, inspect current price and quote basics, or maintain a watchlist stored in a Markdown file.
jarvis-stock-price - 股票价格查询
**版本**: 1.0.0
jarvis-stock-monitor
全功能智能股票监控预警系统 Pro 版。支持成本百分比、均线金叉死叉、RSI 超买超卖、成交量异动、跳空缺口、动态止盈等 7 大预警规则。基础功能免费,高级功能 SkillPay 付费。
SKILL: stock-checker
## Description
akshare-finance
AKShare财经数据接口库封装,提供股票、期货、期权、基金、外汇、债券、指数、加密货币等金融产品的基本面数据、实时和历史行情数据、衍生数据。
Stock Skill - 股票查询
获取A股、港股、美股的实时行情数据。
stock-query
查询全球主要市场股票实时行情:A 股、港股、美股,以及场内 ETF、场外基金、主要指数。 需要:curl(HTTP 请求)、iconv(GBK→UTF-8 转码)。 Use when: 用户要求查询股价、基金净值、ETF 价格、大盘指数,或需要计算持仓市值时。 NOT for: 加密货币、期货、期权、外汇。
cn-stock-query
查询中国 A 股股票、场内 ETF 及场外基金的实时行情与最新净值。 Use when: 用户要求查询股价、基金净值、ETF 价格,或需要计算持仓市值时。 NOT for: 美股(含中概 ADR)、港股、加密货币、期货、期权。
AKShare-Skill
教你如何使用 AKShare 来获取财经数据
openclaw-livestock-assistant
AI-powered livestock management assistant for Spanish-speaking farmers. Provides expert advice on herd management, animal health, reproduction, genetics, nutrition, and breed selection for bovine, ovine, caprine, porcine, equine, and poultry. Includes a Node.js REST API for persistent herd record-keeping (animal registration, health records, reproduction events). Use when the user asks about livestock, cattle, ganadería, herd management, animal health, veterinary advice, breeds, reproduction, nutrition, forage, or any livestock-related topic.