adata: a pandas front end over public A-share quote pages, with a global proxy switch for when they push back
免费开源A股量化交易数据库; 专注A股,专注量化,向阳而生; 开放、纯净、持续、为Ai(爱)发电。为个人量化交易而生,保卫3000点,珍惜底部机会......【股票数据,股票行情数据,股票量化数据,股票交易数据,k线行情数据,股票概念数据,股票数据接口,行情数据接口,量化交易数据】【多数据源融合,动态设置代理,保障数据高可用性】
At a glance
- What is it?
- adata is a Python package that returns China A-share codes, K-lines, concepts and index members as DataFrames. It scrapes public interfaces from several sources and switches between them, so its limits are set by those sources.
- Who is it for?
- Use adata for personal A-share research and backtests where a DataFrame of daily K-lines, concept membership and index constituents is enough, and where you can tolerate scraped public interfaces changing. Do not build anything that needs a contractual data feed on it.
- Can I use it commercially?
- Yes. Apache-2.0 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 November 7, 2026, and from our analysis. They are not legal advice.
Star history
- 1nchaos/adata5,364 ★ · +64
| Repository | 2026-10-21 | 2026-11-07 |
|---|---|---|
| 1nchaos/adata | 5.3k | 5.4k |
64 Stars in the last 17 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Public quote pages are the data source, which is why a proxy switch exists
adata does not run a data service of its own. The README says the project is built on public interfaces that may impose restrictions, and that is the stated reason for its proxy feature. Individual rows in the data list name their origins: share capital from 东方财富, the 申万 industry classification from 百度, concept data from 同花顺 and 东方财富, the trading calendar from 深交所, and real-time quotes from 新浪 and 腾讯.
To keep a single outage from stopping everything, the project describes a multi-source design. For real-time quotes, the data list says there are two sources, Sina and Tencent. The description line adds that proxies can be set dynamically and that several sources are fused to keep availability high.
The consequence follows from the design. Every function depends on a third party page you do not control, so a change on their side can break a call without any change in this repository.
Installing is one pip line, with mirror advice for readers in China
The README installs the package from PyPI:
# 首次安装
pip install adata
# 指定镜像源
pip install adata -i http://mirrors.aliyun.com/pypi/simple/
# 升级版本
pip install -U adata
# 指定镜像源
pip install -U adata -i http://mirrors.aliyun.com/pypi/simple/It notes that domestic mirrors may lag, and lists three sources: Aliyun, marked recommended, Tsinghua at https://pypi.tuna.tsinghua.edu.cn/simple, and the official https://pypi.org/simple. If a fresh release does not appear through a mirror, switching to the official index is the documented fix.
setup.py declares four dependencies: requests>=2.16.0, pandas>=0.22.0, beautifulsoup4>=4.0.2 and py_mini_racer>=0.6.0, while requirements.txt also lists mini-racer>=0.12.0. The presence of a JavaScript engine package among them is a fact worth checking on your platform, since native wheels differ by operating system and Python version. The classifiers list Python 3.6 through 3.12.
From all_code() to get_market(): two calls produce a K-line DataFrame
The first call lists every stock code:
import adata
res_df = adata.stock.info.all_code()
print(res_df)The sample output has the columns stock_code, short_name and exchange, with 5493 rows in the sample.
The second call fetches a K-line for one code:
import adata
# k_type: k线类型:1.日;2.周;3.月 默认:1 日k
res_df = adata.stock.market.get_market(stock_code='000001', k_type=1, start_date='2021-01-01')
print(res_df)k_type 1 is daily, 2 weekly and 3 monthly, with daily as the default. The sample output carries trade_time, open, close, pre_close, stock_code and trade_date among 13 columns, 576 rows from 2021-01-04 to 2023-05-22. The README example starts at one date and gives no end date argument in the example, so check the data dictionary for how to bound a range.
The catch is that this covers K-line frequencies only. Minute bars for past days are not offered: the data list says stock.market.get_market_min() returns only the current day.
The data list is split between stock.info and stock.market
Past the quick start, the README points to a data list and a data dictionary on the project site. The stock.info group covers basics. stock.info.all_code() gives all codes, stock.info.get_stock_shares() gives one stock's share capital, and stock.info.get_industry_sw() gives its Shenwan level one and two industries. Index functions include stock.info.all_index_code(), whose note warns that 同花顺 may re-encode index codes, and stock.info.index_constituent(). The calendar comes from stock.info.trade_calendar().
The stock.market group handles prices: stock.market.get_dividend(), stock.market.get_market(), stock.market.get_market_min() and the real-time stock.market.list_market_current(), which returns the latest quotes for several stocks. A five-level order book call, stock.market.get_market_five(), is listed too, as a real-time call with two data sources, one of them Tencent.
The README tells readers to find the function in the data dictionary and read its docstring before using it. For anything not in the quick start, that docstring is the documented source of parameters.
Two concept sources, 同花顺 and 东方财富, that can disagree
Concept data is the part of adata with the most duplication. Under 同花顺 you get stock.info.all_concept_code_ths() for all concept codes, stock.info.concept_constituent_ths() for a concept's members and stock.info.get_concept_ths() for the concepts a single stock belongs to. Under 东方财富 the same three exist as stock.info.all_concept_code_east(), stock.info.concept_constituent_east() and stock.info.get_concept_east(), plus stock.info.get_plate_east() for industry, regional and concept plates in one call.
The README warns that the constituent functions return only stock code and short name, so you look a concept up by its name. It does not say how the two vendors' concept lists compare, and nothing suggests that a concept appearing in both has the same members.
If you need a screen such as every stock in a concept, choose one vendor and stay with it. Merging the two sources is left to you.
adata.proxy() is a global setting that fetches a new IP on every request
Proxy support is one function:
import adata
# 设置代理,代理是全局设置,代理失效后可重新设置。参数:ip,proxy_url
adata.proxy(is_proxy=True, ip='60.167.21.27:1133')
res_df = adata.stock.info.all_code()
print(res_df)The comment says the proxy is global and, once it stops working, can be set again. Two parameters are mentioned: ip for a fixed address and proxy_url for a link that returns a proxy IP. You choose one of the two.
The notes carry a cost warning. With proxy_url, a new IP is fetched on every request, and to save IP resources the README advises running your own proxy pool. Global scope means every call in the process goes through the same proxy, so a dead proxy affects all of them until you reset it. There is no mention of automatic rotation or retry on the user's side of the call.
Licensing signals disagree, and the last release is from April 2025
GitHub reports the license as Apache-2.0. setup.py, however, declares the classifier License :: OSI Approved :: MIT License, and the README badge links to a LICENSE file on Gitee. Check the LICENSE file in the repository before you redistribute anything built on it.
The release list ends with v2.9.0 on April 2, 2025, preceded by v2.8.0 on December 25, 2024 and v2.7.0 on October 16, 2024. The latest push to main was on October 31, 2026, so commits continue after the last tagged release. A HISTORY.md file sits at the top level for version notes, though its contents are not part of the README.
Because the project is built on public interfaces that may impose restrictions, a nightly job should check its own output, for example row counts for a known date, instead of trusting an empty DataFrame as correct.
Editorial conclusion
Use adata for personal A-share research and backtests where a DataFrame of daily K-lines, concept membership and index constituents is enough, and where you can tolerate scraped public interfaces changing. Do not build anything that needs a contractual data feed on it. Before committing, run adata.stock.market.get_market on the symbols and date range you care about and compare a few rows with a brokerage chart, because the data comes from public interfaces that may impose restrictions.
Frequently asked questions
How do I install adata?
Run pip install adata, and pip install -U adata to upgrade. The README suggests the Aliyun mirror with -i http://mirrors.aliyun.com/pypi/simple/ and the official index at https://pypi.org/simple when a mirror lags.
What data does adata return for A-shares?
Stock codes, daily, weekly and monthly K-lines, dividends, today's minute bars, real-time quotes, concept and index membership, industry data and the trading calendar, all as pandas DataFrames.
Does adata support a proxy?
Yes. adata.proxy(is_proxy=True, ip='60.167.21.27:1133') sets a global proxy, and proxy_url can supply an IP link instead. The README recommends a self-built proxy pool because each request fetches a new IP.
Which Python versions does adata support?
The classifiers in setup.py list Python 3.6 through 3.12. The dependencies include requests, pandas, beautifulsoup4 and py_mini_racer.
Official sources
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.
[](https://hysenlabs.com/projects/1nchaos-adata)Star history chart for your README
[](https://hysenlabs.com/projects/1nchaos-adata)Was this useful?