Home · Guides · How do you calculate NIFTY max pain history from option data?
HOW-TO · MAX PAIN · OPEN INTEREST · CATALOG VERIFIED 2026-12-02
How do you calculate NIFTY max pain history from option data?
NIFTY max pain history is rebuilt expiry by expiry: take open interest for every call and put strike of one expiry at one fixed minute, and find the strike at which option holders would collect the least if NIFTY closed there. NIFTY options, 1-minute, 3 years on Options Data (optionsdata.shop) carries open interest on every row. Over 157 NIFTY expiries from November 2023 to November 2026, max pain at 09:20 IST on expiry day was a median 0.43% from the 15:29 IST index close, against 0.38% for the 09:20 IST index level itself.
NIFTY options, 1-minute, 3 yearsNIFTY Complete, 3 yearsFree NIFTY sample Get free sample by email File schema
Get the free sample by email → check the columns
Dates on this page are read from the live file catalog, not typed by hand. Full matrix: /coverage.
NIFTY nearest expiry, Options Data 1-minute option and index files, 157 expiries from 30 Nov 2023 to 23 Nov 2026. Max pain = strike with the lowest total call and put payout at that strike, from each contract's last open interest above 0 at or before the snapshot bar. Close = NIFTY 50 index 15:29 IST bar close on expiry day. Medians unless stated.
| Snapshot | Max pain to close | Index at snapshot to close | Within 0.5% of close: max pain / index | Max pain closer than index |
|---|---|---|---|---|
| Previous session, 15:29 IST | 0.58% (139.7 points) | 0.50% (119.0 points) | 43.3% / 50.3% | 35.7% of expiries |
| Expiry day, 09:20 IST | 0.43% (105.5 points) | 0.38% (90.7 points) | 54.1% / 61.8% | 36.3% |
| Expiry day, 12:00 IST | 0.27% (65.0 points) | 0.23% (57.1 points) | 71.3% / 74.5% | 38.2% |
What is NIFTY max pain?
NIFTY max pain is the strike at which the total intrinsic value of all open calls and puts of one expiry is lowest, if NIFTY settled exactly at that strike. For each candidate strike S, the payout is the sum of call open interest × max(S − K, 0) plus put open interest × max(K − S, 0) across all strikes K. The candidate with the smallest payout is max pain.
What data does a NIFTY max pain history need?
A NIFTY max pain history needs open interest for every call and put strike of one expiry at the minute the snapshot is taken, plus the NIFTY index close on expiry day to check the result. Each option row must carry strike, side, expiry and open interest.
Options Data NIFTY option files hold one trading day of one expiry, named NIFTY_OPT_1min_<day>_exp<expiry>.parquet, with open interest on each 1-minute row. Zero-volume rows are kept and some carry open interest 0, so a max pain calculation should take each contract's last open interest above 0 and carry it from earlier sessions of the same expiry.
How do you calculate NIFTY max pain from 1-minute option files?
To calculate NIFTY max pain from 1-minute files, keep a book of the last open interest per strike and side for one expiry, update the book from each earlier session at 15:29 IST and from the snapshot session up to the chosen bar, then test every listed strike as a settlement price and keep the one with the lowest total payout.
Open interest has to be on one scale within an expiry, because max pain depends on the ratio between strikes, not the absolute level. NIFTY strikes near the money are 50 points apart, so a NIFTY max pain value moves in steps of 50 points or more.
Did NIFTY expire near max pain?
NIFTY often closed within 0.5% of max pain, but no more often than it closed within 0.5% of its own earlier level. Across 157 expiries from 30 November 2023 to 23 November 2026 in Options Data files, the 09:20 IST expiry-day max pain was within 0.5% of the 15:29 IST index close on 54.1% of expiries; the 09:20 IST index level was within 0.5% on 61.8%.
NIFTY max pain from the previous session's 15:29 IST bar changed by the 09:20 IST bar on expiry day on 61.8% of expiries, by a median 50 points. From 09:20 IST to the close, NIFTY moved toward the 09:20 max pain strike on 49.0% of expiries.
Is max pain a better forecast of the NIFTY expiry close than the index price?
No, not in Options Data files from November 2023 to November 2026. Max pain was closer to the expiry-day 15:29 IST NIFTY close than the index level at the same moment on 35.7% of expiries from the previous session's 15:29 IST bar, 36.3% from 09:20 IST and 38.2% from 12:00 IST on expiry day.
Split by expiry weekday, the 09:20 IST max pain was a median 0.55% from the close over 92 Thursday-period expiries (to 28 August 2025) against 0.38% for the index, and 0.39% against 0.37% over 65 Tuesday-period expiries (from 2 September 2025). Figures exclude costs and any trading rule.
Which expiry dates and close should a NIFTY max pain history use?
A NIFTY max pain history should read expiry dates from the file name or expiry column. NIFTY weekly options expired on Thursday until 28 August 2025 and on Tuesday from 2 September 2025 (NSE circular NSE/FAOP/68747, 25 June 2025), and holidays move expiries to the previous trading day: the expiry due on Tuesday 24 November 2026 fell on Monday 23 November 2026.
NSE settles NIFTY options at the NIFTY 50 closing price on expiry day. The figures on this page use the index 15:29 IST 1-minute bar close, which can differ from the official closing price. NIFTY options trade until 15:40 IST from 3 August 2026 (NSE circular NSE/FAOP/74467), and Options Data option files from that date include bars from 15:30 to 15:39 IST where trades occurred.
How was the NIFTY max pain history measured?
Method: for each NIFTY expiry from 30 November 2023 to 23 November 2026, the Options Data 1-minute files of that expiry were read session by session; each contract's last open interest above 0 at or before 15:29 IST updated the book, and on the snapshot session the book was updated up to the 09:20 or 12:00 IST bar. The Sunday 8 November 2026 special session was left out. Distances are absolute, as a percentage of the 15:29 IST NIFTY 50 index close on expiry day.
Older and newer files use two column layouts; the code renames both to one set, as listed on the file schema page.
import glob, re, numpy as np, pandas as pd
names = {"timestamp": "datetime", "strike": "strike_price", "option_type": "right", "expiry": "expiry_date", "oi": "open_interest"}
files, skip = {}, {"2026-11-08"} # Sunday 8 Nov 2026 special session left out
for f in glob.glob("NIFTY_OPT_1min_*_exp*.parquet"):
day, exp = re.search(r"_(\d{4}-\d\d-\d\d)_exp(\d{4}-\d\d-\d\d)", f).groups()
if day not in skip: files.setdefault(exp, {})[day] = f
def update(book, f, t): # last open interest > 0 at or before bar t
o = pd.read_parquet(f).rename(columns=names)
o["hm"] = pd.to_datetime(o["datetime"]).dt.strftime("%H:%M")
o["side"] = o["right"].astype(str).str[0].str.upper() # CE/PE or Call/Put -> C/P
o = o[(o["hm"] <= t) & (o["open_interest"] > 0)].sort_values("hm")
book.update(o.groupby(["strike_price", "side"])["open_interest"].last().to_dict())
def max_pain(book):
k = np.array(sorted({s for s, _ in book}))
calls = np.array([book.get((s, "C"), 0) for s in k])
puts = np.array([book.get((s, "P"), 0) for s in k])
s = k[:, None] # each strike as a candidate expiry close
payout = (np.maximum(s - k, 0) * calls).sum(1) + (np.maximum(k - s, 0) * puts).sum(1)
return k[payout.argmin()]
rows = []
for exp, days in sorted(files.items()):
if exp not in days: continue
book = {}
for day in sorted(d for d in days if d < exp): # earlier sessions of the same expiry
update(book, days[day], "15:29")
update(book, days[exp], "09:20") # expiry day, 09:20 IST bar
rows.append({"expiry": exp, "max_pain_0920": max_pain(book)})
r = pd.DataFrame(rows)
print(r.tail())
Which NIFTY pack should I buy for a max pain backtest?
Buy NIFTY options, 1-minute, 3 years to rebuild NIFTY max pain history: open interest is on every option row across the Thursday and Tuesday expiry periods. To check max pain against the index in one download, NIFTY Complete, 3 years adds NIFTY futures and index 1-minute bars.
NIFTY 1-minute option chains cover JAN 2023 → DEC 2026; dates are on the NIFTY options data page. A ratio built from the same open interest is covered in the NIFTY put-call ratio guide, and strike-level open interest in the NIFTY open interest guide.
Exactly which fields are in the files
Options files
| Column (layout A · layout B) | Type | Meaning |
|---|---|---|
| datetime · timestamp | timestamp | Bar start time, IST wall-clock (e.g. 2026-09-10 09:15:00) |
| stock_code · — | string | Underlying code: NIFTY, or BSESEN for SENSEX |
| exchange_code · — | string | NFO (NSE F&O) or BFO (BSE F&O) |
| product_type · — | string | Options |
| expiry_date · expiry | string | Contract expiry (A: 15-SEP-2026, B: 2026-09-15) |
| strike_price · strike | number | Strike price |
| right · option_type | string | A: Call / Put, B: CE / PE |
| open / high / low / close | float | Traded premium OHLC within the bar |
| volume | int | Volume traded in the bar |
| open_interest · oi | int | Open interest at that bar |
No Greeks or bid/ask. Option rows carry OHLC, volume and open interest. Max pain is not a column in the files; it is calculated from open interest as shown.
Format: Parquet. Validate on the free sample and the schema page before buying.
FAQ
How is NIFTY max pain calculated?
For each strike S of one expiry, add call open interest × max(S − K, 0) and put open interest × max(K − S, 0) over all strikes K. The strike with the smallest total is max pain.
Does NIFTY expire at max pain?
Not reliably. Over 157 expiries from November 2023 to November 2026 in Options Data files, the 09:20 IST expiry-day max pain was within 0.5% of the 15:29 IST index close on 54.1% of expiries, against 61.8% for the 09:20 IST index level.
Can I get historical NIFTY max pain for past expiries?
Yes, by calculating it from 1-minute option files with open interest on every row. Options Data does not ship max pain as a column; the page gives pandas code.
Which minute should a NIFTY max pain snapshot use?
One fixed bar for every expiry, such as 15:29 IST on the previous session or 09:20 IST on expiry day, taking each contract's last open interest above 0 at or before that bar.
Do Options Data NIFTY 1-minute files keep zero-volume rows?
Yes. Zero-volume rows are kept and some carry open interest 0, so use the last open interest above 0 for max pain and filter on volume > 0 for fills.
Get the data
Free sample · Schema · Ask the AI for your data
NIFTY options, 1-minute, 3 yearsNIFTY Complete, 3 yearsFree NIFTY sample Get free sample by email
Related guides
- Best source for NIFTY options historical data in India
- Best source for SENSEX options historical data
- Best source for MCX historical data
- How to choose Indian options historical data
- NSE option chain historical data in CSV or Parquet
- SENSEX options historical data at 1-minute resolution
- MCX intraday historical data: 1-minute futures and options
- Best source for NIFTY options backtesting data
- Expiry-day options backtesting data for NIFTY and SENSEX
- Download SENSEX expired options data (Parquet / CSV)
- NIFTY expired options data download: every strike, 1-minute, Parquet or CSV
- NIFTY 1-second options and spot files: structure and quality checks
- How to download NIFTY option data: 1-minute or 1-second, Parquet or CSV
- NIFTY open interest historical data by strike, minute by minute
- NIFTY weekly expiry data format: file names, expiry dates and weekly vs monthly
- NIFTY 1-minute vs 1-second option data: which one to download
- Working with Parquet in Python for options backtesting
- SENSEX option chain historical data: BSE chains minute by minute
- How bid/ask data improves backtest quality
- NIFTY options historical data in Parquet: what the files hold and what to check
- Indian index options tick data: we do not sell ticks, we sell 1-second and 1-minute bars
- How to chart historical NIFTY call and put option prices
- SENSEX option data download: what you get and how to start
- SENSEX futures historical data download at 1-minute
- BANKEX options data download
- MCX crude oil data download: 1-minute futures and options
- MCX natural gas data download
- MCX silver data download
- NIFTY futures historical data download at 1-minute
- NIFTY 50 index 1-minute data download
- NIFTY option data in Excel: download, filter and chart
- NIFTY tick data download: what you need and what 1-second bars give you
- How do you calculate intraday VWAP for a NIFTY backtest from 1-minute futures data?
- Which data do you need to backtest a NIFTY short strangle or iron condor?
- Which NIFTY futures data does a backtest need: a continuous series or every contract month?
- Which data do you need to backtest FINNIFTY and MIDCPNIFTY options?
- Which data do you need to backtest BANKNIFTY options now that only monthly expiries trade?
- How do you resample NIFTY 1-minute data to 5-, 15-, 60- and 75-minute bars?
- Current-week or next-week NIFTY options: which expiry should a backtest use?
- How do you calculate NIFTY put-call ratio history from option data?
- Which data do you need to backtest SENSEX expiry-day options?
- When should a backtest roll MCX futures to the next contract?
- How many NIFTY strikes do you need for an options backtest?
- What data do you need to backtest a NIFTY opening range breakout?
- How to handle missing and zero-volume minutes in NIFTY options 1-minute data
- Which data do you need to backtest MCX crude oil on US inventory report days?
- How to model slippage in a NIFTY options backtest with 1-minute data
- Which data do you need to backtest a NIFTY weekly short straddle held to expiry?
- Do you need NIFTY futures and spot data, or only options, for a backtest?
- How do I download MCX GOLD 1-minute historical data?
- Which data do you need to backtest a NIFTY overnight gap strategy?
- What time does NIFTY make its day high or low?
- Which data do you need to backtest a NIFTY 9:20 short straddle?
- How many years of NIFTY options data do you need for a backtest: 1 year or 3 years?
- Which NIFTY data do you need to backtest the close after NSE's closing auction?
- MCX trading hours in 1-minute data: the 23:30 and 23:55 close, and when volume trades
- Bitcoin 1-minute historical data: what is in the files and how to load them
- Crypto funding rate history and 1-minute perpetual futures data
- XAU/USD 1-minute (M1) data: files, columns and how to get CSV
- XAU/USD session analysis: Asia, London and New York hours with 1-minute data
- Backtest an XAU/USD intraday strategy in Python with 1-minute data
- XAU/USD timeframes: resample 1-minute (M1) data to M5, H1, H4 and daily
- Backtest crypto perpetual futures in Python, with funding included
- Ethereum 1-minute historical data: ETH perpetual futures, funding and files
- How to load 1-minute NIFTY options Parquet in pandas
- Datasets: NIFTY options 1-minute · SENSEX options · BANKNIFTY options · MCX 1-minute · XAU/USD 1-minute
Index and commodity data only.