Free China A-share market data toolkit: direct HTTP/TCP vendors (Tencent, mootdx/TDX, Eastmoney, Sina, THS, CLS, SSE/SZSE), no API keys, no third-party data SDKs
pip install chstockdata Copy PIP instructions
pip install chstockdata # core (pandas/requests only) pip install "chstockdata[mootdx]" # + mootdx TCP K-line source (optional) pip install "chstockdata[baostock]" # + historical turnover for CYQ chips (optional) from chstockdata import get_stock_data, get_realtime_snapshot, resolve_ticker resolve_ticker("贵州茅台") # -> "600519" (Chinese name -> 6-digit code) df = get_stock_data("600519", 365) # daily OHLCV, vipdoc/mootdx/Sina chain get_realtime_snapshot("600519") # realtime quote, Tencent -> mootdx -> Sina 53 public functions: K-lines, realtime quotes, fundamentals / three financial statements, valuation history, margin trading, dragon-tiger board (per-stock seats and whole-market daily), lockup expiry, northbound flow, fund flow, board fund flow, industry comparison, concept blocks, block trades, market breadth, limit-up / failed-board / limit-down / previous-day limit-up pools, CYQ chip distribution, ETF option chains (T-quote + greeks + IV), investor Q&A (互动易), hot rank / popularity rank / concept hits, insider transactions, shareholder pledge / buyback, corporate actions, earnings forecast, research reports, news wires, policy news, macro indicators, trading calendar, delisting / suspension info, and more. See chstockdata/__init__.py for the full export list.
All Eastmoney requests go through a module-level serial throttle (EM_MIN_INTERVAL, default 1.0s) with jitter and a shared keep-alive session — do not bypass it, do not fan out concurrent full-market scans. push2 / push2his are deliberately not used (see tests/test_astock_push2_source_scan.py).
This package is not a scraper starter kit; it is an extraction of a data layer that survived months of live A-share analysis runs:
Zero-config works out of the box. Optional overrides, in priority order:
from chstockdata import configure configure(cache_dir="...", vipdoc_dir="...", vipdoc_enabled=True, vipdoc_max_staleness_days=5, northbound_store_path="...") Environment variables (both prefixes accepted): CHSTOCKDATA_CACHE_DIR, CHSTOCKDATA_VIPDOC_HISTORY_DIR, ... or the legacy TRADINGAGENTS_VIPDOC_HISTORY_* / TRADINGAGENTS_DATA_CACHE_DIR names. Tuning knobs: EM_MIN_INTERVAL (Eastmoney throttle seconds), TDX_MIN_INTERVAL, TDX_TOOL_PROBE_BUDGET_SECONDS, EASY_TDX_PYTHON (path to an isolated venv python with easy-tdx==1.20.6).
pip install "chstockdata[mcp]" chstockdata-mcp Then register in any MCP client (Claude Code, etc.):
{ "mcpServers": { "chstockdata": { "command": "chstockdata-mcp" } } } Risk & usage notes All endpoints are public, unofficial interfaces of the respective vendors. Rate-limit thresholds cited anywhere in the docs are community observations, not vendor guarantees; endpoints can break or change at any time without notice. Built-in throttling must be kept as-is. For heavy or commercial workloads use official paid feeds (Eastmoney Choice, exchange data services). Data is provided for research/educational purposes, as-is, with no warranty of accuracy or fitness for trading decisions. Relationship to upstream projects Extracted from TradingAgents-astock (Apache-2.0, itself a fork of TauricResearch/TradingAgents). Starting with 0.2.0, selected upstream-unique endpoints of a-stock-data (Apache-2.0) were reverse-ported: ETF options (contracts / T-quote / greeks + IV), limit-up pools (including the previous-day pool and THS limit-up reasons), CYQ chip distribution, market-wide dragon-tiger board, board fund flow, investor Q&A (互动易), hot rank / popularity rank / concept hits, and the upstream ticker routing fix (market identifier conflicts fail loud; 5x ETFs route to Shanghai).
This package is still not a full superset of a-stock-data. Deliberately not included: intraday anomaly pools (product hard boundary in the source project), Shenwan industry history, minute/tick order flow, and any push2/push2his dependency (board fund flow uses the non-push2 bkzj endpoint with a reduced field set — no four-tier breakdown). See MIGRATION.md and docs/planned-upstream-ports.md.
a-share china stock market-data quant quantitative-finance
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
The dropdown lists show the available interpreters, ABIs, and platforms.
Enable javascript to be able to filter the list of wheel files.
Copy a direct link to the current filters Copy
Details for the file chstockdata-0.2.0.tar.gz.
The following attestation bundles were made for chstockdata-0.2.0.tar.gz:
Publisher: publish.yml on joycoding2000/chstockdata




