# 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.