Calculation of Option greeks

Hi all,

I am calculating option greeks for my strategy and have doubts regarding input parameters for the model. Could someone please clarify these for me ?

For Nifty50 index options, I am using India Vix as volatility input and my calculations are matching the @sensibull platform values.

I want to calculate greeks for mid cap nifty and sensex too. What would be the volatility value for those ? Will India Vix work for them or do I need to calculate volatility separately for those indices based on their OTMs ?

Thanks in advance.

You can use stddev of daily returns for last 6 months as a substitute.

Thank you.

actually, if you see the formulas and what I will post, it will be the chicken-and-egg paradox.

India VIX is calculated based on the current Options prices.
So thats why there are two things: implied volatility(IV) which we are talking about and using StDev on Historical data is Hist Volatility(HV).

That is why India VIX will can spike up or crash even if Nifty is Flat, but that cant happen in HV calculation.

So if you want accurate greeks, you need to use IV instead of HV, and therefore use the CMP of options for which you want greeks, ie. Midcap Nifty, sensex and so on.

NSE india has whitepaper that shows how India VIX formula is calculated among other things.

Thanks @Chirag1 , I had just deleted my original post because I realized I had done a mathematical blunder in that. Was rectifying the mistake while you replied. Below is my updated code so that it doesn’t look you replied to deleted post.

My updated code looks like :

    df = index_df(symbol=instrumentName, from_date=fromDate, to_date=toDate)['CLOSE']
    daily_return = df.pct_change(1) 
    return daily_return.std(skipna=True) * math.sqrt(252)

This is giving me 11.63 for NIFTY 50 volatility and India vix for at this time is 11.53, It’s pretty close and if my option greeks values are approx correct, I will use this.

As per the difference between IV and HV, I agree with you. I went through the paper for VIX here but for my purpose implementing it will be like overkill with lots of API requests for LTP of options.

Values that I am getting using this code are :

 'NIFTY FIN SERVICE' : 0.16366998698289625
 'NIFTY MID SELECT' : 0.15166987704661453
 'NIFTY BANK' : 0.1493026750073156
 'NIFTY 50' : 0.11637015177481831
1 Like

This is what i was highlighting. Currently, your calc and India VIX are close bcos there is no foreseeable volatility.

Now if VIX were to spike up 10%, options prices will also increase? yes.
Therefore the Greeks will change, but if you are using HV or any method to calculate which uses Historical data, then your greeks will be different.

Understood your point and thanks a lot. My algo will fail to take into consideration any realtime change/spike while placing orders. Actual greeks calculated from IV will be different than mine calculated from HV.

If my algo sells 0.01 delta OTMs based on HV calculations, it might happen that in reality I am selling 0.3 or any other OTM which will considerably affect my positions.

I will try to find a library that calculates IV and option greeks. If you have any knowledge of any API/ C++/Python library please let me know.

Can you please share the code to calculate option greeks for BankNIfty.