Guides /
NIFTY option data for 2020, 2021 and 2022: getting the older years
Where to get NIFTY option data for 2020 to 2022 at 1-minute, what is different about the older files, and how to join them to recent years.
The years before 2023 are where a strategy meets very different markets: the 2020 crash and recovery, then a long run of Thursday expiries. If a backtest only starts in 2023, it has never seen those. NIFTY option data for 2020, 2021 and 2022 is in our since-2020 pack, with futures and the index.
What is different about the older files
- Column names. Older files use
timestamp,strike,option_type(CE/PE),expiryandoi. Recent files use the names in the free sample. - Expiry weekday. Thursday throughout these years, with holiday shifts to Wednesday.
- Strike range. Fewer far strikes traded in the early years.
One loader for every year
import pandas as pd
RENAME = {"timestamp": "datetime", "strike": "strike_price", "option_type": "right",
"expiry": "expiry_date", "oi": "open_interest"}
def load(path):
df = pd.read_parquet(path).rename(columns=RENAME)
if "right" in df:
df["right"] = df["right"].replace({"CE": "Call", "PE": "Put"})
return df
Pack
The years 2020 to 2022 come in NIFTY Complete since 2020, which runs to the present. Single-year packs start at 2023.
Questions
Can I buy NIFTY option data for 2021 only?
The years before 2023 come in the since-2020 pack. Single-year packs are available from 2023.
Is 2020 data in the same format?
The same Parquet layout, with older column names. One rename makes them match.
Are futures and the index included for 2020?
Yes. The since-2020 pack has options, futures and the index.