|
From: Luigi B. <lui...@gm...> - 2024-01-30 12:32:15
|
It might not be so bad. The generation of the paths is driven from Python but performed by the GaussianPathGenerator class in C++. I'd give it a try. Luigi On Tue, Jan 30, 2024 at 1:28 PM Philippe Hatstadt < phi...@ex...> wrote: > Thank you. I looked at it and it’s great. His post-calibration simulation > on HW is done in Python though so performance will be an issue. Thence my > asking if there were routines existing in C++. > > Thank you. > > Regards > > Philippe Hatstadt > +1-203-252-0408 > > > On Jan 30, 2024, at 7:24 AM, Luigi Ballabio <lui...@gm...> > wrote: > > > Hi, not much is already existing, I'm afraid. You can have a look at > Goutham's post at > https://gouthamanbalaraman.com/blog/hull-white-simulation-quantlib-python.html > (also in the cookbook if you have it) for a few ideas; he generates > interest-rate paths based on a Hull/White model, but something similar > should work for G2 as well. > > Hope this helps, > Luigi > > > On Wed, Jan 24, 2024 at 8:03 PM Philippe Hatstadt < > phi...@ex...> wrote: > >> I was able to calibrate a G2++ model to normal UST swaption volatilities >> (heroically using SOFR swaptions and re-scaling by rates ratio to generate >> so-called Treasury Swaption vol surface). >> Code is below: >> >> model = G2(term_structure); >> # engine = TreeSwaptionEngine(model, 25) >> # engine = ql.G2SwaptionEngine(model, 10, 400) >> engine = ql.FdG2SwaptionEngine(model) >> swaptions = create_swaption_helpers_normal(data, index, term_structure, >> engine) >> optimization_method = LevenbergMarquardt(1.0e-8,1.0e-8,1.0e-8) >> end_criteria = EndCriteria(1000, 100, 1e-6, 1e-8, 1e-8) >> model.calibrate(swaptions, optimization_method, end_criteria) >> a, sigma, b, eta, rho = model.params()\ >> >> The question now is as follows: I want to use this model towards a GNMA >> OAS model for which I would need monte-carlo paths of 2y/5y/10y forward CMT >> rates spaced say monthly. >> >> I assume that I would first need to use the 5 G2++ parameters calibrated >> above and then generate paths of the short rate, then somehow compute >> forward CMT at each forward monthly epoch Ti by computing the break-even >> coupon C10(Ti) such that PV(Ti, bond(cpn=C10(Ti)) == 100? >> Are there existing QL classes or modules that do all that from a given >> calibrated model like above? >> By the same token, I would also need stochastic pathwise discount factor >> vectors DF(Ti, path j), i=0 to 30y monthly. Is there also a QL module that >> generates those? I can obviously do it manually, but I am on the python >> side, so I want to re-use as much of existing libraries as I can to use >> efficient C++ code indirectly via SWIG. >> >> Regards >> >> Philippe Hatstadt >> >> 1370 Broadway, Suite 1450 | New York, NY | 10018 >> >> [image: https://www.exosfinancial.com/] <https://www.exosfinancial.com/> [image: >> https://www.linkedin.com/company/meetexos/about/] >> <https://www.linkedin.com/company/meetexos/about/> >> >> Broker-Dealer services offered through Exos Securities LLC, Member SIPC, >> FINRA. For important disclosures including Form CRS and Regulation BI click >> here <https://www.exosfinancial.com/general-disclosures>. >> >> >> Confidentiality Notice: The information contained in this email >> (including attachments) is only for the personal and confidential use of >> the sender and recipient named above. If the reader is not the intended >> recipient, you are notified that you have received this message in error >> and that any review, dissemination, copying or distribution is prohibited. >> If you have received this communication in error, please notify the sender >> immediately by e-mail and delete or destroy the original message and all >> copies. >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > > 1370 Broadway, Suite 1450 | New York, NY | 10018 > > [image: https://www.exosfinancial.com/] <https://www.exosfinancial.com/> [image: > https://www.linkedin.com/company/meetexos/about/] > <https://www.linkedin.com/company/meetexos/about/> > > Broker-Dealer services offered through Exos Securities LLC, Member SIPC, > FINRA. For important disclosures including Form CRS and Regulation BI click > here <https://www.exosfinancial.com/general-disclosures>. > > > Confidentiality Notice: The information contained in this email > (including attachments) is only for the personal and confidential use of > the sender and recipient named above. If the reader is not the intended > recipient, you are notified that you have received this message in error > and that any review, dissemination, copying or distribution is prohibited. > If you have received this communication in error, please notify the sender > immediately by e-mail and delete or destroy the original message and all > copies. > |