Skip to main content

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.

Request

curl -X 'GET' 'https://api.upstox.com/v2/expired-instruments/historical-candle/NSE_FO%7CNIFTY22D0117800CE/day/2022-11-30/2022-11-01'
--header 'Content-Type: application/json'
--header 'Accept: application/json'
--header 'Authorization: Bearer {your_access_token}'

For additional samples in various languages, please refer to the Sample code section on this page.

Path Parameters

NameRequiredTypeDescription
expired_instrument_keytruestringThe 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.
intervaltruestringSpecifies the time frame of the candles.
Possible values: 1minute, 3minute,5minute,15minute,30minute, day.
to_datetruestringThe ending date (inclusive) for the historical data range. Format: YYYY-MM-DD.
from_datetruestringThe starting date for the historical data range. Format: YYYY-MM-DD.
Responses

NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobjectContains OHLC values for expired contracts across various timeframes.
data.candlesarray[]Array of candle data, each presented as an array with sequential elements representing trading activity.
data.candle[0]numberTimestamp: Indicating the start time of the candle's timeframe.
data.candle[1]numberOpen: The opening price of the asset for the given timeframe.
data.candle[2]numberHigh: The highest price at which the asset traded during the timeframe.
data.candle[3]numberLow: The lowest price at which the asset traded during the timeframe.
data.candle[4]numberClose: The closing price of the asset for the given timeframe.
data.candle[5]numberVolume: The total amount of the asset that was traded during the timeframe.
data.candle[6]numberOpen Interest: The total number of outstanding derivative contracts, such as options or futures.

Sample Code

Get Historical Candle Data for Expired Instruments

curl --location 'https://api.upstox.com/v2/expired-instruments/historical-candle/NSE_FO|73507|24-04-2025/30minute/2025-04-24/2020-02-24' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
Loading...