Quant advice for a newbie trying to learn Heston model calibration via QuantLib

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Quant advice for a newbie trying to learn Heston model calibration via QuantLib

Paul Cao
Hi Everyone, 

Thanks for being on this mailing-list and supporting users like me and to better the community. QuantLib has really helped me in not only having a useful library but also helped me understand some of the models in the library via the code; I'm not as strong as some of you in "groking" the formal steps of say, Heston, Black-Scholes in mathematical notations step-by-step but with the help of QuantLib's source, it has helped me in following along the derivation and the logic. 

I have a question about the Heston model calibration in QuantLib, AFAIK, to calibrate a option pricing model, 

1) Use the QuantLib::CalibrateModel::calibrate method on the model of your choice (e.g., Heston)


2) Pass into the calibrate method a collection of CalibrationHelper 


Which is essentially a collection of actual option prices with strikes and expiry for the chosen optimization algorithm to search and converge on. The Heston Model takes in 4 parameters, so the optimizer would presumably iterate by varying the initial parameters based on the derived pricing compared to actual pricing until they converges close enough. 

3) Choose the desired optimization algorithm steps, and acceptable constraint/error range. 

However, what I *don't* understand is why the calibration helper's maturity argument's time resolution is only up to day and not minute or hourly bars. 

e.g.,

HestonModelHelper(const Period &maturity...) where Period has a TimeUnit type which is a enum of {Days, Weeks, Months, Years}. Now, under regular BSM model and option prices in general, option pricing is sensitive to time resolution of expiration down to minutes especially on the day of expiration due to increasing theta decay.

So I'm not understanding why the CalibrationHelper class constructor only takes in the Day resolution to calculate the theoretical option price. Perhaps I'm missing something, I understand that Heston model models only the volatility; so perhaps the pricing calculation based off it still require the other parameters. But unfortunately, I'm unable to figure it out via the sample code or the QuantLib references,

If anyone can pinpoint me to my misunderstandings and how calibration really works, I'd greatly appreciated; thanks again for everyone's help and support, 

Best,
Paul Cao


  

  

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Quant advice for a newbie trying to learn Heston model calibration via QuantLib

Klaus Spanderen-2

Hi Paul,

 

technically speaking, QuantLib Date and DayCounter classes support "Days" as smallest granularity.

 

Given the fact that the Heston model has many shortcomings in practical usage, the missing hourly resolution is really a minor problem for the calibration (...and IMO the error almost cancels out because the Black-Scholes reference price is also calculated using the same day counter).

 

The missing resolution becomes a problem if one e.g. tries to calculate the "pin" risk for an ATM option a few hours before expiry.

 

 

regards

Klaus

 

On Friday, November 15, 2013 01:49:43 AM Paul Cao wrote:

Hi Everyone, 


Thanks for being on this mailing-list and supporting users like me and to better the community. QuantLib has really helped me in not only having a useful library but also helped me understand some of the models in the library via the code; I'm not as strong as some of you in "groking" the formal steps of say, Heston, Black-Scholes in mathematical notations step-by-step but with the help of QuantLib's source, it has helped me in following along the derivation and the logic. 


I have a question about the Heston model calibration in QuantLib, AFAIK, to calibrate a option pricing model, 


1) Use the QuantLib::CalibrateModel::calibrate method on the model of your choice (e.g., Heston)

http://quantlib.sourcearchive.com/documentation/1.1-1/classQuantLib_1_1HestonModel.html


http://quantlib.sourcearchive.com/documentation/1.1-1/classQuantLib_1_1CalibratedModel_ab3876cc20f2a7dd368789e5f6960707c.html#ab3876cc20f2a7dd368789e5f6960707c


2) Pass into the calibrate method a collection of CalibrationHelper 


http://www.pkill.info/linux/man/3-HestonModelHelper/


Which is essentially a collection of actual option prices with strikes and expiry for the chosen optimization algorithm to search and converge on. The Heston Model takes in 4 parameters, so the optimizer would presumably iterate by varying the initial parameters based on the derived pricing compared to actual pricing until they converges close enough. 


3) Choose the desired optimization algorithm steps, and acceptable constraint/error range. 


However, what I *don't* understand is why the calibration helper's maturity argument's time resolution is only up to day and not minute or hourly bars. 


e.g.,


HestonModelHelper(const Period &maturity...) where Period has a TimeUnit type which is a enum of {Days, Weeks, Months, Years}. Now, under regular BSM model and option prices in general, option pricing is sensitive to time resolution of expiration down to minutes especially on the day of expiration due to increasing theta decay.


So I'm not understanding why the CalibrationHelper class constructor only takes in the Day resolution to calculate the theoretical option price. Perhaps I'm missing something, I understand that Heston model models only the volatility; so perhaps the pricing calculation based off it still require the other parameters. But unfortunately, I'm unable to figure it out via the sample code or the QuantLib references,


If anyone can pinpoint me to my misunderstandings and how calibration really works, I'd greatly appreciated; thanks again for everyone's help and support, 


