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

Weight

1

Request Parameters

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

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
"1756.87402397", // Taker buy base asset volume
"28.46694368", // Taker buy quote asset volume
"0" // Ignore
]
]

Code Examples

cURL

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

Python

import requests

base_url = "https://api.ztdx.io"
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}")