Get Expired F&O Data
This API allows you to get historical candles for an expired futures or options contract.
USE CASE
Fetch candles, open interest and option Greeks for an expired contract to backtest a strategy on past expiries.
Note
- Greeks are not available for MCX.
- NCOM does not have historical F&O data.
Details
- The Get Expired F&O Data API gives historical data for expired Futures and Options contracts.
- This API supports expired contracts only. It does not provide historical data for active Futures and Options contracts.
- To get historical data, provide the expired contract symbol, required date range, and resolution.
- If the expired contract symbol is not known, use the Get Expired Contracts API first. If the expiry date is also not known, use the Get Expiry Dates API to find it.
- Historical Data Limits
The amount of historical data you can request depends on the selected resolution. - Currently, only the intraday timeframe is available; daily, weekly, and monthly timeframes will be coming soon.
- For 1, 2, 3, 5, 10, 15, 20, 30, 45, 60, 120, 180, and 240-minute resolutions, you can request up to 100 days of data at a time.
- For second-based resolutions, historical data is available only for the last 30 trading days.
- Pass
resolutionas5Sfor seconds, or as a minute value such as1,5or60. - Set
include_oito 1 to addopen_interest. Setinclude_greeksto 1 to addimplied_volatility,delta,gamma,thetaandvegato each candle. include_greeks=1works only for CE and PE contracts. A futures request with it returns a validation error.- Invalid input returns HTTP
422with code-50. For example,include_greeks=2is rejected because it must be 0 or 1. - A valid request with no candles returns
sasno_dataand an emptycandlesarray. Treat this as an empty result, not a failure. - Greek values can be
nullfor a candle. The API does not copy the previous candle or use zero, so handlenullbefore calculating. - Read optional columns by name from
columns. Only the first six (timestamp, open, high, low, close, volume) are fixed. - If data is not available for the contract, exchange or date range, the API returns an error.
- Historical data is available from different dates for each exchange.
- Historical data before the availability date for an exchange cannot be retrieved. The requested date range must also be within the limit for the selected resolution.
Plan limits
Standard plan
- Daily candles: last 2 years (from 2024)
- Intraday candles: 10 calls per day
Prime plan
- Daily candles: 7+ years
- Intraday candles: available
For rate limits and all other plan details, see Plans & rate limits.
Historical Data Availability
| Exchange | Historical Data Available From |
|---|---|
NSE | 10 October 2018 |
BSE | 07 August 2023 |
MCX | 11 October 2018 |
Request Attributes
| Attribute | Data Type | Description |
|---|---|---|
symbol* | string | Expired Futures or Options contract symbol. Eg: NSE:NIFTY25MAR23000CE |
resolution* | string |
|
date_format* | int | date_format is a boolean flag. 0 to enter the epoch value. 1 to enter the date format as yyyy-mm-dd. |
range_from* | string | Indicating the start date of records. Accepts epoch value if date_format flag is set to 0. Accepts yyyy-mm-dd format if date_format flag is set to 1. |
range_to* | string | Indicating the end date of records. Accepts epoch value if date_format flag is set to 0. Accepts yyyy-mm-dd format if date_format flag is set to 1. |
include_oi | int | set flag to "1" to enable oi as a part of the response. |
include_greeks | int | set flag to "1" to enable greeks as a part of the response. |
How the two flags change the rows
| include_oi | include_greeks | Fields after core OHLCV |
|---|---|---|
| 0 / empty | 0 / empty | None |
| 1 | 0 / empty | open_interest |
| 0 / empty | 1 | implied_volatility, delta, gamma, theta, vega |
| 1 | 1 | open_interest, then all five Greek fields |
Note: Options only: include_greeks=1 is accepted only for CE or PE contracts. A Futures request with this flag returns a validation error.
Response Attributes
| Attribute | Data Type | Description |
|---|---|---|
s | string | ok / no_data / error |
symbol | string | Expired contract symbol for which the data is returned |
resolution | string | Resolution of the returned candles |
columns | array | Column names for each candle, in the order returned: timestamp, open, high, low, close, volume. An open_interest column is appended when include_oi is set to 1. The iv, delta, gamma, theta and vega columns are appended (after open_interest, if present) when include_greeks is set to 1. |
candles | array |
|
schema_version | int | Version of the response schema |
Note: The API returns an error if historical data is not available for the specified contract, exchange, or date range.
Stable core columns
| Index | Column | Meaning |
|---|---|---|
| 0 | timestamp | Candle time as UNIX epoch seconds. |
| 1 | open | First price in the candle. |
| 2 | high | Highest price in the candle. |
| 3 | low | Lowest price in the candle. |
| 4 | close | Last price in the candle. |
| 5 | volume | Volume for the candle. |
Optional values are appended after index 5. Clients should use columns instead of hard-coding optional indexes.
OI and Greek fields
| Column | Returned when | Simple meaning |
|---|---|---|
open_interest | include_oi=1 | Open Interest stored for the candle. |
implied_volatility | include_greeks=1 | Calculated IV in percent. Example: 11.87 means 11.87%. |
delta | include_greeks=1 | Estimated option-price change for a one-point change in the underlying. |
gamma | include_greeks=1 | Estimated Delta change for a one-point change in the underlying. |
theta | include_greeks=1 | Estimated one-day time effect on the option price. |
vega | include_greeks=1 | Estimated option-price change for a one-percentage-point IV change. |
No data, null Greeks, and errors
Valid request with no candles
s is no_data. The requested column layout is still returned, but candles is empty.
{
"s": "no_data",
"schema_version": 1,
"symbol": "NSE:BANKNIFTY2342042600PE",
"resolution": "1",
"greeks_at": "candle_close",
"columns": [
"timestamp", "open", "high", "low", "close", "volume",
"open_interest", "implied_volatility", "delta", "gamma",
"theta", "vega"
],
"candles": []
}
Greek unavailable for one candle
The five Greek positions are null. The API does not copy values from the previous candle and does not replace missing values with zero.
"columns": [
"timestamp", "open", "high", "low", "close", "volume",
"implied_volatility", "delta", "gamma", "theta", "vega"
],
"candles": [
[1681357500, 1080.45, 1080.50, 1080.45, 1080.50, 76,
null, null, null, null, null]
]
Validation error
Invalid input returns HTTP 422. Here, include_greeks=2 is rejected.
{
"code": -50,
"data": {
"include_greeks": "include_greeks should be either 0 or 1"
},
"message": "Invalid input",
"s": "error"
}
Safe client handling
1. Check s.
2. For ok, map every candle row using columns.
3. For no_data, treat candles: [] as a valid empty result.
4. For error, read code, message, and optional data.
5. Handle null OI or Greek values before calculations.