Historical Candle Data
API to retrieve OHLC (Open, High, Low, Close) data for instruments spanning multiple timeframes. Historical data is available for the following time durations:
- 1-minute: Retrieve the candles from the final month leading up to the endDate.
- 30-minute: Retrieve the candles from the past year up to the endDate.
- Daily: Retrieve data for the past year, concluding on the endDate.
- Weekly: Retrieve data from the previous ten years, ending on the endDate.
- Monthly: Retrieve data spanning the last ten years, up to the specified endDate.
NOTE
- Use the Intraday API to retrieve data specific to the current trading day.
- One-minute and 30-minute candle data are accessible solely for the preceding six months.
- It's important to note that
instrument_key
parameter accepts only a single identifier per request; comma-separated values or multiple identifiers are not supported.
Header Parameters
Name | Required | Type | Description |
---|---|---|---|
Accept | true | string | Defines the content format the client expects, which should be set to application/json . |
Path Parameters
Name | Required | Type | Description |
---|---|---|---|
instrument_key | true | string | The unique identifier for the financial instrument for which historical data is being queried. For the regex pattern applicable to this field, see the Field Pattern Appendix. |
interval | true | string | Specifies the time frame of the candles. Possible values: 1minute , 30minute , day , week , month . |
to_date | true | string | The ending date (inclusive) for the historical data range. Format: 'YYYY-MM-DD'. |
from_date | false | string | The starting date for the historical data range. Format: 'YYYY-MM-DD'. |
Responses
- 200
- 4XX
Response Body
{
"status": "success",
"data": {
"candles": [
[
"2023-10-01T00:00:00+05:30",
53.1,
53.95,
51.6,
52.05,
235519861,
0
],
[
"2023-09-01T00:00:00+05:30",
50.35,
56.85,
49.35,
52.8,
1004998611,
0
]
]
}
}
Name | Type | Description |
---|---|---|
status | string | A string indicating the outcome of the request. Typically success for successful operations. |
data | object | Contains OHLC values for all instruments across various timeframes. |
data.candles | array[] | Array of candle data, each presented as an array with sequential elements representing trading activity. |
data.candle[0] | number | Timestamp : Indicating the start time of the candle's timeframe. |
data.candle[1] | number | Open : The opening price of the asset for the given timeframe. |
data.candle[2] | number | High : The highest price at which the asset traded during the timeframe. |
data.candle[3] | number | Low : The lowest price at which the asset traded during the timeframe. |
data.candle[4] | number | Close : The closing price of the asset for the given timeframe. |
data.candle[5] | number | Volume : The total amount of the asset that was traded during the timeframe. |
data.candle[6] | number | Open Interest : The total number of outstanding derivative contracts, such as options or futures. |
Error codes
Error code | Description |
---|---|
UDAPI1021 | Instrument key is of invalid format - The provided instrument key doesn't conform to the expected format. |
UDAPI1020 | Interval accepts one of (1minute,30minute,day,week,month) - Ensure the 'interval' is one of the specified values. |
UDAPI1022 | to_date is required - You must specify the 'to_date' in your request. |
UDAPI100011 | Invalid Instrument key - The instrument key you provided doesn't match any of the recognized keys in the system. |
Examples
A comprehensive set of examples is provided to illustrate various use cases and implementation scenarios for this API. To view detailed examples and access sample code, please refer to: API Examples.
Loading...