Library / SDK
akfamily/akshare avatar
akfamily/akshare

AKShare: A Python Interface Library for Chinese Market Data

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

22,791 stars3,528 forksPythonMIT

At a glance

What is it?
AKShare wraps hundreds of Chinese financial data endpoints behind one-line Python functions, with an offline interface registry for lookup. It is a scraper-backed library, so interface availability tracks the upstream sites rather than the release cycle.
Who is it for?
Adopt AKShare if you need pandas DataFrames of Chinese market data and can accept interfaces that depend on third-party sites. Do not adopt it if you need a contractual data SLA, tick-level history, or non-Chinese coverage as the primary source.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 7 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What AKShare Replaces for a Python Analyst

The problem AKShare addresses is narrow and practical. Chinese market data is spread across exchange pages, data portals and vendor sites, each with its own request shape, encoding and column names. AKShare collects those endpoints behind functions that return pandas DataFrames, so a backtest script does not need one parser per source. The README's own example is a single call that returns daily bars for a mainland stock, and the printed frame carries Chinese column headers such as 日期, 开盘, 收盘, 最高, 振幅, 涨跌幅 and 换手率.

The audience is quantitative researchers, students and analysts working in Python who need Chinese equities, bonds, funds, futures, options, currencies and macro series in one namespace. The package metadata lists stock, option, futures, fund, bond, index and air among its keywords, and the project topics include academic, asset-pricing and economic-data. That combination suggests coursework and research prototyping more than production trading infrastructure.

The library is not a data vendor. It is a client layer. That distinction drives most of the limitations below.

How the Interface Layer Is Organized

Every dataset is exposed as a module-level function on the akshare package. The README shows ak.stock_zh_a_hist for mainland A-share history and ak.stock_us_daily for US daily bars, and the naming follows a source-and-subject convention: stock_zh_a_hist, bond_cb_jsl, bond_zh_hs_cov_min, fund_etf_spot_em. The suffix often names the upstream provider, so the function name tells you which site the data came from.

Underneath, the dependencies in pyproject.toml describe the mechanism: requests and curl_cffi for HTTP, beautifulsoup4, lxml and html5lib for parsing, jsonpath for JSON responses, openpyxl and xlrd for spreadsheets, and py-mini-racer or akracer on Linux for JavaScript execution. A JavaScript engine in the dependency list is the clearest signal that some interfaces must run page scripts to obtain data. That is a scraping architecture, not a database replica.

AKShare also ships an offline interface registry. ak.search performs keyword matching over that registry, and ak.interface_info returns the parameters, output columns and a usage example for a named interface. The README is explicit that this is keyword matching rather than semantic search, and it points at the registry documentation for the boundaries. For an LLM-driven program that must resolve a description into a callable name, this avoids a network round trip.

Installing AKShare and Pulling a First DataFrame

The package requires 64-bit Python 3.11 or higher. The standard install is one command, and the README also gives a China mirror variant for faster downloads there.

bash
pip install akshare --upgrade

If you are installing from inside China, the README offers the Aliyun mirror instead.

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

For a container, the project publishes a Jupyter image and shows how to run it and confirm the version inside the interpreter.

bash
docker pull registry.cn-shanghai.aliyuncs.com/akfamily/aktools:jupyter
docker run -it registry.cn-shanghai.aliyuncs.com/akfamily/aktools:jupyter python
python
import akshare as ak

print(ak.__version__)

The first real use is a historical price pull. The README's example takes a symbol, a period, a date range and an adjust flag, and returns a DataFrame indexed by trading day.

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)

Expect 11 columns and one row per trading day in the range. Before writing that call into a pipeline, resolve the name through the registry: ak.search takes a keyword and a limit, and ak.interface_info takes a full interface name and returns its metadata.

python
import akshare as ak

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

interface_info_dict = ak.interface_info("bond_cb_jsl")
print(interface_info_dict)

The README notes that passing a full interface name always ranks that interface first, which makes the registry a reliable way to confirm a half-remembered name.

Where AKShare Breaks: Upstream Dependence

The main failure mode follows from the architecture. Each interface reads a third-party site, so when a page changes its markup, its request parameters or its rate limits, the corresponding function stops returning useful data until maintainers patch it. The release cadence supports that reading: the repository shows release-v1.18.96 on 2026-09-17, release-v1.18.95 on 2026-09-16 and release-v1.18.94 on 2026-08-21. Frequent patch releases are what you would expect from a library whose inputs are other people's web pages.

