China market data / Python SDK
PYTHON · PANDAS DATAFRAMES

Python SDK for China Stock Data

Query A-share prices, ETFs, financials, capital flows, factors, and realtime data as pandas DataFrames through methods backed by the same public API contract.

pip installpandas DataFramesConsistent symbols
01 · INSTALL

Install from PyPI

Add the SDK to notebooks, scripts and scheduled research jobs with pip.

02 · AUTH

Set one API key

Use QUANTSONAR_TOKEN or call qs.set_token() once.

03 · QUERY

Receive DataFrames

Call named methods with public symbol and date parameters.

QUICKSTART

Install, authenticate, and query

The SDK handles authentication and converts responses into DataFrames. Security symbols include the exchange suffix, such as 600519.SH.

pip install quantsonar

import quantsonar as qs
qs.set_token("qs_your_key")

df = qs.daily(
    symbol="600519.SH",
    start_date="20260101"
)
COMMON WORKFLOWS

One SDK across China market data

AUTHENTICATION

Keep credentials outside source code

For repeatable environments, set QUANTSONAR_TOKEN. See the China stock API authentication section for errors and key handling.

OTHER ACCESS

Connecting an AI agent?

Use the QuantSonar MCP server for tool-capable agents, or REST API for a language-neutral integration.

START WITH FREE

Run your first SDK query

FREE includes core daily and reference data. Compare expanded coverage and throughput on the pricing page.

Create a free API key