← 返回 Skills 市场
A股数据分析 (AkShare)
作者
Logan Reed
· GitHub ↗
· v1.0.1
· MIT-0
865
总下载
0
收藏
3
当前安装
4
版本数
在 OpenClaw 中安装
/install akshare-a-stock
功能描述
A股量化数据分析工具,基于AkShare库获取A股、港股、美股行情、财务数据、板块分析等。用于回答关于股票查询、行情数据、财务分析、资金流向、龙虎榜、涨停跌停、新股IPO、融资融券等问题。
使用说明 (SKILL.md)
A股量化 - AkShare 数据接口
AkShare v1.18.48 | 数据来源:东方财富、同花顺、新浪、巨潮资讯等
快速开始
uv pip install akshare
import akshare as ak
注意事项
- 数据仅供学术研究,不构成投资建议
- 部分接口返回数据量大,建议使用
df.head()或切片 - 实时行情接口较慢(⚠️ >15s),建议加超时处理
- 日期格式统一为
YYYYMMDD(如"20250101"),分钟线为"YYYY-MM-DD HH:MM:SS" - 股票代码不带前缀(如
"000001"而非"SZ000001") - ⚠️ 查个股必须用个股接口,禁止用全市场接口筛选!
- ✅
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. 实时行情
全市场行情 ⚠️ 较慢
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() # 新股
港股/美股
ak.stock_hk_spot_em() # 港股实时 ⚠️ 较慢
ak.stock_us_spot_em() # 美股实时 ⚠️ 较慢
ak.stock_zh_ah_spot_em() # AH股对比
个股详情
ak.stock_individual_info_em(symbol="000001") # 个股基本信息
ak.stock_individual_spot_xq(symbol="000001") # 雪球个股行情
ak.stock_bid_ask_em(symbol="000001") # 五档盘口
指数行情
ak.stock_zh_index_spot_em() # A股指数实时
ak.stock_zh_index_daily_em(symbol="sh000001") # 指数日线
2. 历史K线
日/周/月K线
ak.stock_zh_a_hist(
symbol="000001", # 股票代码
period="daily", # daily/weekly/monthly
start_date="20250101",
end_date="20250301",
adjust="qfq" # qfq前复权 / hfq后复权 / ""不复权
)
分钟K线
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线
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. 板块分析
板块列表
ak.stock_board_industry_name_em() # 行业板块行情
ak.stock_board_concept_name_em() # 概念板块行情
板块成分股
ak.stock_board_industry_cons_em(symbol="银行") # 行业板块个股
ak.stock_board_concept_cons_em(symbol="人工智能") # 概念板块个股
板块历史K线
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")
板块资金流向
ak.stock_fund_flow_industry(indicator="今日") # 行业资金流
ak.stock_fund_flow_concept(indicator="今日") # 概念资金流
ak.stock_sector_fund_flow_rank(indicator="今日", sector_type="行业资金流") # 板块排名
4. 资金流向
个股资金流
ak.stock_individual_fund_flow(stock="000001", market="sz") # 个股资金流向
ak.stock_individual_fund_flow_rank(indicator="今日") # 个股排名
大盘资金流
ak.stock_market_fund_flow() # 大盘资金流向
ak.stock_main_fund_flow() # 主力资金流向
历史资金流
ak.stock_fund_flow_individual(stock="000001", market="sz") # 历史资金流
ak.stock_sector_fund_flow_hist(symbol="银行") # 板块历史资金流
5. 龙虎榜
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. 涨停/跌停
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
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. 融资融券
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. 财务数据
财务摘要
ak.stock_financial_abstract_ths(symbol="000001", indicator="按报告期") # 同花顺财务摘要
三大报表
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") # 现金流量表
业绩数据
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") # 现金流量表
财务指标
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. 股东与公司
股东数据
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") # 主要股东
公司信息
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") # 股票回购
高管/机构
ak.stock_hold_management_detail_em(symbol="000001") # 高管持股
ak.stock_institute_hold(symbol="000001") # 机构持仓
ak.stock_institute_recommend() # 机构推荐
ak.stock_analyst_rank_em() # 分析师排名
11. 限售解禁
ak.stock_restricted_release_queue_em() # 限售解禁队列
ak.stock_restricted_release_summary_em() # 限售解禁汇总
ak.stock_restricted_release_detail_em(symbol="000001") # 个股解禁详情
12. 沪深港通
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. 市场估值
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. 研报与新闻
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. 指数成分
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
安全使用建议
This skill appears to do what it claims — it wraps AkShare calls to fetch market and financial data and does not request credentials. However:
- Review and test the script before use: get_fund_flow references an undefined symbol (likely should be ak.stock_individual_fund_flow) and will raise errors.
- The script uses full-market endpoints (ak.stock_zh_a_spot_em()) for realtime/search; those endpoints return many rows and are slow (~70s) as the README warns. If you only need individual stocks, change calls to the per‑symbol APIs to avoid heavy network/CPU usage and large data downloads.
- The SKILL.md contains a small typo in the pip instruction ('uv pip install akshare'); run pip install akshare yourself (preferably in a virtual environment).
- AkShare itself fetches data from third‑party sources (EastMoney, Sina, etc.); expect network requests and respect rate limits and legal/usage terms of those sources.
- As a precaution, run the code in a sandbox or isolated environment, verify the akshare version, and inspect network activity if you have strict security requirements.
功能分析
Type: OpenClaw Skill
Name: akshare-a-stock
Version: 1.0.1
The skill bundle is a legitimate tool for financial data analysis using the well-known AkShare library. The Python script 'scripts/stock_cli.py' provides a standard CLI interface for fetching stock quotes and historical data, while 'SKILL.md' and 'references/api-reference.md' offer comprehensive documentation and usage guidelines. No signs of malicious intent, data exfiltration, or prompt injection were detected.
能力评估
Purpose & Capability
Name/description promise AkShare-based market and financial data; the code and SKILL.md call akshare APIs accordingly. No unrelated credentials, binaries, or installs are requested.
Instruction Scope
SKILL.md instructs installing and using akshare and documents many APIs. It warns against using full-market endpoints for single-stock queries, but the included script uses full-market endpoints (ak.stock_zh_a_spot_em()) for realtime queries and search, which is inconsistent and can be slow/expensive. There are minor typos (e.g., 'uv pip install akshare') and a coding bug: get_fund_flow calls stock_individual_fund_flow(...) without qualifying it with ak. These are scope/implementation problems, not evidence of data exfiltration.
Install Mechanism
No automated install spec; SKILL.md suggests pip installing akshare. No arbitrary downloads or archive extraction are present in the bundle.
Credentials
The skill declares no required env vars, no credentials, and the code does not read external credential-related environment variables. Proportional to purpose.
Persistence & Privilege
always:false and no special persistence or modifications to other skills or system configs. Skill can be invoked by the agent (normal behavior).
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install akshare-a-stock - 安装完成后,直接呼叫该 Skill 的名称或使用
/akshare-a-stock触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
初始发布:A股/港股/美股行情、财务、板块、龙虎榜、涨停跌停、新股IPO、融资融券等150+接口,含个股查询规则
v1.2.1
新增个股查询规则:禁止用全市场接口筛选个股,推荐使用 stock_bid_ask_em、stock_individual_info_em、stock_zh_a_hist 等个股专用接口
v1.2.0
修复5个过时API,扩展至150+接口,新增港股美股支持
v1.0.0
Initial release of AkShare A股量化数据分析工具.
- Provides extensive Python API interface to AkShare for A股、港股、美股行情、财务、板块、龙虎榜、资金流向等数据获取和分析
- Covers real-time and historical quotes, sector analysis, fund flows, financial reports, IPO/new stocks, and margin finance
- Supports querying for leaderboard stocks, price limits, shareholder and institutional data, market valuation, news, and research reports
- Includes usage notes for date/code formats, data volume, and interface performance
- Documentation contains categorized sample code for quick start and each data category
元数据
推荐 Skills