KLines
Historical OHLCV (open / high / low / close / volume) candles for a futures symbol.
HTTP
| Method | GET |
| Endpoint | /trade/api/v2/futures/klines |
| Rate limit | 30 requests per 60 seconds |
Request Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
exchange | string | Yes | EXCHANGE_2. |
symbol | string | Yes | Symbol, e.g. BTCUSDT. |
interval | string | Yes | Candle duration in minutes. One of '1', '5', '15', '30', '60', '120', '240', '360', '720', '1440'. |
start_time | integer | No | Range start (Unix ms). |
end_time | integer | No | Range end (Unix ms). |
limit | integer | No | Number of candles to return. |
Example
- Python
- Java
- Go
- Node.js
import requests
headers, path = sign_request("GET", "/trade/api/v2/futures/klines", params={
"symbol": "btcusdt",
"exchange": "EXCHANGE_2",
"interval": "1",
"start_time": "1731555003792",
"end_time": "1732555003792",
"limit": 10,
})
response = requests.get(BASE_URL + path, headers=headers)
print(response.json())
HashMap<String, String> p = new HashMap<>();
p.put("symbol", "btcusdt");
p.put("exchange", "EXCHANGE_2");
p.put("interval", "1");
p.put("start_time", "1731555003792");
p.put("end_time", "1732555003792");
p.put("limit", "10");
HttpResponse<String> resp = client.send(
"GET", "/trade/api/v2/futures/klines", p, null);
System.out.println(resp.body());
headers, p, err := SignRequest("GET", "/trade/api/v2/futures/klines", map[string]string{
"symbol": "btcusdt",
"exchange": "EXCHANGE_2",
"interval": "1",
"start_time": "1731555003792",
"end_time": "1732555003792",
"limit": 10,
})
if err != nil { panic(err) }
req, _ := http.NewRequest("GET", BaseURL+p, nil)
for k, v := range headers { req.Header.Set(k, v) }
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
const {signRequest, BASE_URL} = require('./reference-client');
const {headers, path} = signRequest('GET', '/trade/api/v2/futures/klines', {
"symbol": "btcusdt",
"exchange": "EXCHANGE_2",
"interval": "1",
"start_time": "1731555003792",
"end_time": "1732555003792",
"limit": 10,
});
const r = await fetch(BASE_URL + path, {
method: 'GET',
headers,
});
console.log(await r.json());
Response
{
"data": [
{
"o": "95500.100000000000",
"h": "95875.000000000000",
"l": "94707.000000000000",
"c": "95524.000000000000",
"symbol": "BTCUSDT",
"close_time": "1732795200000",
"volume": "22426.480000000000",
"start_time": "1732773600000",
"interval": "360"
}
]
}
Response Parameters
data is an array of candles:
| Field | Type | Description |
|---|---|---|
symbol | string | Symbol. |
interval | string | Echo of the requested interval, in minutes. |
o | string | Open price. |
h | string | High price. |
l | string | Low price. |
c | string | Close price. |
volume | string | Trade volume in base asset over the candle period. |
start_time | string | Candle start (Unix ms). |
close_time | string | Candle close (Unix ms). |
For real-time candle pushes, use the KLines WebSocket.