K-line Data
Get K-line historical data for a specified trading pair.
Interface Information
- Method:
GET - Path:
/api/v1/stock/open-api/klines
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Trading pair symbol, e.g., msx, BTCUSDT |
| interval | string | Yes | K-line interval |
| startTime | int64 | No | Start timestamp (milliseconds) |
| endTime | int64 | No | End timestamp (milliseconds) |
| limit | int | No | Number of results, default 500, max 1500 |
Supported K-line intervals:
1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1mo
Request Example
GET /api/v1/stock/open-api/klines?symbol=msx&interval=1m&limit=100
Response Fields
| Field | Type | Description |
|---|---|---|
| code | int | Status code |
| msg | string | Status message |
| data.symbol | string | Trading pair |
| data.interval | string | K-line interval |
| data.klines | array | K-line data list |
Klines array elements:
t: Open time (millisecond timestamp)o: Open priceh: High pricel: Low pricec: Close pricev: Volume
Response Example
{
"code": 0,
"msg": "success",
"data": {
"symbol": "msx",
"interval": "1m",
"klines": [
{
"t": 1737446400000,
"o": "1.2345",
"h": "1.2400",
"l": "1.2300",
"c": "1.2380",
"v": "12345.67"
},
{
"t": 1737446460000,
"o": "1.2380",
"h": "1.2450",
"l": "1.2350",
"c": "1.2420",
"v": "9876.54"
}
]
}
}