Get Expired Historical Candle Data
This API extends the functionality of the existing Get Historical Candle Data API by allowing users to query data for expired contracts.
This API is particularly useful for traders and analysts who need to analyze past performance and trends of expired contracts.
It provides historical Open, High, Low, Close (OHLC) data for expired contracts, available across multiple time intervals including: 1minute
, 3minute
, 5minute
, 15minute
, 30minute
and day
.
NOTE
- Before using this API, utilize the Get Expired Option Contracts API or Get Expired Future Contracts API to obtain the
expired_instrument_key
for the expired contracts This key, required as a path parameter, is a combination of the standard instrument key and the expiry date returned by the previously mentioned APIs." - For Open, High, Low, Close (OHLC) data of an active contracts, use the Historical Candle Data API.
Important
- Expired Historical Candle Data is currently not available for the MCX.
- This API is specifically for expired contracts that have passed their expiry date.
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 |
---|---|---|---|
expired_instrument_key | true | string | The unique identifier for the expired financial instrument for which historical data is being queried. This key is combination of normal instrument key and expiry date. The expired_instrument_key key must match the regex pattern specified in the Field Pattern Appendix. |
interval | true | string | Specifies the time frame of the candles. Possible values: 1minute , 3minute ,5minute ,15minute ,30minute , day . |
to_date | true | string | The ending date (inclusive) for the historical data range. Format: YYYY-MM-DD . |
from_date | true | string | The starting date for the historical data range. Format: YYYY-MM-DD . |
Responses
- 200
- 4XX
Response Body
{
"status": "success",
"data": {
"candles": [
[
"2022-11-30T00:00:00+05:30",
125.35,
126.8,
122.1,
123.45,
1542678,
184632
],
[
"2022-11-29T00:00:00+05:30",
120.85,
126.55,
120.5,
125.35,
1876543,
195732
]
]
}
}
Name | Type | Description |
---|---|---|
status | string | A string indicating the outcome of the request. Typically success for successful operations. |
data | object | Contains OHLC values for expired contracts 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 expired keys in the system. |
UDAPI1088 | Invalid date - You need to provide the expiry_date in proper format: YYYY-MM-DD |
UDAPI1149 | This API is available exclusively with an Upstox Plus plan subscription - Please upgrade to the Plus plan to gain access. |
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...