跳到正文
Skillpedia
分析与电子表格37k · #7496

akshare

它能做什么

这项技能教智能体使用 AKShare,一个免费开源的 Python 金融数据库。适合希望获取行情数据、又不想注册付费服务的分析师和开发者。

适用场景

  • ✓当你需要 A 股、美国股票、香港股票或期货的历史价格的时候。
  • ✓当你想在没有 API 密钥的情况下获取免费的宏观或外汇数据的时候。
  • ✓当其他行情数据服务商不可用时,你需要一个备用数据源的时候。

技能链接

https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/akshare/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/akshare/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请获取这只香港股票过去两年的每日价格,并展示月度走势。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会安装 AKShare Python 库,并针对你所需的市场调用正确的函数,例如 A 股或美国股票的每日价格。它会在适当的地方使用复权价格,并把数据以可供分析的表格返回。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Overview

AKShare is a completely free, open-source Python financial data library. No registration or API key required. It aggregates data from public sources (Sina, East Money, etc.) covering Chinese and global markets.

Quick Start

import akshare as ak

# A-share daily OHLCV (前复权)
df = ak.stock_zh_a_hist(symbol="000001", period="daily",
                         start_date="20240101", end_date="20260101", adjust="qfq")

# US stock daily
df = ak.stock_us_hist(symbol="105.AAPL", period="daily",
                       start_date="20240101", end_date="20260101", adjust="qfq")

# HK stock daily
df = ak.stock_hk_hist(symbol="00700", period="daily",
                       start_date="20240101", end_date="20260101", adjust="qfq")

Top 10 High-Frequency Interfaces

A-shares

Function Description Key Params
stock_zh_a_hist() A-share OHLCV symbol, period, start_date, end_date, adjust
stock_zh_a_spot_em() Real-time A-share quotes (none)
stock_individual_info_em() Stock basic info symbol
stock_zh_a_hist_min_em() Intraday bars symbol, period(1/5/15/30/60)

US / HK

Function Description Key Params
stock_us_hist() US stock OHLCV symbol (e.g. "105.AAPL"), period, start_date, end_date
stock_hk_hist() HK stock OHLCV symbol (e.g. "00700"), period, start_date, end_date

Macro / Forex / Futures

Function Description
macro_china_gdp() China GDP data
macro_china_cpi() China CPI data
futures_main_sina() Futures main contract quotes
currency_boc_sina() BOC forex rates

Column Names

AKShare returns Chinese column names by default:

Chinese English Description
日期 date Trade date
开盘 open Open price
最高 high High price
最低 low Low price
收盘 close Close price
成交量 volume Volume
成交额 amount Turnover
涨跌幅 pct_change % change
换手率 turnover_rate Turnover rate

Date Format

  • Input: YYYYMMDD string (e.g. "20240101")
  • Output: 日期 column as string, convert with pd.to_datetime()

Symbol Format

  • A-shares: pure digits "000001" (no .SZ suffix)
  • US stocks: "105.AAPL" (NASDAQ prefix 105), "106.BABA" (NYSE prefix 106)
  • HK stocks: "00700" (5-digit zero-padded)

Built-in Loader

The project has a built-in AKShare DataLoader at backtest/loaders/akshare_loader.py. When backtesting, the runner automatically falls back to AKShare when tushare/yfinance are unavailable.

Reference Docs

For less common interfaces, see the references/ subdirectory or the official docs at https://akshare.akfamily.xyz/

常见问题

它需要付费账户吗?

不需要。AKShare 免费,无需注册或 API 密钥。

数据来自哪里?

它收集来自 Sina 和 East Money 等来源的公开数据。

其他数据源失效时它能补位吗?

能。技能将它列为其他金融数据源不可用时的主要备用方案。

详情

作者的原始描述

AKShare financial data aggregator (18k+ stars). Free, no API key. Covers A-shares, US, HK, futures, macro, forex. Primary fallback for tushare and yfinance.

repo: HKUDS/Vibe-Trading

热度

GitHub 星标
37k
排名
#7496
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能