0
$\begingroup$

Does anyone have experience with the Python QuantLib function HestonBlackVolSurface? I'm trying to produce a 3D plot of the volatility surface as done in the example

http://gouthamanbalaraman.com/blog/volatility-smile-heston-model-calibration-quantlib-python.html

Here is my attempt, based on the data of the example

import QuantLib as quant
heston_vol_surface = quant.HestonBlackVolSurface(
                        quant.HestonModelHandle(model),
                        quant.AnalyticHestonEngine.Gatheral)

strikes_grid = np.arange(strikes[0], strikes[-1],10)
expiry = 1.0
implied_vols = [heston_vol_surface.blackVol(expiry, s)
                for s in strikes_grid]

I understand that I need to pass the the volatility term structure, but my knowledge of QuantLib is too limited right now. Thanks for you help.

$\endgroup$
1
$\begingroup$

Here is something I did, maybe it helps:

https://colab.research.google.com/drive/1M1YJncdswd-A9SgIOAjw6g6Se7NHU9mG?usp=sharing

| improve this answer | |
$\endgroup$
  • $\begingroup$ You should include the content from your link. It would be helpful for future viewers should the link break. $\endgroup$ – amdopt May 20 at 13:21
  • $\begingroup$ @Ege Yilmaz thanks, that really helped a lot! $\endgroup$ – FunnyBuzer May 21 at 11:05

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.