For the complete documentation index, see llms.txt. This page is also available as Markdown.

GET /markets/{market_id}/candles

Get OHLCV candles

Get OHLCV candles.

operationId: fetchOHLCV · CCXT method: fetchOHLCV

Authentication: none — this operation is public.

Returns candlestick data as arrays: [timestamp, open, high, low, close, volume], ascending by timestamp. Optionally bounded by startTime / endTime; unbounded, it returns the latest limit bars.

startTime sets the paging direction. With startTime given, the earliest limit bars at or after it are returned, so the standard ccxt.fetchOHLCV loop that advances since progresses: each request starts where the last one ended. Without startTime — the unbounded or endTime-only case — the most recent limit bars in the window are returned, which is what "the latest bars" means above and is unchanged. To reconstruct a long history, pass startTime and advance it by the timestamp after the last bar received. This operation has no pagination cursor.

Parameters

Name
In
Type
Required
Default
Description

market_id

path

string

Yes

Market identifier (e.g. BTC-USDX-PERP, ETH-USDX-PERP). Uppercase ASCII alphanumeric segments joined by single hyphens, at most 64 characters. A value outside that set is rejected with 400 (INVALID_MARKET_ID) before any store is read — it cannot name a market, so an empty result would assert that nothing traded rather than that the question was malformed. A well-formed identifier that names no listed market is a 404, not a 400.

timeframe

query

string — one of 1s | 1m | 5m | 1h

No

"1m"

startTime

query

integer

No

Inclusive lower bound of the window, Unix milliseconds UTC, compared against each candle's bucket start. Omit for no lower bound. Supplying startTime also sets the paging direction. With it, the response begins AT this bound and runs forward, so a capped page is the OLDEST bars in the window and its last bar is where the next request resumes — ccxt.fetchOHLCV's since, whose standard loop advances from the last bar it was handed. Without it, the response is the NEWEST bars in the window, which is what fetchOHLCV with no since means. This is a correctness property, not a preference: served newest-first, a since deep in history would return the bars adjacent to now, the caller's cursor would jump to now, and the loop would exit after one page — reporting a complete history with everything in between missing. No error and no empty page, just a gap shaped like an answer. Must be strictly before endTime when both are given; an inverted window is rejected with 400 (INVALID_RANGE) rather than normalised, so a nonsensical window never reads back as an empty one. A negative value is rejected with 400 (INVALID_TIME). Spelled in camelCase rather than the snake_case used elsewhere in this API, deliberately: ccxt.fetchOHLCV and the Binance and Hyperliquid kline contracts all use these names.

endTime

query

integer

No

Inclusive upper bound of the window, Unix milliseconds UTC, compared against each candle's bucket start. Omit to read up to now. With no startTime, the operation returns the newest bars in the window, so a long history can be walked by moving endTime backwards. Prefer paging forward on startTime instead — that is the direction ccxt.fetchOHLCV pages in, and see that parameter for why. endTime alone does not change the direction. See startTime for the rejection rules and for why both are camelCase.

limit

query

integer

No

200

Maximum number of bars to return. A value above the maximum is clamped rather than rejected. The maximum is what the server accepts, not a promise of how many bars exist: the effective ceiling depends on the history available for that market and timeframe, so a response may hold fewer bars than requested. Read x-nexus-candles-truncated to tell a capped page from a complete one.

Responses

Status
Body
Meaning

200

array of array of —

OHLCV candles for the market.

400

(no schema declared)

429

(no schema declared)

Example


Generated from eng/apps/exchange/api/openapi.json (spec 0.9.36). Do not edit by hand — regenerate with python3 product/docs/tools/api-reference/generate.py. Hand-authored context lives in the Guides pages.

Last updated