|
From: Daniel <gr...@gm...> - 2022-09-14 21:59:39
|
Thank you Peter for your explanation. For "coterminal atm strip", is the constant (expiry + tenor) a choice of convenience, or a choice of necessity? Do you have some paper to share? If comparing GSR and G2++, will GSR still be considered a better choice than G2++ since GSR sigma is piecewise constant? Thanks, Mark On Sat, Sep 10, 2022 at 6:04 AM Peter Caspers <pca...@gm...> wrote: > That's good to hear. > > By "option strip" I mean a series of swaptions with strictly ascending > option expiry dates. For example, a "coterminal atm strip" would be an > option strip where option expiry time + underlying tenor = constant > and strike = atm forward. > > The GSR model can be calibrated exactly to such a strip when you > choose the step dates = option strip expiry dates (omitting the last > expiry date) and an exogenous mean reversion. Well, that's not > completely true, especially for rapidly decreasing market vols in > option expiry direction and / or negative mean reversion values, where > the GSR model might overprice longer term options because it has > accumulated too much volatility for shorter options already which it > can not reduce fast enough. But under usual circumstances this works > fine. > > You can even bootstrap the volatility function iterating through the > swaptions of the strip one by one which is often faster than a global > calibration to all swaptions simultaneously. That kind of calibration > is kind of the "minimal standard" in the market to price e.g. Bermudan > swaptions. > > G2++ is still not flexible enough for a global calibration I guess. > For a global calibration you rather want to use e.g. a Libor market > model or a higher dimensional HJM model. To match smiles you'll also > need to consider stochastic vols. > > Thanks > Peter > > > Peter > > On Tue, 30 Aug 2022 at 17:04, Daniel <gr...@gm...> wrote: > > > > Peter, > > > > Thank you for your answer. I tried > Gaussian1dJamshidianSwaptionEngine(model), now I can get the calibrated > model parameters. > > > > My exercise is to calibrate 1F hw model parameter using the whole vol > surface, so I can use it for pricing(such as swaption). Sorry I am not > familiar with option strip, can you elaborate on what is the model > associated with option strip. If 1F HW model is not good to calibrate the > whole vol surface, how about G2++ model? > > > > Thanks, > > Mark > > > > On Sat, Aug 27, 2022 at 7:27 AM Peter Caspers <pca...@gm...> > wrote: > >> > >> Hi Daniel > >> > >> you could use the Gaussian1dJamshidianSwaptionEngine instead of the > >> engine based on numerical integration. However I notice we never added > >> an override for zerobondOption() in the GSR model class, so we'll fall > >> back on the numerical integration implemented in the Gaussian1dModel > >> base class. To be honest, the whole implementation of the "Gaussian1d" > >> - framework was always more geared towards the Markov functional model > >> and the GSR model was more a "trivial by-product". > >> > >> As seen from today I'd rather consolidate the LGM1F model implemented in > >> > >> > https://github.com/OpenSourceRisk/Engine/blob/master/QuantExt/qle/models/lgm.hpp > >> > >> into the core library and use the engines associated with that model. > >> Not sure if I'd deprecate the GSR imlementation, but it duplicates > >> functionality alright and we don't want to maintain both models in the > >> long term. That might not help you immediately, especially since you > >> are using the QuantLib Python wrapper! I still wanted to mention it > >> since that consolidation would make a lot of sense in my opinion. > >> > >> More generally, could you elaborate on what the goal of your exercise > >> is? A Hull White 1F model is not really designed to fit a whole vol > >> matrix, an option strip is really all it can handle well? > >> > >> Finally, since we have Dmitri on this thread, here is a crazy idea: > >> Use his AADC library to tape the slow GSR-pricing of the 13x13 > >> swaptions and then replay the tape during the optimization to speed > >> that up. That might be an interesting case study for the technology? > >> > >> Thanks > >> Peter > >> > >> > >> > >> > >> > >> On Thu, 25 Aug 2022 at 11:10, Daniel <gr...@gm...> wrote: > >> > > >> > Thank you Peter for your information. I overwrote T to 61, now I can > see runtimeError is gone. > >> > > >> > But I had a new issue of very long calibration time now. > >> > I am calibrating a 13 (maturity) x 13 (tenor) volatility surface, and > I am using constant mean reversions and piecewise constant volatility as > below: > >> > stepDates is set at time grid @ [1,2,5,7,10,20] year from the > valuation date > >> > reversions = [ql.QuoteHandle(ql.SimpleQuote(0.0001))] > >> > sigmas = [ql.QuoteHandle(ql.SimpleQuote(0.006)) for i in range(0, > len(stepDates)+1)] > >> > > >> > In order to expedite calibration, I used low optimization criteria > for LM method and end criteria as below. But I tested below code, the code > can solve low dimension volatility surface(which means the code is > working), but it takes already 6 hours and haven't solved 13X13 volatility > surfaces. Any suggestion to calibrate faster? > >> > > >> > model = ql.Gsr(term_structure,stepDates, sigmas,reversions,61); > >> > engine = ql.Gaussian1dSwaptionEngine(model, 64, 7.0, True, False, > term_structure) > >> > swaptions = create_swaption_helpers(data, index, term_structure, > engine) > >> > optimization_method =ql.LevenbergMarquardt(1.0e-2,1.0e-2,1.0e-2) > >> > end_criteria = ql.EndCriteria(1000, 10, 1e-2, 1e-3, 1e-3) > >> > model.calibrate(swaptions, optimization_method, end_criteria) > >> > > >> > Thanks, > >> > Mark > >> > > >> > On Wed, Aug 24, 2022 at 9:36 AM Peter Caspers <pca...@gm...> > wrote: > >> >> > >> >> Hi Daniel > >> >> > >> >> yes you'd change T in the ctor call ql.Gsr(...). > >> >> > >> >> 1. T is the maturity of the zero bond P(0, T) used as a numeraire in > >> >> the T-Forward measure > >> >> 2. years > >> >> 3. slightly higher than 60 I'd think to capture day counter / > >> >> convention / lag effects, maybe 61 is sufficient already > >> >> > >> >> Thanks > >> >> Peter > >> >> > >> >> > >> >> On Wed, 24 Aug 2022 at 11:47, Daniel <gr...@gm...> wrote: > >> >> > > >> >> > Peter, > >> >> > Thank you for your reply. > >> >> > Just want to make sure overwriting T means I should change below > statement > >> >> > model = ql.Gsr(term_structure,stepDates, > sigmas,reversions,T=60); > >> >> > to use some other T value instead, am I right? > >> >> > Two questions: > >> >> > 1. What is the meaning of T here? > >> >> > 2. What is the unit for T (month, year)? > >> >> > 3. If my calibrated swaption has a maximum 30Y x 30Y matrix, what > is the T value I should use? > >> >> > > >> >> > Thanks, > >> >> > Mark > >> >> > > >> >> > > >> >> > On Tue, Aug 23, 2022 at 1:30 PM Peter Caspers < > pca...@gm...> wrote: > >> >> >> > >> >> >> Hi > >> >> >> > >> >> >> the GSR model operates in the T-forward measure with T=60 by > default. You can overwrite T in the constructor if longer horizons are > needed (as it appears to be the case in your setup). > >> >> >> > >> >> >> Best > >> >> >> Peter > >> >> >> > >> >> >> > >> >> >> Daniel <gr...@gm...> schrieb am Mo. 22. Aug. 2022 um 21:25: > >> >> >>> > >> >> >>> Thank you Dmitri for your information. Actually I increased the > vol surface number to more than to be calibration volatility number, now I > can solve for mean reversion and volatility now. > >> >> >>> > >> >> >>> But experience another error when I tried to change the yield > curve and volatility surface to some other type, I got below error. > >> >> >>> > >> >> >>> ---> 14 model.calibrate(swaptions, optimization_method, > end_criteria) > >> >> >>> > >> >> >>> ~\.conda\envs\tf-gpu\lib\site-packages\QuantLib\QuantLib.py in > calibrate(self, *args) > >> >> >>> > >> >> >>> def calibrate(self, *args): > >> >> >>> > return _QuantLib.Gsr_calibrate(self, *args) > >> >> >>> > >> >> >>> def setParams(self, params): > >> >> >>> > >> >> >>> RuntimeError: G(t,w) should be called with > (t,w)=(29.9985,60.0055) in Range [0,60]. > >> >> >>> > >> >> >>> > >> >> >>> What does this runtimeError mean? > >> >> >>> > >> >> >>> > >> >> >>> Thanks, > >> >> >>> > >> >> >>> Mark > >> >> >>> > >> >> >>> > >> >> >>> > >> >> >>> > >> >> >>> > >> >> >>> > >> >> >>> On Mon, Aug 22, 2022 at 12:50 PM Dmitri Goloubentsev < > dm...@ma...> wrote: > >> >> >>>> > >> >> >>>> Hi Mark, > >> >> >>>> > >> >> >>>> > >> >> >>>> The error is coming from LM optimiser. You should reduce number > of points in your vol surface or add more calibration instruments or add > some sort of regularisation. > >> >> >>>> > >> >> >>>> Kind regards, > >> >> >>>> Dmitri. > >> >> >>>> > >> >> >>>> On Mon, 22 Aug 2022, 17:26 Daniel, <gr...@gm...> wrote: > >> >> >>>>> > >> >> >>>>> All, > >> >> >>>>> > >> >> >>>>> Please forgive me if someone has answered a similar question > before. > >> >> >>>>> > >> >> >>>>> I am trying to calibrate interest rate vol surface using GSR > (gaussian short rate model) based on this post > >> >> >>>>> > http://gouthamanbalaraman.com/blog/short-interest-rate-model-calibration-quantlib.html > >> >> >>>>> > >> >> >>>>> and I found a python example for GSR model calibration. > >> >> >>>>> > https://github.com/mlungwitz/notebooks/blob/master/GSR_Example.ipynb > >> >> >>>>> > >> >> >>>>> What I tried to do is to calibrate the same european swaption > vol surface in the 1st python example based on 2nd example gsr model > specification, what I added is: > >> >> >>>>> gsr = ql.Gsr(term_structure,stepDates, sigmas,reversions); > >> >> >>>>> engine = ql.Gaussian1dSwaptionEngine(gsr, 64, 7.0, True, > False, term_structure) > >> >> >>>>> swaptions = create_swaption_helpers(data, index, > term_structure, engine) > >> >> >>>>> > >> >> >>>>> optimization_method = > ql.LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) > >> >> >>>>> end_criteria = ql.EndCriteria(1000, 100, 1e-6, 1e-8, 1e-8) > >> >> >>>>> model.calibrate(swaptions, optimization_method, end_criteria) > >> >> >>>>> > >> >> >>>>> But this will give me this error: > >> >> >>>>> > >> >> >>>>> RuntimeError: less functions (5) than available variables (12) > >> >> >>>>> > >> >> >>>>> Is the error caused by Gaussian1dSwaptionEngine? Should I > proceed with Gaussian1dNonstandardSwaptionEngine? What change should I do > to make it work ? > >> >> >>>>> > >> >> >>>>> > >> >> >>>>> Thanks, > >> >> >>>>> > >> >> >>>>> Mark > >> >> >>>>> > >> >> >>>>> _______________________________________________ > >> >> >>>>> QuantLib-users mailing list > >> >> >>>>> Qua...@li... > >> >> >>>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users > >> >> >>> > >> >> >>> _______________________________________________ > >> >> >>> QuantLib-users mailing list > >> >> >>> Qua...@li... > >> >> >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users > |