explaingit

1nchaos/adata

4,499PythonAudience · dataComplexity · 2/5Setup · easy

TLDR

A free Python library for fetching Chinese A-share stock market data, daily prices, real-time quotes, dividends, order book data, and more, built for individual quantitative traders who want clean data without a paid subscription.

Mindmap

mindmap
  root((AData))
    What it does
      Chinese A-share data
      Quantitative trading support
      Multiple data sources
    Data Types
      Daily and intraday prices
      Real-time quotes
      Dividends and calendars
      ETFs and indices
    Sources
      TongHuaShun
      EastMoney
      Automatic fallback
    Setup
      pip install
      Proxy config optional
    Audience
      Quant traders
      Data analysts
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Fetch daily historical price data for any Chinese A-share stock to backtest a quantitative trading strategy.

USE CASE 2

Get real-time quotes and five-level order book data for live analysis of Shanghai and Shenzhen stocks.

USE CASE 3

Access industry classifications and concept group memberships for stock screening and filtering.

USE CASE 4

Build a data pipeline that automatically switches between TongHuaShun and EastMoney if one source becomes unavailable.

Tech stack

Python

Getting it running

Difficulty · easy Time to first run · 5min

Install with a single pip command, all documentation is in Chinese, which may require translation for non-Chinese speakers.

No license information is specified in the repository.

In plain English

AData is a free, open-source Python library that provides access to Chinese A-share stock market data, built for people constructing quantitative trading strategies. "A-shares" are the domestic stocks listed on the Shanghai and Shenzhen stock exchanges inside mainland China. The library gives you a consistent Python interface to fetch prices, trading history, and company information for those stocks. The library covers a wide range of data types: daily, weekly, and monthly price histories (called K-line data in Chinese financial convention), real-time quotes, intraday minute-level data, dividend records, industry classifications, concept group memberships, stock index compositions, and the official trading calendar. Most of this data is assembled by pulling from several public Chinese financial data providers, including TongHuaShun and EastMoney, and merging them automatically. If one source becomes unavailable the library can switch to another, which the project describes as its main strategy for keeping data accessible. You can also configure a proxy to route requests through a different IP address if the public sources impose access limits. Installation is a single pip command. Once installed, a call like adata.stock.info.all_code() returns a table of every listed A-share code and company name. A call like adata.stock.market.get_market() with a stock code and date range returns the full daily price history for that ticker as a data table ready to work with in Python. Other calls cover real-time snapshots, five-level order book data, ETF and fund data, and macro indicators. The project focuses entirely on A-shares and is not aimed at US, Hong Kong, or other markets. Its stated goal is to support individual quantitative traders who want clean, reliable data without paying for a commercial data subscription. The README and all documentation are written in Chinese, reflecting its primary audience.

Copy-paste prompts

Prompt 1
Using the adata Python library, write a script that fetches the last 365 days of daily price data for stock code 000001, calculates a 20-day moving average, and plots the result.
Prompt 2
How do I use adata to get real-time quotes and the five-level order book for a list of A-share stock codes? Show a Python example that prints the current bid and ask prices.
Prompt 3
Write a Python script using adata that retrieves all stocks in a specific industry category and saves their codes, names, and latest closing prices to a CSV file.
Prompt 4
I want to build a simple momentum strategy for Chinese A-shares using adata. Show me how to fetch monthly price data for all listed stocks and rank them by 3-month return.
Open on GitHub → Explain another repo

← 1nchaos on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.