# how to price barrier option under local vol model using QuantLib

I use QuantLib in Python. Now I have implied volatility surface data. How can I get the local vol surface than using finite difference method to price a barrier option in QuantLib?

• I use BlackVarianceSurface to get the implied vol surface. Then use LocalVolSurface to get the local vol surface. When using GeneralizedBlackScholesProcess, I don't know how to use the local vol surface. – Bryce Xu Aug 30 '18 at 6:18
• In GeneralizedBlackScholesProcess, the model looks like this - dlnS(t)=(r(t)−q(t)−σ(t,S))dt+σdWt. However, I want the sigma before dWt to be local, no constant. ALso, I found that in Python, GeneralizedBlackScholesProcess can only use blackvol but not local vol surface. – Bryce Xu Aug 30 '18 at 6:19

From a cursory look, the FdBlackScholesBarrierEngine seems to do what you want; when the localVol parameter is set to true, it will use the local volatility contained in the passed process. I'd suggest you to check the code, though.

As a further note: the GeneralizedBlackScholesProcess class converts the Black volatility to the local one internally (see the code here) so you might not need to.

• Thanks for your answer. I wanna know how The GeneralizedBlackScholesProcess class converts the Black volatility to local one internally. I am new to QuantLib. In the parameters list, I need to input blackVolTS and localVolTS. Currently I only know BlackConstantVol. Is there any other kind blackvol in QuantLib? – Bryce Xu Aug 30 '18 at 10:12
• One constructor takes Black vol and local vol; the other doesn't. – Luigi Ballabio Aug 30 '18 at 14:42
• The conversion is at github.com/lballabio/QuantLib/blob/master/ql/processes/… – Luigi Ballabio Aug 30 '18 at 14:42
• But when I use the constructor taking Black vol and Local vol, the model is under this one - d\ln S(t) = (r(t) - q(t) - \frac{\sigma(t, S)^2}{2}) dt + \sigma dW_t.. I wanna price the option under this one - dSt = rStdt + σ(t,St)Std_Wt. Can I do that in the QuantLib? – Bryce Xu Aug 31 '18 at 0:49
• No, the implementation of the BS process is based on log(S). – Luigi Ballabio Aug 31 '18 at 7:05