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?
-
$\begingroup$ 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. $\endgroup$– Bryce XuAug 30, 2018 at 6:18
-
$\begingroup$ 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. $\endgroup$– Bryce XuAug 30, 2018 at 6:19
1 Answer
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.
-
$\begingroup$ 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? $\endgroup$– Bryce XuAug 30, 2018 at 10:12
-
$\begingroup$ One constructor takes Black vol and local vol; the other doesn't. $\endgroup$ Aug 30, 2018 at 14:42
-
1$\begingroup$ The conversion is at github.com/lballabio/QuantLib/blob/master/ql/processes/… $\endgroup$ Aug 30, 2018 at 14:42
-
$\begingroup$ 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? $\endgroup$– Bryce XuAug 31, 2018 at 0:49
-
$\begingroup$ No, the implementation of the BS process is based on log(S). $\endgroup$ Aug 31, 2018 at 7:05