百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

akshare

> DevOps
开源

AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库

21.7K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库

资源分享:对于想了解更多财经数据与量化投研的小伙伴,推荐一个专注于财经数据和量化研究的知识社区。 该社区提供相关文档和视频学习资源,汇集了各类财经数据源和量化投研工具的使用经验。 有兴趣深入学习的朋友可点此了解更多,也推荐大家关注微信公众号【数据科学实战】。

重磅推荐:AKQuant 是一款专为 量化投研 (Quantitative Research) 打造的高性能量化回测框架。它以 Rust 铸造极速撮合内核, 以 Python 链接数据与 AI 生态,旨在为量化投资者提供可靠高效的量化投研解决方案。参见AKQuant

工具推荐:期魔方是一款本地化期货量化分析工具,适合数据分析爱好者使用。无需复杂部署,支持数据分析和机器学习功能,研究功能免费开放。 如需了解更多信息可访问期魔方。

Overview

AKShare requires Python(64 bit) 3.11 or higher and aims to simplify the process of fetching financial data.

Write less, get more!

  • Documentation: 中文文档

Installation

General

bash
pip install akshare --upgrade

China

bash
pip install akshare -i https://mirrors.aliyun.com/pypi/simple/ --upgrade

Docker

Pull images

bash
docker pull registry.cn-shanghai.aliyuncs.com/akfamily/aktools:jupyter

Run Container

bash
docker run -it registry.cn-shanghai.aliyuncs.com/akfamily/aktools:jupyter python

Test

python
import akshare as ak

print(ak.__version__)

Usage

Data

Code:

python
import akshare as ak

stock_zh_a_hist_df = ak.stock_zh_a_hist(symbol="000001", period="daily", start_date="20170301", end_date="20231022", adjust="")
print(stock_zh_a_hist_df)

Output:

…

Search

AKShare ships an offline interface registry, so you can look up an interface by keyword without leaving Python and without any network request. This is especially handy for LLM-driven programs that need to resolve a description into a callable interface name.

Code:

python
import akshare as ak

search_df = ak.search("可转债 实时行情", limit=5)
print(search_df)

# full metadata of a single interface: params, output columns and a usage example
interface_info_dict = ak.interface_info("bond_cb_jsl")
print(interface_info_dict)

Output:

…

Passing a full interface name always ranks that interface first, which makes it a reliable way to confirm a half-remembered name. Note this is keyword matching rather than semantic search — see the interface search docs for what it can and cannot do.

Plot

Code:

python
import akshare as ak
import mplfinance as mpf  # Please install mplfinance as follows: pip install mplfinance

stock_us_daily_df = ak.stock_us_daily(symbol="AAPL", adjust="qfq")
stock_us_daily_df = stock_us_daily_df.set_index(["date"])
stock_us_daily_df = stock_us_daily_df["2020-04-01": "2020-04-29"]
mpf.plot(stock_us_daily_df, type="candle", mav=(3, 6, 9), volume=True, show_nontrading=False)

Features

  • Ease of use: Just one line code to fetch the data;
  • Extensible: Easy to customize your own code with other application;
  • Powerful: Python ecosystem.

Tutorials

  1. Overview
  2. Installation
  3. Interface Search
  4. Tutorial
  5. Data Dict
  6. Indicator
  7. Data Tips
  8. Trade

Contribution

AKShare is still under development, feel free to open issues and pull requests:

  • Report or fix bugs
  • Require or publish interface
  • Write or fix documentation
  • Add test cases

See the contributing guide before opening a pull request.

Notice: We use Ruff to format the code

Statement

  1. All data provided by AKShare is just for academic research purpose;
  2. The data provided by AKShare is for reference only and does not constitute any investment proposal;
  3. Any investor based on AKShare research should pay more attention to data risk;
  4. AKShare will insist on providing open-source financial data;
  5. Based on some uncontrollable factors, some data interfaces in AKShare may be removed;
  6. Please follow the relevant open-source protocol used by AKShare;
  7. Provide HTTP API for the person who uses other program language: AKTools.

Show your style

Use the badge in your project's README.md:

markdown

Using the badge in README.rst:

.. image:: https://img.shields.io/badge/Data%20Science-AKShare-green
    :target: https://github.com/akfamily/akshare

Looks like this:

Citation

Please use this bibtex if you want to cite this repository in your publications:

markdown
@misc{akshare,
    author = {Albert King and Yaojie Zhang},
    title = {AKShare},
    year = {2022},
    publisher = {GitHub},
    journal = {GitHub repository},
    howpublished = {\\url{https://github.com/akfamily/akshare}},
}

Acknowledgement

Special thanks FuShare for the opportunity of learning from the project;

Special thanks TuShare for the opportunity of learning from the project;

Thanks for the data provided by 东方财富网站;

Thanks for the data provided by 新浪财经网站;

Thanks for the data provided by 金十数据网站;

Thanks for the data provided by 生意社网站;

Thanks for the data provided by 中国银行间市场交易商协会网站;

Thanks for the data provided by 99期货网站;

Thanks for the data provided by 中国外汇交易中心暨全国银行间同业拆借中心网站;

Thanks for the data provided by 和讯财经网站;

Thanks for the data provided by DACHENG-XIU 网站;

Thanks for the data provided by 上海证券交易所网站;

Thanks for the data provided by 深证证券交易所网站;

Thanks for the data provided by 北京证券交易所网站;

Thanks for the data provided by 中国金融期货交易所网站;

Thanks for the data provided by 上海期货交易所网站;

Thanks for the data provided by 大连商品交易所网站;

Thanks for the data provided by 郑州商品交易所网站;

Thanks for the data provided by 上海国际能源交易中心网站;

Thanks for the data provided by Timeanddate 网站;

Thanks for the data provided by 河北省空气质量预报信息发布系统网站;

Thanks for the data provided by Economic Policy Uncertainty 网站;

Thanks for the data provided by 申万指数网站;

Thanks for the data provided by 真气网网站;

Thanks for the data provided by 财富网站;

Thanks for the data provided by 中国证券投资基金业协会网站;

Thanks for the data provided by Expatistan 网站;

Thanks for the data provided by 北京市碳排放权电子交易平台网站;

Thanks for the data provided by 国家金融与发展实验室网站;

Thanks for the data provided by 义乌小商品指数网站;

Thanks for the data provided by 百度迁徙网站;

Thanks for the data provided by 思知网站;

Thanks for the data provided by Currencyscoop 网站;

Thanks for the data provided by 新加坡交易所网站;

Issues· 0 开放

查看全部 Issues在 GitHub 打开
  • #7431

    fund_etf_spot_em 接口报错:AKShare 1.18.97 下返回 502 Bad Gateway

    bug更新于 2026年9月24日
  • #7428

    AKShare 接口问题报告

    bug更新于 2026年9月23日

> 标签

Pythonacademicakshareasset-pricingbond

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年10月1日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理