All tools · Guides

AKShare volume discrepancy: a troubleshooting record

Two samples from the 1.20.24 Tencent daily-bar interface

Author: AI Quant Nav maintainer. Checked: 4 November 2026.

A successful response with all expected fields does not mean that two stocks use the same volume unit. A replay of real responses through AKShare stock_zh_a_hist_tx 1.20.24 left one stock's volume unchanged and multiplied the other's by 100. The sz000 prefix condition needs further checking; this is no basis for multiplying every stock's data by 100.

1. What was checked

The lead was AKShare issue #7485. The reporter used version 1.20.24 on Windows with Python 3.13.3, querying unadjusted daily bars for sz000651 and sz300533 from 2026-10-15 through 2026-11-03. [1]

The original verification environment was Python 3.12.14 with pandas 2.2.3. The official PyPI 1.20.24 wheel was downloaded, and the unchanged stock_zh_a_hist_tx function was extracted. Real responses from Tencent's newfqkline endpoint were saved and substituted for the function's HTTP dependency. The listing-date lookup was replaced with a date before the test interval to avoid another network request. [2]

This was a real-response offline replay, not a complete AKShare installation test or a reproduction of the reporter's Windows / Python 3.13 environment. That distinction limits the conclusions.

2. What differed between the two samples

Parameters: start_date="20261015", end_date="20261103", adjust="". Each stock had 14 trading days in the target interval.

On 2026-11-03:

In 1.20.24, stock_hist_tx.py maps the sixth raw array item to volume, then applies this condition: [2][3]

if not symbol.startswith(("sh688", "sz399", "sh000", "sz000")):
    big_df["volume"] = big_df["volume"] * 100

sz000651 matches the excluded sz000 prefix; sz300533 does not. This agrees with the replay. The function's documentation declares volume in shares, so the classification of sz000 stocks in this condition needs checking.

3. Cross-checking units

This check adopts another assumption from the function itself: the ninth raw array item, amount, multiplied by 10,000 is in yuan. Dividing that amount by volume gives an implied price to compare with the same day's unadjusted low and high.

Results on 2026-11-03:

For each stock, all 14 ratios using raw volume times 100 were within that day's price range; none using unscaled volume were. This supports a raw unit of lots of 100 shares for these two samples.

This is only an auxiliary consistency check. Amount units, field positions, transaction coverage and price basis must first be verified. Missing amount, adjusted prices mixed with original amount, special transactions or changed endpoint fields can invalidate it. It must not become an automatic data-repair rule.

4. How to replay the evidence

The downloadable package contains two saved full responses, target-interval CSVs and replay.py. The responses were captured on 2026-11-04 and include dates outside the target interval. The script selects the dates above without editing the raw files.

Extract into an independent folder. Python 3.12 is recommended for the original pandas 2.2.3 dependency. Save a separate copy of the reference CSVs first: rerunning overwrites the output files. On Windows, create the environment with py -3.12, then use .venv\Scripts\python; the package README includes complete Windows commands. For macOS/Linux:

python3 -m venv .venv
.venv/bin/python -m pip install pandas==2.2.3
.venv/bin/python -m pip download --no-deps --only-binary=:all: akshare==1.20.24 -d wheels
.venv/bin/python -X utf8 replay.py

This downloads the wheel but does not install AKShare. The script extracts functions and constants and replays the saved responses. It prints raw volume, function output, multiplier and price-range comparisons. Expect 14 rows per stock, including the 2026-11-03 results above. -X utf8 avoids locale-dependent snapshot decoding.

SHA-256 of the official 1.20.24 wheel:

28311691a221a2b6b55c417c6d7a2ca7fb5c5be9ee458ccc610fab46f89295d1

Prepublication check: the unchanged script was rerun with the existing Windows Python 3.14.2 / pandas 2.3.3 environment, without installing dependencies. Both stocks produced 14 rows. All fields matched the original CSVs; bytes matched after CRLF/LF normalization. This is an offline replay in another environment, not a reproduction of the original environment. The public package preserves the reviewed raw responses, CSVs, script and original log byte for byte; it omits the review draft and adds run instructions and a public checksum manifest.

A complete environment test would require a separate isolated AKShare installation of the specified version, direct calls to the issue's examples, and records of OS, Python, dependencies and actual responses. That test was not completed here. Online endpoints can change; future downloads need not match this snapshot.

5. Current status and limits

As checked on 2026-11-04, issue #7485 remains open. The evidence was posted by the GitHub account maintaining this site; no project-maintainer confirmation or released fix was found. [1][4] A third party has proposed PR #7488, but it is still unmerged. This article does not verify that PR's patch or tests and does not treat a pending proposal as a released fix. [7]

The latest PyPI version at the check was 1.20.25, released on 2026-11-03. Its wheel was also downloaded: stock_hist_tx.py was byte-identical to 1.20.24. This is a source-file comparison, not a full runtime reproduction of the latest version or a claim about future releases. [5]

Only stock_zh_a_hist_tx was checked. It differs from the Eastmoney stock_zh_a_hist used by this site's ingestion guide; the findings must not be attributed to both interfaces. Another project previously addressed Tencent STAR-market units, but its endpoint, version and samples differ, so its fix cannot be transferred directly. [6]

Until the rules are clarified, keep original responses, source, version and validation results, and isolate suspect batches for inspection. Do not multiply an entire database by 100: historical data may already have been converted or may mix sources. This article does not cover indices, STAR-market stocks, Beijing Stock Exchange stocks, other markets or adjustment modes, and provides no verified repair patch.

Sources

This article was prepared with AI assistance using saved real responses, function-replay output and public-source checks. No complete installation-environment test was performed. It is a data-engineering troubleshooting record, not investment advice.