2
$\begingroup$

I am trying to price Local Volatility in Python using Dupire (Finite Difference Method).

I have following set of information

Spot: 770.05, Strike: 850, Type: 'C', rfr: 0.0066, time to maturity = 25/365 days, IV: 0.19468.

In order to solve using FDM we need to find

enter image description here

enter image description here

I have used following code in python, can you please let me know what is missing here.

deltat = 0.00071 delta = 1.5

dc_by_dt = ((bsm_price('c',0.1946811865981668,770.05,850,0.0066,25.55/365)+deltat,0)) -(bsm_price('c',0.1946811865981668,770.05,850,0.0066,deltat-(25.55/365),0))) / (2 * delta)

dc2_by_dk2 = ((bsm_price('c',0.1946811865981668,770.05,(850-delta),0.0066,25.55/365,0)) - 2 * (bsm_price('c',0.1946811865981668,770.05,850,0.0066,25.55/365,0)) + (bsm_price('c',0.1946811865981668,770.05,(850 + delta),0.0066,25.55/365,0))) / (delta*delta)

local = np.sqrt((dc_by_dt)/(0.5*(850*850)*dc2_by_dk2))
$\endgroup$
  • $\begingroup$ From which library do you get bsm_price? $\endgroup$ – Sanjay Apr 29 at 15:17
  • $\begingroup$ @Sanjay, Thanks for your reply. bsm_price is function I have defined to price options using black scholes formula. In that case you need scipy and numpy. But, my real concern is about local volatility using dupire formula can you please help me with any real life example where you have worked on to get local volatility based on Implied Volatility as an input. Thanks $\endgroup$ – Add Apr 30 at 2:05
1
$\begingroup$

Unfortunately not written in Python, but in R. If you have experience with R this real life example posted on an underground quant blog has step by step what you may be looking for: (Scroll down to conclusion)

https://quantipy.wordpress.com/2017/08/21/implementation-of-dupires-formula-for-local-volatilities/

(I do not take credit for this persons work), but it's intuition has helped me greatly when I was tackling a similar volatility model problem.

I hope it helps.

$\endgroup$
  • 1
    $\begingroup$ Hi Vincent, Thanks for your reply, I did look at his work and I really appreciate that he has put lots of effort to do that. I am more keen to do it in python so I guess I need to figure out my own way. $\endgroup$ – Add May 2 at 8:02
0
$\begingroup$

By having constant implied volatility as an input you defeat the purpose of using local vol plus think about your butterfly value. I will venture to say your local vol may blow up.

A better way is to compute local variance of the actual implied vol surface.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.