Get Index Price Kline
Query for historical index price klines. Charts are returned in groups based on the requested interval.
Covers: USDT perpetual / USDC contract / Inverse contract
HTTP Request
GET /v5/market/index-price-kline
Request Parameters
Parameter | Required | Type | Comments |
---|---|---|---|
category | false | string | Product type. linear ,inverse category is not passed, use linear by default |
symbol | true | string | Symbol name, like BTCUSDT , uppercase only |
interval | true | string | Kline interval. 1 ,3 ,5 ,15 ,30 ,60 ,120 ,240 ,360 ,720 ,D ,M ,W |
start | false | integer | The start timestamp (ms) |
end | false | integer | The end timestamp (ms) |
limit | false | integer | Limit for data size per page. [1 , 1000 ]. Default: 200 |
Response Parameters
Parameter | Type | Comments |
---|---|---|
category | string | Product type |
symbol | string | Symbol name |
list | array |
|
> list[0]: startTime | string | Start time of the candle (ms) |
> list[1]: openPrice | string | Open price |
> list[2]: highPrice | string | Highest price |
> list[3]: lowPrice | string | Lowest price |
> list[4]: closePrice | string | Close price. Is the last traded price when the candle is not closed |
Request Example
- HTTP
- Python
- Go
- Java
- Node.js
GET /v5/market/index-price-kline?category=inverse&symbol=BTCUSDZ22&interval=1&start=1670601600000&end=1670608800000&limit=2 HTTP/1.1
Host: api-testnet.bybit.com
from pybit.unified_trading import HTTP
session = HTTP(testnet=True)
print(session.get_index_price_kline(
category="inverse",
symbol="BTCUSDZ22",
interval=1,
start=1670601600000,
end=1670608800000,
limit=2,
))
import (
"context"
"fmt"
bybit "github.com/wuhewuhe/bybit.go.api"
)
client := bybit.NewBybitHttpClient("", "", bybit.WithBaseURL(bybit.TESTNET))
params := map[string]interface{}{"category": "spot", "symbol": "BTCUSDT", "interval": "1"}
client.NewUtaBybitServiceWithParams(params).GetIndexPriceKline(context.Background())
import com.bybit.api.client.domain.CategoryType;
import com.bybit.api.client.domain.market.*;
import com.bybit.api.client.domain.market.request.MarketDataRequest;
import com.bybit.api.client.service.BybitApiClientFactory;
var client = BybitApiClientFactory.newInstance().newAsyncMarketDataRestClient();
var marketKLineRequest = MarketDataRequest.builder().category(CategoryType.LINEAR).symbol("BTCUSDT").marketInterval(MarketInterval.WEEKLY).build();
client.getIndexPriceLinesData(marketKLineRequest, System.out::println);
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});
client
.getIndexPriceKline({
category: 'inverse',
symbol: 'BTCUSDZ22',
interval: '1',
start: 1670601600000,
end: 1670608800000,
limit: 2,
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"symbol": "BTCUSDZ22",
"category": "inverse",
"list": [
[
"1670608800000",
"17167.00",
"17167.00",
"17161.90",
"17163.07"
],
[
"1670608740000",
"17166.54",
"17167.69",
"17165.42",
"17167.00"
]
]
},
"retExtInfo": {},
"time": 1672026471128
}