China A-Share Market Data API Integration: A Four-Layer Guide to Quotes, Price Adjustments, Fundamentals, Real-Time Streaming, and AI Workflows
作者: TickDB Research · 发布: 2026/9/17 · 阅读: 10
标签: 官网
When I first built a China A-share strategy in Python, I pulled daily OHLCV kline data, ran a backtest, and the equity curve looked good. I thought the data layer was done.
Then the bugs arrived one by one. On ex-dividend dates, my strategy flagged phantom price drops — the raw kline data had no adjustment factors, so splits and dividends looked like real price moves. When I tried to model execution slippage, I realized I only had kline bars and no order book depth, so I hardcoded a fixed spread and hoped it was close. When I tried to add P/E filters to my universe, I discovered that fundamental coverage — which stocks, which exchanges — was never clearly documented anywhere.
These weren't API connectivity failures. They were the result of not knowing, from the start, that China A-share market data comes in at least four distinct layers. Each layer solves a different class of problem. Missing any one of them means your pipeline fails at a specific, predictable point.
This article does two things: first, lay out the four-layer structure of A-share market data so you can draw your data architecture before you write the first line of integration code; second, walk through each layer using a specific API provider (TickDB) as the reference implementation, with actual endpoint responses, field-level explanations, and coverage boundaries.
A Brief Note on China A-Shares
For readers less familiar with China's equity markets: A-shares are stocks listed on the Shanghai Stock Exchange (SSE, exchange suffix .SH) and the Shenzhen Stock Exchange (SZSE, exchange suffix .SZ). They trade in Chinese yuan (RMB), settlement is T+1, and daily price moves are capped at ±10% (±20% on the first few days for newly listed stocks and stocks at risk of delisting). China also has a Beijing Stock Exchange (BSE, suffix .BJ) for SME-focused listings, though its data coverage and API support tend to be more limited.
A-shares have a few quirks that international developers frequently get wrong on first contact: a call auction period at market open (and close) during which no continuous trading occurs; a different set of adjustment conventions for splits and dividends; and fundamental data coverage boundaries that don't follow exchange listing status exactly. All of these come up in this guide.
The Four-Layer Architecture
Market data for A-shares isn't one thing — it's a four-layer stack:
┌─────────────────────────────────────────────────────────────┐
│ Access Layer (how to get it) │
│ REST │ WebSocket │ AI-Native (Skill / MCP / CLI) │
└──────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────────▼──────────────────────────────────┐
│ Fundamentals Layer (what the company is) │
│ Profile │ Financials │ Valuation │ Industry │ Shareholders │
│ Capital Actions │ Event Calendar │
└──────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────────▼──────────────────────────────────┐
│ Reference Data Layer (when and for what) │
│ Trading Calendar │ Sessions │ Stock Info │ Symbol Directory │
│ Index Metrics │
└──────────────────────────┬──────────────────────────────────┘
│
┌──────────────────────────▼──────────────────────────────────┐
│ Market Data Layer (what the market did) │
│ Snapshot │ Kline │ Adjustment Factors │ Intraday │
│ Order Book │ Tick Trades │ Capital Flow │
└─────────────────────────────────────────────────────────────┘
Market data is the foundation. Reference data is the scaffolding. Fundamentals add depth. The access layer is the delivery mechanism. Each missing layer is a specific failure mode waiting in your production code.
Everything below uses TickDB as the concrete reference. It covers all four layers for A-shares. The goal here is to establish the structure first, then drill into the details.
Coverage at a Glance
┌─────────────────────────────────────────────┐
│ A-Share Data Coverage (as of 2026-09-15) │
├─────────────────────────────────────────────┤
│ Exchanges │ SSE (SH) + SZSE (SZ) │
│ Symbols │ All A-share stocks + major │
│ │ indices │
│ Data types │ Tick / Trade / Depth (L2) │
│ Latency │ 3-second snapshots / tick │
│ History │ Up to 10 years of kline data │
│ │ (plan tiers: 1 / 3 / 10 yr) │
│ Access │ REST + WebSocket │
│ │ + AI-native (Skill/MCP/CLI) │
│ Fundamentals│ SSE + SZSE individual stocks │
│ │ (excludes BSE, excludes ETFs) │
└─────────────────────────────────────────────┘
In plain terms: all A-share stocks on Shanghai and Shenzhen exchanges, L2 tick data, up to 10 years of historical klines (depending on plan tier), and fundamentals for SSE and SZSE individual stocks — but not Beijing Stock Exchange stocks, and not ETFs.
Which Reader Are You
You → open this article
│
├── Individual quant developer
│ └─→ Market Data Layer + Adjustments + minimum viable stack
│
├── Small team data engineer
│ └─→ Reference Data + Fundamentals + data architecture
│
├── AI / LLM workflow builder
│ └─→ AI-native access + Agent workflow patterns
│
└── Financial product team
└─→ Access Layer + coverage boundaries + POC checklist
Layer 1 — Market Data: What the Market Did
Market data is the foundation. If the foundation is wrong, everything above it is wrong.
| Data Type | Coverage | What Problem It Solves | Who Uses It |
|---|---|---|---|
| Real-time Snapshot | Single symbol / batch / full market; open field absent during call auction | Live monitoring, open signal detection, pre-order validation | Intraday strategies, dashboards, AI agents |
| Kline & History | 1m to 1M intervals; A-shares: 5 adjustment types; HK/US: 3 types | Backtesting, factor computation, charting, long-term returns | Quant research, strategy development |
| Adjustment Factors | One record per corporate action for forward/backward adjustment | Building your own adjustment logic, cross-source validation | Custom backtest frameworks, audit scenarios |
| Intraday (Minute Line) | Minute-level price path: price, volume, turnover, VWAP | Intraday research, open-market impact | Intraday strategies, session monitoring |
| Order Book (Market Depth) | Multi-level bid/ask; enhanced, historical, and statistical variants | Slippage estimation, liquidity analysis | Execution algorithms, liquidity products |
| Tick Trades | Trade-by-trade records, VWAP, aggregated trades, price distribution | True buy/sell pressure, large-order behavior | Order flow research, execution systems |
| Capital Flow | Institutional net inflow, institutional buy/sell volume, retail net inflow | Institutional money direction, sentiment quantification | Sentiment factors, flow monitoring |
Real-Time Snapshot
Single symbol, batch, or full-market — three modes. Actual API response:
{
"symbol": "688256.SH",
"name": "Cambricon Technologies",
"type": "stock",
"category": "CN",
"last_price": "1086.58",
"open": "1055.00",
"prev_close": "1053.98",
"volume_24h": "9102334",
"high_24h": "1092.50",
"low_24h": "1048.00",
"timestamp": 1754118000000
}
During A-share call auction periods (9:15–9:25 AM and 14:57–15:00 PM), the open field is absent. This is valid API behavior, not a bug.
Using the presence or absence of the open field to determine whether continuous trading has begun is more robust than comparing against wall-clock time. This distinction determines whether your open-market signals fire during the call auction (wrong) or only after the continuous session starts (right).
Batch mode can monitor hundreds of symbols simultaneously — the foundation of cross-market watchboards.
Kline Data and Historical Prices
Multiple intervals from 1-minute to monthly. For A-share stocks, five adjustment types are supported: unadjusted, forward-adjusted (前复权), backward-adjusted (后复权), forward additive adjustment, and backward additive adjustment. For Hong Kong and US stocks, only the first three are available.
{
"symbol": "688256.SH",
"interval": "1d",
"adjust": "forward",
"klines": [
{"timestamp": "2026-08-01T00:00:00Z", "open": 1040.00, "high": 1068.88, "low": 1030.01, "close": 1053.98, "volume": 8234521},
{"timestamp": "2026-08-02T00:00:00Z", "open": 1055.00, "high": 1092.50, "low": 1048.00, "close": 1086.58, "volume": 9102334}
]
}
The endpoint returns completed historical bars only. The currently forming bar (the live, still-open period) requires a separate endpoint. Treating an in-progress bar as a completed bar introduces look-ahead bias — a signal triggered by bar N fires using data that doesn't yet exist at the start of bar N.
Adjustment Factors
An adjustment factor is not a ratio. It is an affine transformation.
Each corporate action generates two records — one for forward adjustment, one for backward. The formula is:
adjusted_price = raw_price × factor_a + factor_b
For A-share stocks, factor_b is always 0, so the calculation simplifies to raw_price × factor_a. The value of exposing the raw factor rather than pre-computing adjusted prices is that you control the adjustment logic — you're not locked into the data provider's conventions.
Forward adjustment (前复权) scales historical prices up to align with the current price level. Best for charting and comparing current signals to recent history. Backward adjustment (后复权) scales the current price down to align with the historical series. Best for long-term backtesting at fixed capital levels.
Mixing forward and backward adjustment in the same price series introduces systematic error — it is equivalent to running two different time bases through the same data pipeline.
Order Book, Tick Trades, and Capital Flow
Order Book — multi-level bid/ask depth:
{
"symbol": "688256.SH",
"bids": [
{"price": 1086.00, "size": 200},
{"price": 1085.50, "size": 300}
],
"asks": [
{"price": 1086.50, "size": 100},
{"price": 1087.00, "size": 350}
]
}
Order book data is latency-sensitive. Before relying on it for a specific market or session, verify actual availability — the existence of an endpoint does not guarantee full-market coverage across all sessions.
Tick Trades — trade-by-trade records including price, quantity, timestamp, and aggressor direction. Tick data reflects buying and selling intent earlier than kline bars do. It is the raw material for execution quality analysis, custom aggregation schemes (volume bars, dollar bars), and order flow microstructure research.
Capital Flow — institutional net inflow, institutional buy/sell volume, retail net inflow. A note on methodology: there are at least three common classification schemes for "large order" vs. "small order" in Chinese market data, and they are not compatible across providers. Comparing capital flow figures from two different data sources is equivalent to measuring the same object with two different rulers. Before drawing cross-source conclusions, align on the exact classification methodology.
Key Insight — Market Data Layer
If you only integrated kline and ticker, your strategy will produce an unexplained drawdown on at least one of these four event types: ex-dividend dates, call auction periods, trading halts, and contract rollovers. Not might — will.
Layer 2 — Reference Data: When and for What
Reference data is the scaffolding. Without it, market data is a pile of numbers with no verified context.
| Data Type | Coverage | What Problem It Solves | Who Uses It |
|---|---|---|---|
| Trading Calendar | Per-market list of trading days, including public holidays | Backtest time series alignment, gap detection | All backtest systems |
| Trading Sessions | Full session schedule: call auction, continuous trading, lunch break, close | Real-time strategy state machine | Live systems, AI agents |
| Stock Reference Info | Name, exchange, currency, share count, EPS, BPS, dividend yield | Valuation computation, symbol identity | Valuation screening, AI Q&A |
| Index Metrics | Market breadth, advance/decline count, aggregated statistics | Macro analysis, market-state classification | Macro timing, sentiment models |
| Symbol Directory | Full list of queryable symbols, by market and type | Stock screening candidate pool, UI autocomplete | Product development, research prep |
Trading Calendar
The essential input to any backtest time series. A common early mistake: requesting the calendar with from/to parameters and getting a 400 error, then finding that the API expects beg_day/end_day instead. Never guess parameter names from convention — read the documentation or test directly.
A-share, Hong Kong, US, and futures markets have different holiday schedules. Multi-market research requires maintaining a separate trading calendar per market. Using "weekdays except public holidays" as a proxy is the most common backtest time series error. If your framework's calendar diverges from the actual market calendar, signal timing will be systematically offset.
Trading Sessions
Returns the complete session schedule for a given market on a given date. A-share sessions include a morning call auction (9:15–9:25), morning continuous trading (9:30–11:30), lunch break (11:30–13:00), afternoon continuous trading (13:00–14:57), and a closing call auction (14:57–15:00). Hong Kong has a lunch break. Commodity futures in China have a night session.
These periods are "data exists but cannot be used under normal assumptions." Not handling them means your strategy may receive signals during a call auction period and interpret them as continuous-session data — a silent, hard-to-trace error.
Stock Reference Info
Returns name, exchange, currency, total shares, EPS, BPS, and dividend yield. This is the starting point for valuation calculation: current price divided by BPS gives P/B, divided by EPS gives P/E.
Key Insight — Reference Data Layer
Trading calendar and trading session data are not optional knowledge. They are facts that must be explicitly handled in the data layer. Otherwise your intraday data will contain session gaps that confuse aggregation logic, or your strategy will receive signals during a non-trading period and behave as though they're valid.
Layer 3 — Fundamentals: What the Company Is
Fundamentals are the depth dimension. Market data tells you how the price moved; fundamentals tell you what the company is worth.
Coverage boundary up front: the fundamentals API used in this article covers SSE (SH) and SZSE (SZ) individual stocks. It does not cover Beijing Stock Exchange (BSE/BJ) stocks. It does not cover ETFs on any exchange.
| Data Type | Coverage | What Problem It Solves | Who Uses It |
|---|---|---|---|
| Company Profile & Management | Company info, business description, executive roster | Research starting point, governance analysis | Fundamental research, event-driven |
| Financial Statements | P&L, balance sheet, cash flow; latest period, annual, TTM | Multi-factor, earnings quality, valuation base | Financial factors, quality strategies |
| Segment Data | Revenue by business line or geography, with time series | Revenue structure analysis, geographic risk | Deep fundamental research, risk attribution |
| Valuation Metrics | P/E, P/B, P/S, dividend yield; snapshot, time series, 1Y high/low | Valuation percentile, style rotation | Value strategies, market timing |
| Industry Analysis | Peer company list, sector valuation distribution, industry ranking, classification tree | Cross-company comparison, sector rotation | Sector strategies, comparative analysis |
| Capital Actions | Dividend history (incl. TTM), buybacks, corporate actions | Event-driven, income strategies, backtest adjustment | Dividend strategies, event research |
| Shareholders & Funds | Current ownership structure, top-10 shareholders, individual holder detail, fund holdings | Positioning analysis, institutional behavior | Ownership factors, institutional tracking |
| News & Event Calendar | Company news + market-wide calendar (earnings, dividends, splits, IPOs, macro, closures, mergers) | Event-driven, risk blackout dates | Event strategies, risk systems |
Company Profile and Financial Statements
Company profile returns basic information, business description, listing details, and headcount. Management roster returns current executives and board members for governance analysis.
The three financial statements are the core of fundamental research. TTM (trailing twelve months) is only available for income statements and cash flow statements — it does not apply to the balance sheet. This is basic accounting convention, but many data providers don't surface it clearly, and treating a balance sheet value as a TTM figure produces incorrect ratios.
When working with financial data: always include the reporting period and unit in your analysis. When comparing across companies, confirm currency consistency. When comparing across time, confirm reporting period alignment.
Valuation and Industry Analysis
Valuation metrics return P/E, P/B, P/S, and dividend yield as both a current snapshot and a historical time series, including one-year high, low, and median. Percentile analysis against historical valuations is the standard method for gauging whether current valuation is high or low relative to the stock's own history. Valuation fields must specify the price reference date to have any comparative meaning.
Industry analysis returns peer company lists, sector-level valuation distributions, ranking within sector, and the sector classification hierarchy. This is the input for cross-company valuation comparison and sector rotation research.
Capital Actions and Shareholders
Capital actions include dividend history (including TTM), buyback records, and corporate actions (splits, reverse splits, rights offerings, ticker changes). Ex-dividend dates are the trigger for downward price gaps in A-share kline data. Backtests that don't account for this will misread every dividend payment as a price decline signal.
Shareholder data covers current ownership structure, top-10 holders, individual holder detail, and fund holdings. Major holder position changes are a meaningful market signal. Shareholder data is subject to disclosure delays — it cannot be used as a real-time signal.
Key Insight — Fundamentals Layer
Knowing what isn't covered is more important than knowing what is. SSE and SZSE individual stocks are covered. BSE stocks and ETFs are not. That boundary defines the outer limit of your multi-factor stock selection universe — and you need to know it before you build the screening logic, not after you've been silently excluding symbols you thought were included.
Layer 4 — Access: How to Get It
The access layer is the delivery mechanism. The same underlying data, three access patterns, three different use cases.
┌──────────────────────────────────────────────────────────────┐
│ Your Application │
│ Research script │ Live dashboard │ Trading system │ AI Agent │
└───────┬──────────┬──────────┬──────────┬─────────────────────┘
│ │ │ │
┌────▼───┐ ┌───▼────┐ ┌───▼────┐ ┌───▼──────────┐
│ REST │ │ WS │ │ MCP │ │ Skill / CLI │
│ Batch │ │ Stream │ │ Agent │ │ AI workflows │
│ Backtest│ │ Live │ │ Tools │ │ Natural lang │
└────┬───┘ └───┬────┘ └───┬────┘ └───┬──────────┘
│ │ │ │
└──────────┴──────────┴──────────┘
│
┌────────▼────────┐
│ X-API-Key │
│ Unified auth │
└─────────────────┘
| Access Method | Auth | Best For | Key Characteristic |
|---|---|---|---|
| REST | X-API-Key header | Research, backtesting, batch pulls | Fixed field schema, documented error codes |
| WebSocket | api_key query param | Live dashboards, intraday stop-loss | Close code 1008 on key expiry |
| AI-native | X-TickDB-Key header | Agent workflows, natural language queries | Fetch structured facts first, then analyze |
REST
Standard HTTP, X-API-Key authentication. First choice for research, backtesting, and batch data pulls. Fixed response schemas and documented error codes make it straightforward to integrate into long-running code.
WebSocket
Streaming subscription for real-time data push. Officially documented support for A-share channels: ticker, depth, and trade. Connection URL is wss://api.tickdb.ai/v1/realtime; the api_key query parameter is required.
On key expiry, the server closes the connection with close code 1008 and sends a JSON message with the reason. Your reconnection logic must distinguish between a normal disconnect (re-connect immediately) and key expiry (re-authenticate first). Treating them the same produces a reconnection loop that never resolves.
AI-Native Access
Three tiers — Skill, MCP, and CLI — all using X-TickDB-Key authentication. They allow AI agents to call structured market data endpoints directly.
What each tier is for:
- Skill: "Conversational, zero-configuration" — designed for researchers, PMs, and light-use scenarios
- MCP: "One hosted HTTPS endpoint, 13 market data tools for your AI coding assistant" — designed for AI-assisted development environments
- CLI: "Query live market data from the terminal, JSON or table output, 16 native commands. Built for scripts and autonomous agents"
The value of AI-native access is not that an LLM can look up a price. It is that the model receives a structured, timestamped, symbol-attributed fact before it starts reasoning. If the model reasons from training-data memory instead of a live API call, the analysis has no verifiable data foundation — it is, effectively, hallucination with financial formatting.
Key Insight — Access Layer
In any AI workflow that touches market data, the live data must arrive before model inference begins. Sequence matters: fetch → structure → reason. Reversed to reason → fetch, you get a model that rationalizes its priors instead of analyzing reality.
Minimum Viable Stack by Reader Type
Not every use case needs all four layers. Here's what to start with.
Individual Quant Developer
Minimum stack: Kline (with adjustments) + Real-time Snapshot + Trading Calendar + Stock Reference Info
Starting path: Build the backtest framework with kline data first — confirm your adjustment convention is consistent across all symbols. Add real-time snapshot for signal triggering. Use trading calendar to handle non-trading-day gaps in the time series. Add stock reference info for basic valuation filtering.
Most common first failure: Raw kline data with no adjustment factors. Ex-dividend gaps get misread as price declines.
Small Team Data Engineer
Minimum stack: Trading Calendar + Trading Sessions + Adjustment Factors + Stock Info + Fundamentals (financials / valuation)
Starting path: Build the reference data layer first, then the market data pipeline. Adjustment factors support custom adjustment logic. Fundamentals support multi-factor model construction.
Most common first failure: Single trading calendar used for all markets. Multi-market backtest time axes fall out of alignment.
AI / LLM Workflow Builder
Minimum stack: MCP / Skill / CLI + Real-time Snapshot + Event Calendar
Starting path: Connect the MCP or CLI endpoint first so the agent can retrieve timestamped facts. Add the event calendar so the agent knows what relevant events exist on a given date.
Most common first failure: Asking the model "what is the current price of X?" without first calling the API, and accepting a training-data price as though it were live.
Financial Product Team
Minimum stack: REST + WebSocket + multi-market unified access + reconnection logic + pre-production validation checklist
Starting path: Run a POC validation first — confirm field schema, real-time coverage, and edge case handling for your target markets. Then implement production integration with reconnection logic and state recovery.
Most common first failure: No distinction between normal disconnect and key expiry (close code 1008) in the reconnection handler.
Coverage Boundaries and Caveats
Fundamentals boundary: The fundamentals API covers SSE (SH) and SZSE (SZ) individual stocks. Beijing Stock Exchange (BSE/BJ) stocks are not covered. ETFs on any exchange are not covered. The real-data samples used for this article are 688256.SH (Cambricon Technologies, SSE) and 600519.SH (Kweichow Moutai, SSE).
Capital flow methodology: There are three common classification schemes for capital flow data in Chinese markets, and they are not interoperable. The field structure shown in this article reflects one specific implementation. Before comparing capital flow figures across platforms, verify that the classification methodology matches.
Adjustment factor formula: For A-share stocks, factor_b is always 0, so adjusted_price = raw_price × factor_a. The parameters available for Hong Kong and US stocks differ from A-share parameters.
Dynamic values: Coverage counts, symbol counts, and similar dynamic figures change over time. The canonical reference is the official website and API documentation current at the time of your integration. As of 2026-09-15, coverage explicitly includes all SSE and SZSE A-share stocks; plan tiers support 1, 3, or 10 years of historical kline data.
Single-call validation scope: A successful API call validates the behavior of that specific endpoint, at that specific time, for that specific symbol, under that specific API key's permission tier. It does not constitute a claim about full-market coverage, long-term availability, or investment performance.
Conclusion
A-share market data is not "get kline bars and you're done." There are at least four distinct layers — market data, reference data, fundamentals, and access — and each layer solves a different class of problem in your pipeline.
The cost of mapping out all four layers before you write code is an afternoon. The cost of discovering missing layers through backtest failures or production incidents is weeks.
One concrete thing you can do right now: open your strategy code, go through the checklist below, and mark which data types you've actually integrated — and which ones you've silently assumed you didn't need.
A-Share Data Integration Checklist
| Layer | Data Type | Do I Need It? | Integrated? |
|---|---|---|---|
| Market Data | Real-time Snapshot | ☐ Yes / ☐ No | ☐ Done |
| Market Data | Kline (with adjustments) | ☐ Yes / ☐ No | ☐ Done |
| Market Data | Adjustment Factors | ☐ Yes / ☐ No | ☐ Done |
| Market Data | Intraday (Minute Line) | ☐ Yes / ☐ No | ☐ Done |
| Market Data | Order Book Depth | ☐ Yes / ☐ No | ☐ Done |
| Market Data | Tick Trades | ☐ Yes / ☐ No | ☐ Done |
| Market Data | Capital Flow | ☐ Yes / ☐ No | ☐ Done |
| Reference Data | Trading Calendar | ☐ Yes / ☐ No | ☐ Done |
| Reference Data | Trading Sessions | ☐ Yes / ☐ No | ☐ Done |
| Reference Data | Stock Reference Info | ☐ Yes / ☐ No | ☐ Done |
| Reference Data | Index Metrics | ☐ Yes / ☐ No | ☐ Done |
| Reference Data | Symbol Directory | ☐ Yes / ☐ No | ☐ Done |
| Fundamentals | Company Profile | ☐ Yes / ☐ No | ☐ Done |
| Fundamentals | Financial Statements | ☐ Yes / ☐ No | ☐ Done |
| Fundamentals | Valuation Metrics | ☐ Yes / ☐ No | ☐ Done |
| Fundamentals | Industry Analysis | ☐ Yes / ☐ No | ☐ Done |
| Fundamentals | Capital Actions | ☐ Yes / ☐ No | ☐ Done |
| Fundamentals | Shareholders & Funds | ☐ Yes / ☐ No | ☐ Done |
| Fundamentals | News & Event Calendar | ☐ Yes / ☐ No | ☐ Done |
| Access | REST | ☐ Yes / ☐ No | ☐ Done |
| Access | WebSocket | ☐ Yes / ☐ No | ☐ Done |
| Access | AI-native (MCP / Skill / CLI) | ☐ Yes / ☐ No | ☐ Done |
Fill this in and you have your data architecture diagram.
About the API Provider Used in This Article
This article uses TickDB throughout as the reference implementation — mapping the four-layer A-share data structure to concrete endpoints, field schemas, and coverage boundaries. Summary of capabilities as documented on the official website (as of 2026-09-15):
| Dimension | Capability |
|---|---|
| Coverage | All SSE and SZSE A-share stocks; major indices; also US equities, HK equities, futures, and FX |
| Data Types | Tick / Trade / Depth (L2), kline, intraday, adjustment factors, capital flow, 25 fundamentals endpoints |
| Real-time | 3-second snapshots / tick; WebSocket supports ticker, depth, trade for A-shares |
| History | Up to 10 years of kline data; plan tiers: 1 / 3 / 10 years |
| Access | REST + WebSocket + AI-native (Skill / MCP / CLI), unified X-API-Key authentication |
| Fundamentals | SSE + SZSE individual stocks; excludes BSE, excludes ETFs on all exchanges |
Who this is a good fit for:
- Individual quant developers who want to connect all four A-share data layers through a single API without assembling multiple sources
- Small team data engineers who need to understand the full A-share data landscape before deciding which layers their pipeline actually requires
- AI / LLM workflow builders who need agents to receive structured, timestamped facts rather than relying on the model's training-data memory for prices
- Financial product teams who need multi-market unified access, reconnection handling, and documented error codes for a production data layer
Who this is not the right fit for:
- Teams with an existing complete data pipeline who only want to swap out a single endpoint — the four-layer framing in this article is still useful for architecture review, but a full-service switch may not be warranted
- Use cases where a free-tier or open-source solution fully covers all requirements — this article is explicitly about the hidden cost of building and maintaining a self-assembled data stack, and if that cost is zero for your scenario, the calculus is different
If you want to start: go through the checklist above, identify your minimum viable stack, and start there. For most individual quant developers that means kline (with adjustments) + real-time snapshot + trading calendar + stock reference info. Validate those four, then decide whether to extend to order book, tick trades, and fundamentals.
Appendix A: Common API Endpoints
| Endpoint | Function |
|---|---|
/market/ticker | Single or batch snapshot |
/market/ticker/cn-stock | Full A-share market snapshot |
/market/kline | Historical kline bars |
/market/kline/latest | Latest (currently forming) bar |
/market/kline/ex-factors | Price adjustment factors |
/market/intraday | Intraday (minute-level) data |
/market/depth | Order book depth |
/market/trades | Tick-level trade records |
/market/trades/vwap | VWAP |
/market/capital-flow | Capital flow (money flow) |
/market/trade-days | Trading calendar |
/market/trading-sessions | Session schedule |
/market/stock-info | Stock reference info |
/market/calc-index | Index calculation metrics |
/market/intervals/kline | Available kline intervals |
/symbols/available | Symbol directory |
/fundamentals/profile | Company profile |
/fundamentals/financials/latest | Latest financial statements |
/fundamentals/financials/ttm | TTM financials |
/fundamentals/valuation/latest | Valuation snapshot |
/fundamentals/valuation/ts | Valuation time series |
/fundamentals/dividends | Dividend history |
/fundamentals/corp-actions | Corporate actions |
/fundamentals/shareholders/top | Top-10 shareholders |
/fundamentals/calendar | Financial event calendar |
/fundamentals/news | Company news |
/realtime | WebSocket streaming endpoint |
Appendix B: Error Code Quick Reference
| HTTP | Business Code | Meaning |
|---|---|---|
| 400 | 2001 | Additive adjustment not supported for HK / US stocks |
| 401 | 1005 | API key expired |
| 403 | 3009 | Endpoint not enabled on current plan |
| 403 | 3010 | Market not enabled on current plan |
| 404 | 40404 | No data from upstream |
| 404 | 40405 | No business data matches the query conditions |
| 422 | 5006 | Adjustment base data unavailable |
| 429 | — | Request rate limit exceeded |
| 503 | 5005 | Adjustment factor service unavailable |
| WS close 1008 | — | API key expired (WebSocket) |
Appendix C: Frequently Asked Questions
Q: Why is there no opening price during A-share call auction periods?
A: During call auction periods (9:15–9:25 AM and 14:57–15:00 PM), no continuous trading occurs. The open field only appears after the 9:25 AM batch match completes and the continuous session begins. An absent open field during these windows is correct API behavior.
Q: Does the fundamentals API cover Beijing Stock Exchange stocks?
A: No. The fundamentals API in this article covers SSE (SH) and SZSE (SZ) individual stocks only. BSE (BJ) stocks and ETFs on any exchange are not covered.
Q: Can capital flow data be used directly as a buy/sell signal?
A: No. Capital flow is a quantitative description of market participant behavior, not a directional signal. Additionally, capital flow classification methodologies are not compatible across data providers — you must freeze your methodology definition before making any cross-source comparisons.
Q: How should WebSocket reconnection be handled after a disconnect?
A: Distinguish between normal disconnect and key expiry. On key expiry, the server closes the connection with close code 1008 and sends a JSON explanation message. The two cases require different handling: a normal disconnect should trigger an immediate reconnect; key expiry requires re-authentication first. Treating both as the same case creates a reconnect loop on expired keys.
Q: Can TradingView charts be fed directly from this API?
A: The REST API can serve as the data source layer for a TradingView UDF (Universal Data Feed) backend, but you need to implement the UDF protocol wrapper yourself. The API provides the raw data; the UDF translation layer is your responsibility.
All real-data samples in this article were retrieved from the TickDB REST API on September 15, 2026. Sample symbols: 688256.SH (Cambricon Technologies, SSE) and 600519.SH (Kweichow Moutai, SSE). Dynamic values — prices, volumes, coverage counts — reflect conditions at the time of the API call and will differ in subsequent queries. TickDB provides market data for quantitative research, market monitoring, and financial applications across China A-share, Hong Kong, and US markets. For API documentation and access, visit tickdb.com.
通过 TickDB API 获取实时行情数据
一个 API 接入外汇、加密货币、美股、港股、A股、贵金属和全球指数的实时行情。支持 WebSocket 低延迟推送,免费开始使用。
免费领取 API Key查看 API 文档