There is no documented retry, caching or rate-limit policy in the README. The README does not document rollback, and it does not describe how a broken interface is detected before a user hits it. If your job depends on a series being complete every morning, you are relying on an upstream site's stability and on the maintainers noticing a break.

Two more boundaries matter. First, coverage is concentrated on Chinese markets; the US daily example exists, but the interface vocabulary is dominated by mainland sources. Second, the project statement in the README says all data provided by AKShare is just something, and the sentence is cut off there. Treat the data as research input rather than a licensed feed for redistribution.

AKShare is the wrong tool when you need guaranteed delivery, when you need historical tick data, or when a compliance review requires a named data provider with a contract.

AKShare vs Tushare and yfinance

The two comparisons people search for most are AKShare against Tushare and against yfinance, and they differ on the axis that matters here: who owns the data path.

Tushare is a data service with a token-based API and an account. Data is served from the provider's own infrastructure, which gives a consistent schema and a point of accountability, and typically gates higher-frequency or wider history behind points or a paid tier. AKShare has no token and no account in the documented install path: you install the package and call a function. The trade is that you inherit each upstream site's behaviour, including its limits and its changes.

yfinance covers global markets with an emphasis outside China. If your universe is US or European equities, yfinance is the more direct fit. AKShare's strength is the Chinese instrument set: A-shares, convertible bonds, ETFs, futures and macro series that yfinance does not carry. Choosing between them is mostly a question of which market you are modelling, not which library is better.

A practical pattern is to use AKShare for the Chinese series and a second source for anything else, keeping the two behind your own loading functions so a single upstream break does not touch the rest of the pipeline.

Maintenance, Licensing and Upgrade Cost

The repository is not archived, and the last push was on 2026-09-17. Releases land close together, which means the upgrade path is frequent rather than annual. Because interfaces track live sites, a pinned version can go stale even though nothing in your own code changed. The practical cost of upgrading is re-checking the interfaces you call after each bump, since a patch release may fix one interface and change another.

Development tooling is kept out of the published package. The pyproject.toml comments explain that development dependencies moved to PEP 735 dependency groups rather than an extra, because extras ship with the package and a dev extra would install pre-commit, sphinx and ruff for end users. Documentation dependencies stay in docs/requirements.txt because Read the Docs accepts requirements files and extra_requirements but not --group. That is a small but deliberate packaging decision, and it keeps a plain pip install akshare lean.

The license is MIT, declared in both the repository and pyproject.toml. MIT is permissive: it allows commercial use and modification with the copyright notice retained. What the license does not do is grant you rights to the underlying data. The data comes from third-party sites, and their terms are separate from the library's license. Check the terms of the specific sources behind the interfaces you use before redistributing anything; that is a question for your own counsel, not something the MIT text answers.

Editorial conclusion

Adopt AKShare if you need pandas DataFrames of Chinese market data and can accept interfaces that depend on third-party sites. Do not adopt it if you need a contractual data SLA, tick-level history, or non-Chinese coverage as the primary source. Before committing, verify that the specific interface names you plan to call are listed in the registry and check the returned columns on a short date range.

Frequently asked questions

What is AKShare?

AKShare is a Python financial data interface library that wraps many Chinese market data endpoints behind functions returning pandas DataFrames. It requires 64-bit Python 3.11 or higher and installs from PyPI.

How do I install AKShare?

The README gives pip install akshare --upgrade, with an Aliyun mirror variant for installs from China. A published Jupyter Docker image is also available for running it in a container.

How does AKShare differ from yfinance?

yfinance covers global markets with an emphasis outside China, while AKShare's interface vocabulary is dominated by mainland sources such as A-shares, convertible bonds and ETFs. The choice is mostly about which market you are modelling.

How does AKShare differ from baostock?

The README does not describe baostock, so this comparison cannot be made from the available documentation. What can be said is that AKShare exposes each dataset through its own named function and ships an offline registry for looking those names up.

Official sources

  1. akfamily/akshare on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
For maintainers

Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/akfamily-akshare.svg)](https://hysenlabs.com/projects/akfamily-akshare)
Community notes

Community notes