Skip to main content

Candles

Get historical OHLCV (open / high / low / close / volume) candlestick data for a symbol.

HTTP

MethodGET
Endpoint/trade/api/v2/candles

Request Parameters

ParameterTypeMandatoryDescription
exchangestringYesSee Exchange Identifiers.
symbolstringYesBASE/QUOTE, e.g. BTC/INR, BTC/USDT.
intervalintegerYesCandle duration in minutes. e.g. 1, 5, 60, 1440.
start_timeintegerYesRange start (Unix milliseconds).
end_timeintegerYesRange end (Unix milliseconds).

Example

import requests

headers, path = sign_request("GET", "/trade/api/v2/candles", params={
"exchange": "coinswitchx",
"symbol": "BTC/INR",
"interval": "60",
"start_time": "1647388800000",
"end_time": "1662681600000",
})
response = requests.get(BASE_URL + path, headers=headers)
print(response.json())

Response

{
"data": [
{
"o": "1591001.000000000000",
"h": "1610988.000000000000",
"l": "1588000.000000000000",
"c": "1591000.000000000000",
"interval": "60",
"symbol": "BTC/INR",
"close_time": "1662681600000",
"volume": "0.304680000000",
"start_time": "1662678000000"
}
]
}

Response Parameters

data is an array of candles. Each entry:

FieldTypeDescription
ostringOpen price.
hstringHigh price.
lstringLow price.
cstringClose price.
volumestringTrade volume in base asset over the candle period.
symbolstringSymbol, e.g. "BTC/INR".
intervalstringEcho of the requested interval, in minutes.
start_timestringCandle start (Unix milliseconds).
close_timestringCandle close (Unix milliseconds).

For real-time 1-minute candles, use the Candlestick WebSocket.