Best,

Paul Cao



  


  




------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Quant advice for a newbie trying to learn Heston model calibration via QuantLib

stephan buschmann
Hi Klaus,
just catching up this thread.
What is your experience in using the heston model and what are the
practical shortcomings you saw? Is the model not easy to calibrate or
what is it?
Many thanks!
stephan

On Fri, Nov 15, 2013 at 10:35 PM, Klaus Spanderen <[hidden email]> wrote:

> Hi Paul,
>
>
>
> technically speaking, QuantLib Date and DayCounter classes support "Days" as
> smallest granularity.
>
>
>
> Given the fact that the Heston model has many shortcomings in practical
> usage, the missing hourly resolution is really a minor problem for the
> calibration (...and IMO the error almost cancels out because the
> Black-Scholes reference price is also calculated using the same day
> counter).
>
>
>
> The missing resolution becomes a problem if one e.g. tries to calculate the
> "pin" risk for an ATM option a few hours before expiry.
>
>
>
>
>
> regards
>
> Klaus
>
>
>
> On Friday, November 15, 2013 01:49:43 AM Paul Cao wrote:
>
> Hi Everyone,
>
>
> Thanks for being on this mailing-list and supporting users like me and to
> better the community. QuantLib has really helped me in not only having a
> useful library but also helped me understand some of the models in the
> library via the code; I'm not as strong as some of you in "groking" the
> formal steps of say, Heston, Black-Scholes in mathematical notations
> step-by-step but with the help of QuantLib's source, it has helped me in
> following along the derivation and the logic.
>
>
> I have a question about the Heston model calibration in QuantLib, AFAIK, to
> calibrate a option pricing model,
>
>
> 1) Use the QuantLib::CalibrateModel::calibrate method on the model of your
> choice (e.g., Heston)
>
> http://quantlib.sourcearchive.com/documentation/1.1-1/classQuantLib_1_1HestonModel.html
>
>
> http://quantlib.sourcearchive.com/documentation/1.1-1/classQuantLib_1_1CalibratedModel_ab3876cc20f2a7dd368789e5f6960707c.html#ab3876cc20f2a7dd368789e5f6960707c
>
>
> 2) Pass into the calibrate method a collection of CalibrationHelper
>
>
> http://www.pkill.info/linux/man/3-HestonModelHelper/
>
>
> Which is essentially a collection of actual option prices with strikes and
> expiry for the chosen optimization algorithm to search and converge on. The
> Heston Model takes in 4 parameters, so the optimizer would presumably
> iterate by varying the initial parameters based on the derived pricing
> compared to actual pricing until they converges close enough.
>
>
> 3) Choose the desired optimization algorithm steps, and acceptable
> constraint/error range.
>
>
> However, what I *don't* understand is why the calibration helper's maturity
> argument's time resolution is only up to day and not minute or hourly bars.
>
>
> e.g.,
>
>
> HestonModelHelper(const Period &maturity...) where Period has a TimeUnit
> type which is a enum of {Days, Weeks, Months, Years}. Now, under regular BSM
> model and option prices in general, option pricing is sensitive to time
> resolution of expiration down to minutes especially on the day of expiration
> due to increasing theta decay.
>
>
> So I'm not understanding why the CalibrationHelper class constructor only
> takes in the Day resolution to calculate the theoretical option price.
> Perhaps I'm missing something, I understand that Heston model models only
> the volatility; so perhaps the pricing calculation based off it still
> require the other parameters. But unfortunately, I'm unable to figure it out
> via the sample code or the QuantLib references,
>
>
> If anyone can pinpoint me to my misunderstandings and how calibration really
> works, I'd greatly appreciated; thanks again for everyone's help and
> support,
>
>
> Best,
>
> Paul Cao
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Quant advice for a newbie trying to learn Heston model calibration via QuantLib

Klaus Spanderen-2

Hi Stephan,

 

A few shortcomings in my (biased) opinion:

The calibration errors are somethimes really big e.g. for equities on the short end for OTM puts. This can be solved using stochastic local volatility models or to some extend using a Heston model with jumps and/or time dependent parameters.

 

The volatility dynamics with respect to movements of the underlying is not "natural" (at least IMO for equity markets). See e.g. conclusion in

http://www.icmacentre.ac.uk/files/discussion-papers/dp201005.pdf

 

Unrealistic square-root variance process with non zero probability at zero variance if the Feller constraint is violated and the Feller constraint is often violated when calibrating to real market data.

 

But every model has a bunch of shortcomings and I don't want to questioning the model as such. I just don't think that the missing hourly resolution during the calibration is a bigger problem.

 

regards

Klaus

 

On Friday, November 15, 2013 10:43:16 PM stephan buschmann wrote:

> Hi Klaus,

> just catching up this thread.

> What is your experience in using the heston model and what are the

> practical shortcomings you saw? Is the model not easy to calibrate or

> what is it?

> Many thanks!

> stephan

>

> > https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users