Options Data for Indian Markets
NSEpy is a library to extract historical data for Indian Equity, Index, Derivative, and Volatility Index (INDIAVIX). In this notebook, you will learn to fetch options data for the Indian equities and indices.
The notebook is divided into the following parts:
[Install NSEpy Package](#install)
[Options Data for a Particular Strike Price](#same_strike)
You need first to pip install nsepy package to fetch the data. If nsepy module is not installed in your machine, then change the below cell from Markdown to Code and run.
You can use the below command to install the nsepy package in a command prompt or Spyder IDE.
pip install nsepy
Options Data for a Particular Strike Price
You need to use the `get_history` function from the `nsepy` to get the options data.
# For data manipulation import pandas as pd import numpy as np # Import get_history function from nsepy module from nsepy import get_history # For manipulating date from datetime import date # For plotting import matplotlib.pyplot as plt %matplotlib inline plt.style.use('seaborn-darkgrid')
# Get options data for NIFTY index nifty_options = get_history(symbol='NIFTY', start=date(2021, 2, 7),