Skip to main content

Candlestick Data

Description

Get candlestick data. The candlestick chart is limited to a maximum of 1500 bars per request.

HTTP Request

GET /fapi/v1/klines

Request Parameters

NameTypeRequiredDescription
symbolSTRINGYESTrading pair
intervalENUMYESKline interval
startTimeLONGNOStart time
endTimeLONGNOEnd time
limitINTNODefault 500; Max 1500

Natively supported intervals are 1m, 5m, 15m, 1h, 4h, 1d, 1w, 1M. The other Binance intervals are accepted but silently mapped to the closest supported one (3m5m, 30m15m, 2h1h, 6h/8h/12h4h, 3d1d) — the returned candles are at the mapped granularity, not the requested one.

Response Example

[
[
1499040000000, // Open time
"0.01634790", // Open price
"0.80000000", // High price
"0.01575800", // Low price
"0.01577100", // Close price
"148976.11427815", // Volume
1499644799999, // Close time
"2434.19055334", // Quote asset volume
308, // Number of trades
"0", // Taker buy base asset volume (currently always "0")
"0", // Taker buy quote asset volume (currently always "0")
"0" // Ignore
]
]

Code Examples

cURL

curl -s "https://api.prex.world/fapi/v1/klines?symbol=BTCUSDT&interval=1h&limit=2"

Python

import requests

base_url = "https://api.prex.world"
params = {"symbol": "BTCUSDT", "interval": "1h", "limit": 5}
response = requests.get(f"{base_url}/fapi/v1/klines", params=params)
for kline in response.json():
open_time, o, h, l, c, vol = kline[0], kline[1], kline[2], kline[3], kline[4], kline[5]
print(f"Time={open_time} O={o} H={h} L={l} C={c} Vol={vol}")