Custom Bars (OHLC)
REST
Stocks
Custom Bars (OHLC)
Endpoint
GET /v1/ohlc/range/{multiplier}/{timespan}/{from}/{to}Example
GET /v1/ohlc/range/1/day/2026-01-01/2026-05-26?symbol=600519.SHDescription
Retrieve aggregated daily OHLC (open, high, low, close), volume, turnover, and percent change for one or more A-share symbols over a date range. Bars are aligned to the trading calendar (non-trading days produce no bar). Data is end-of-day; it is not intraday or real-time.
Multiple symbols in one request return one time series per symbol in results[], not a cross-product matrix.
Use cases: Charts, backtesting, multi-symbol comparison, interval return (include=summary).
For a valid symbol with no trading-day bars in the range, the API returns HTTP 200, ohlc: [], resultsCount: 0 (not 404).
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
multiplier | integer | Yes | Size of the timespan multiplier. v1 only supports 1. |
timespan | string | Yes | Size of the time window. v1 only supports day. |
from | string | Yes | Start of the window (YYYY-MM-DD, trading date). |
to | string | Yes | End of the window (YYYY-MM-DD, trading date). |
If from > to, the API returns 400 INVALID_PARAMETER. If from = to, zero or one bar may be returned.
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
symbol | string | Yes | — | Ticker with exchange suffix, e.g. 600519.SH. Multiple symbols: comma-separated, 600519.SH,000001.SZ. |
adjusted | boolean | No | true | If true, OHLC reflects split-adjusted prices used for display. If false, prices are derived using factor on each bar. |
sort | string | No | asc | Sort bars by time: asc or desc. With limit, returns the first N bars after sorting (e.g. desc + limit=30 → latest 30 sessions). |
limit | integer | No | plan default | Max bars returned within [from, to] after sort. Maximum 5000. |
include | string | No | — | Set to summary to include interval statistics on the response. |
Response Attributes
Top level (single symbol)
| Field | Type | Description |
|---|---|---|
status | string | OK or PARTIAL (partial success when multiple symbols). |
request_id | string | Server-assigned request ID. |
symbol | string | Echo of the requested symbol. |
adjusted | boolean | Whether OHLC values are adjusted per the adjusted parameter. |
multiplier | integer | Echo, e.g. 1. |
timespan | string | Echo, e.g. day. |
from | string | Echo. |
to | string | Echo. |
resultsCount | integer | Length of the ohlc array. |
ohlc | array | Bar objects (see below). |
summary | object | Present only when include=summary. |
meta | object | Metadata such as as_of, source, schema_version. |
Top level (multiple symbols)
Same as above, except the series is in results[] (each item has symbol, resultsCount, ohlc, optional summary, optional per-symbol error). Top-level resultsCount is the number of symbols.
ohlc[] bar object
| Field | Type | Description |
|---|---|---|
trade_date | string | Trading date YYYY-MM-DD. |
t | integer | Bar start time, Unix ms (UTC+8 session). |
open | number | Open price (CNY). |
high | number | High price (CNY). |
low | number | Low price (CNY). |
close | number | Close price (CNY). |
volume | number | Volume (shares). |
turnover | number | Turnover (CNY). |
change_pct | number | Percent change for the session, e.g. 1.24 = +1.24%. |
factor | number | Adjustment factor for the bar; used when adjusted=false. |
summary object (include=summary)
| Field | Type | Description |
|---|---|---|
bars_count | integer | Number of bars in the interval. |
return_pct | number | ((close_{last} / open_{first} - 1) \times 100). |
open_first | number | Open of the first bar (per sort). |
close_last | number | Close of the last bar (per sort). |
from | string | Echo. |
to | string | Echo. |
Sample Response
{
"status": "OK",
"request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"symbol": "600519.SH",
"adjusted": true,
"multiplier": 1,
"timespan": "day",
"from": "2026-01-01",
"to": "2026-05-26",
"resultsCount": 242,
"ohlc": [
{
"trade_date": "2026-01-02",
"t": 1704124800000,
"open": 1715.0,
"high": 1720.0,
"low": 1695.0,
"close": 1705.0,
"volume": 3123456,
"turnover": 5312345678.0,
"change_pct": 0.58,
"factor": 1.0
}
],
"meta": {
"as_of": "2026-05-26",
"source": "qlib",
"schema_version": "2026-05-27"
}
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Plan Access
Included in all plans (Free, Basic, Pro).
Plan Recency
End-of-day (updated after the session close; not real-time).
| Plan | Recency |
|---|---|
| Free | End-of-day |
| Basic | End-of-day |
| Pro | End-of-day |
Plan History
How far back from may go:
| Plan | History |
|---|---|
| Free | 2 years |
| Basic | 5 years |
| Pro | Full available history |
Plan Limits
| Plan | Max limit per request | Max symbols per request |
|---|---|---|
| Free | 500 | 1 |
| Basic | 5000 | 5 |
| Pro | 5000 | 20 |
Exceeded limits return 403 PLAN_LIMIT. See Authentication.
Errors
| Code | HTTP | When |
|---|---|---|
INVALID_SYMBOL | 400 | Unknown or malformed symbol |
INVALID_PARAMETER | 400 | Invalid dates, etc. |
UNSUPPORTED_INTERVAL | 400 | Path is not 1/day |
INSUFFICIENT_CREDITS | 402 | Insufficient credits |
PLAN_LIMIT | 403 | Plan history or count limits |
UNAUTHORIZED | 401 | Invalid API key |
| — | 200 | Valid symbol, no bars in range: ohlc: [] |
Full list: Errors.