A股数据分析 (AkShare)

v1.0.1

A股量化数据分析工具,基于AkShare库获取A股、港股、美股行情、财务数据、板块分析等。用于回答关于股票查询、行情数据、财务分析、资金流向、龙虎榜、涨停跌停、新股IPO、融资融券等问题。

0· 883·3 current·5 all-time
byLogan Reed@awsl1414

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for awsl1414/akshare-a-stock.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "A股数据分析 (AkShare)" (awsl1414/akshare-a-stock) from ClawHub.
Skill page: https://clawhub.ai/awsl1414/akshare-a-stock
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install akshare-a-stock

ClawHub CLI

Package manager switcher

npx clawhub@latest install akshare-a-stock
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
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).
Assessment
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.

Like a lobster shell, security has layers — review code before you run it.

latestvk977ahq9ypn3fxpm31nav7hh9h83r0je
883downloads
0stars
4versions
Updated 1mo ago
v1.0.1
MIT-0

A股量化 - AkShare 数据接口

AkShare v1.18.48 | 数据来源:东方财富、同花顺、新浪、巨潮资讯等

快速开始

uv pip install akshare
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. 实时行情

全市场行情 ⚠️ 较慢

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")             # 新浪版

常用股票代码

名称代码市场
平安银行000001sz
贵州茅台600519sh
宁德时代300750sz
比亚迪002594sz
招商银行600036sh
腾讯控股00700hk
苹果AAPLus
沪深300000300index

常用日期

查询最新数据时,用近期交易日日期(如 "20250327")。获取当日日期可用 Python datetime

详见

更多接口参见 references/api-reference.md

Comments

Loading comments...