Python Sample Code with output to get PCR, MaxPain, high OI and change in OI for both Nifty and Banknifty. Nearest expiry is taken by default

Python Code

import pandas as pd
from NSEOption import OptionChain
nifty_name ="Nifty"
banknifty_name = "Banknifty"

objNifty = OptionChain(nifty_name)
objBanknifty = OptionChain(banknifty_name)

oi_df = pd.DataFrame({'Script': [nifty_name, banknifty_name],
                   'Max Pain': [objNifty.max_pain, objBanknifty.max_pain],
                   'PCR': [objNifty.pcr, objBanknifty.pcr],
                   'High OI PE': [objNifty.max_high_oi_pe, objBanknifty.max_high_oi_pe],
                   'High OI CE': [objNifty.max_high_oi_ce, objBanknifty.max_high_oi_ce],
                   'Chng OI PE': [objNifty.max_change_oi_pe, objBanknifty.max_change_oi_pe],
                   'Chng OI CE': [objNifty.max_change_oi_ce, objBanknifty.max_change_oi_ce],
                   })
print(oi_df)
OptionChain Class is available

https://www.capitalzone.in/python-code-defined-as-class-to-get-nse-options-data-pcr-maxpain-high-oi-change-in-oi-for-all-scripts-like-nifty-banknifty-and-stocks/

Output

Jegathesan Durairaj, a mathematician by qualification, an Ex-software professional and now a full time Risk Defined Option Writer. With his Open Book Strategies, he is the most known identity in twitter as itjegan, with huge followers. He had won Zerodha 60 Day Challenge – 10 Times round-the-clock. He is one of the prime Option Writing Trainer and tutored close to 1000 members till now.

He is the Mastermind of CapitalZone РActive Option Trading where Traders can avail Trading Chart with customised indicators, FNO tools and Payoff analysis. His keynote is to provide whole FNO deets to be handy for Traders in a sole place.

Now he is taking more heed on hedging portfolio in Option Writing where we might subject to more market risk. He is streamlining his strategies often and improving perpetually. At this time unfolding ways to measure good-quality Trend Following System.

Conducting workshop in all Metro Cities (Delhi, Mumbai, Bangalore, Chennai and Coimbatore) often based on queries from Traders.

 

 

Leave comment

Your email address will not be published. Required fields are marked with *.