Skip to main content

Klines

Candlestick (OHLCV) data for a US-listed symbol over a given time range and interval.

Endpoint

GET /stock/v1/klines

Authentication: Standard plan. Requires a valid platform API key (X-Primit-API-Key) tied to an active Standard plan (标准套餐) subscription or above. See Authentication.

Query parameters

NameTypeRequiredDefaultNotes
symbolstringYesTicker, e.g. AAPL.
intervalstringNo1dOne of 1m, 5m, 15m, 30m, 1h, 1d, 1w, 1M.
limitintegerNo100Number of bars to return.
startTimeintegerNoInclusive start, Unix milliseconds.
endTimeintegerNoInclusive end, Unix milliseconds.
adjustedbooleanNotrueWhether prices are adjusted for splits/dividends.

If neither startTime nor endTime is provided, the most recent limit bars are returned, in ascending open_time order.

Response — 200 OK

2D array. Each row is positional (standard Binance kline format):

[
[
1773705600000,
"5013.59",
"5043.75",
"4978.40",
"5003.54",
"145553.554",
1773791999999,
"729468735.70852",
431830,
"72156.345",
"361615976.65469",
"0"
]
]
IndexFieldTypeDescription
0open_timeinteger (ms)Bar open time.
1openstring (decimal)Open price.
2highstring (decimal)High price.
3lowstring (decimal)Low price.
4closestring (decimal)Close price.
5volumestring (decimal)Base-asset volume.
6close_timeinteger (ms)Bar close time.
7quote_volumestring (decimal)Quote-asset volume.
8tradesintegerTrade count.
9taker_buy_volumestring (decimal)Base-asset volume bought by takers.
10taker_buy_quote_volumestring (decimal)Quote-asset volume bought by takers.
11ignorestringReserved by Binance.

Errors

HTTPCause
401Missing or invalid X-Primit-API-Key.
403No active Standard plan (subscription expired or never purchased).
404symbol not found.
422interval not in the allowed set.

Example

curl -s "https://api.pipai.org/stock/v1/klines?symbol=AAPL&interval=1d&limit=250" \
-H "X-Primit-API-Key: $PRIMIT_API_KEY"