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.

SnapshotMax pain to closeIndex at snapshot to closeWithin 0.5% of close: max pain / indexMax pain closer than index
Previous session, 15:29 IST0.58% (139.7 points)0.50% (119.0 points)43.3% / 50.3%35.7% of expiries
Expiry day, 09:20 IST0.43% (105.5 points)0.38% (90.7 points)54.1% / 61.8%36.3%
Expiry day, 12:00 IST0.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)TypeMeaning
datetime · timestamptimestampBar start time, IST wall-clock (e.g. 2026-09-10 09:15:00)
stock_code · —stringUnderlying code: NIFTY, or BSESEN for SENSEX
exchange_code · —stringNFO (NSE F&O) or BFO (BSE F&O)
product_type · —stringOptions
expiry_date · expirystringContract expiry (A: 15-SEP-2026, B: 2026-09-15)
strike_price · strikenumberStrike price
right · option_typestringA: Call / Put, B: CE / PE
open / high / low / closefloatTraded premium OHLC within the bar
volumeintVolume traded in the bar
open_interest · oiintOpen 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

Index and commodity data only.