Skip to Content

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 resolution as 5S for seconds, or as a minute value such as 1, 5 or 60.
  • Set include_oi to 1 to add open_interest. Set include_greeks to 1 to add implied_volatility, delta, gamma, theta and vega to each candle.
  • include_greeks=1 works only for CE and PE contracts. A futures request with it returns a validation error.
  • Invalid input returns HTTP 422 with code -50. For example, include_greeks=2 is rejected because it must be 0 or 1.
  • A valid request with no candles returns s as no_data and an empty candles array. Treat this as an empty result, not a failure.
  • Greek values can be null for a candle. The API does not copy the previous candle or use zero, so handle null before 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

ExchangeHistorical Data Available From
NSE10 October 2018
BSE07 August 2023
MCX11 October 2018

Request Attributes

AttributeData TypeDescription
symbol*stringExpired Futures or Options contract symbol. Eg: NSE:NIFTY25MAR23000CE
resolution*string
  • The candle resolution. Supported values are: 5 seconds : "5S"
  • 1 minute : "1"
  • 2 minute : "2"
  • 3 minute : "3"
  • 5 minute : "5"
  • 10 minute : "10"
  • 15 minute : "15"
  • 20 minute : "20"
  • 30 minute : "30"
  • 45 minute : "45"
  • 60 minute : "60"
  • 120 minute : "120"
  • 180 minute : "180"
  • 240 minute : "240"
  • 1 Day : "1D"
  • 1 week : "1W"
  • 1 month : "1M"
date_format*intdate_format is a boolean flag. 0 to enter the epoch value. 1 to enter the date format as yyyy-mm-dd.
range_from*stringIndicating 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*stringIndicating 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_oiintset flag to "1" to enable oi as a part of the response.
include_greeksintset flag to "1" to enable greeks as a part of the response.

How the two flags change the rows

include_oiinclude_greeksFields after core OHLCV
0 / empty0 / emptyNone
10 / emptyopen_interest
0 / empty1implied_volatility, delta, gamma, theta, vega
11open_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

AttributeData TypeDescription
sstringok / no_data / error
symbolstringExpired contract symbol for which the data is returned
resolutionstringResolution of the returned candles
columnsarrayColumn 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.
candlesarray
  • Candles data containing array of following data for particular time stamp:
  • 1.Current epoch time
  • 2. Open Value
  • 3.Highest Value
  • 4.Lowest Value
  • 5.Close Value
  • 6.Total traded quantity (volume)
  • 7.Open interest (only when include_oi is 1)
  • 8.Implied volatility (only when include_greeks is 1)
  • 9.Delta (only when include_greeks is 1)
  • 10.Gamma (only when include_greeks is 1)
  • 11.Theta (only when include_greeks is 1)
  • 12.Vega (only when include_greeks is 1)
schema_versionintVersion 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

IndexColumnMeaning
0timestampCandle time as UNIX epoch seconds.
1openFirst price in the candle.
2highHighest price in the candle.
3lowLowest price in the candle.
4closeLast price in the candle.
5volumeVolume for the candle.

Optional values are appended after index 5. Clients should use columns instead of hard-coding optional indexes.

OI and Greek fields

ColumnReturned whenSimple meaning
open_interestinclude_oi=1Open Interest stored for the candle.
implied_volatilityinclude_greeks=1Calculated IV in percent. Example: 11.87 means 11.87%.
deltainclude_greeks=1Estimated option-price change for a one-point change in the underlying.
gammainclude_greeks=1Estimated Delta change for a one-point change in the underlying.
thetainclude_greeks=1Estimated one-day time effect on the option price.
vegainclude_greeks=1Estimated 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.

Last updated on