Hi, I am looking for code that demonstrates the usage of market models. Is there anywhere in the test folder a piece of code that prices any kind of Instrument (i.e. an object the type of which derives from QuantLib::Instrument) based on a non-experimental, non-legacy Market Model? For example, searching for a pricing example of a QuantLib::Swaption, I have only found code that makes use of QuantLib::LfmSwaptionEngine, which unfortunately is part of the legacy folder. Thanks, Ioannis ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Ioannis,
no, there isn't. There are two Libor Market Model implementations and the "non-legacy" one under ql/models/marketmodels requires instruments to inherit from MarketModelMultiProduct. This interface is quite different from QuantLib::Instrument, for example it is obviously designed towards pricing in the specific model implementation. Otherwise there is lots of example code for this e.g. https://github.com/lballabio/QuantLib/blob/master/test-suite/marketmodel.cpp https://github.com/lballabio/QuantLib/blob/master/Examples/MarketModels/MarketModels.cpp#L113 Is there a reason why you want the usual QuantLib instrument interface (like e.g. you have an existing infrastructure with pluggable pricing engines)? Best Regards Peter On 29 December 2016 at 10:05, Yannis <[hidden email]> wrote: > Hi, > > I am looking for code that demonstrates the usage of market models. > > Is there anywhere in the test folder a piece of code that prices any kind of > Instrument (i.e. an object the type of which derives from > QuantLib::Instrument) based on a non-experimental, non-legacy Market Model? > > For example, searching for a pricing example of a QuantLib::Swaption, I have > only found code that makes use of QuantLib::LfmSwaptionEngine, which > unfortunately is part of the legacy folder. > > Thanks, > > Ioannis > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Thanks for responding back Peter! It's comforting to know I am not the only one working tonight... I have been sort of suspecting an answer along these lines, but I wanted to be sure that using the MarketModelMultiProduct was indeed the right way to go. Looking at the code I understand that in order to price a bermudan swaption I must first create the appropriate MarketModelMultiProduct object that represents that swaption and then do what the function "simulate" in marketmodel.cpp does, namely use a MarketModelEvolver to generate a SequenceStatisticsInc object. If I am looking for the swaption's npv, that will then be given by stats.mean(), where stats is the generated SequenceStatisticsInc object. Perfect! (If I understand it correctly). Do you know by chance if there is any mapping function that maps an existing QuantLib::Swaption object to the corresponding MarketModelMultiProduct object? Of' course I can write my own, but it wouldn't hurt if one was available already. I am asking, because I work already extensively with QuantLib::Swaption objects, which I would now like to price using the available market model apparatus. Best regards and thanks a lot once more and a happy new year, Ioannis Peter Caspers <[hidden email]> schrieb am 18:35 Samstag, 31.Dezember 2016: Hi Ioannis, no, there isn't. There are two Libor Market Model implementations and the "non-legacy" one under ql/models/marketmodels requires instruments to inherit from MarketModelMultiProduct. This interface is quite different from QuantLib::Instrument, for example it is obviously designed towards pricing in the specific model implementation. Otherwise there is lots of example code for this e.g. https://github.com/lballabio/QuantLib/blob/master/test-suite/marketmodel.cpp https://github.com/lballabio/QuantLib/blob/master/Examples/MarketModels/MarketModels.cpp#L113 Is there a reason why you want the usual QuantLib instrument interface (like e.g. you have an existing infrastructure with pluggable pricing engines)? Best Regards Peter On 29 December 2016 at 10:05, Yannis <[hidden email]> wrote: > Hi, > > I am looking for code that demonstrates the usage of market models. > > Is there anywhere in the test folder a piece of code that prices any kind of > Instrument (i.e. an object the type of which derives from > QuantLib::Instrument) based on a non-experimental, non-legacy Market Model? > > For example, searching for a pricing example of a QuantLib::Swaption, I have > only found code that makes use of QuantLib::LfmSwaptionEngine, which > unfortunately is part of the legacy folder. > > Thanks, > > Ioannis > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Happy new year. Here is a European swaption implementation which could
be a starting point for you https://github.com/lballabio/QuantLib/blob/master/ql/models/marketmodels/products/multistep/multistepswaption.hpp I don't think there is a mapping from QuantLib::Swaption implemented already. Maybe it would be nice to have a QuantLib::PricingEngine (more specifically an engine inheriting from Swaption::engine) that takes a MarketModel instance in its ctor and then (within the calculate() method) creates a temporary MarketModelMultiProduct from the QuantLib::Swaption arguments and wraps the whole LMM pricing as you described it above. Best Regards Peter On 31 December 2016 at 19:42, Yannis <[hidden email]> wrote: > Thanks for responding back Peter! It's comforting to know I am not the only > one working tonight... > > I have been sort of suspecting an answer along these lines, but I wanted to > be sure that using the MarketModelMultiProduct was indeed the right way to > go. > > Looking at the code I understand that in order to price a bermudan swaption > I must first create the appropriate MarketModelMultiProduct object that > represents that swaption and then do what the function "simulate" in > marketmodel.cpp does, namely use a MarketModelEvolver to generate a > SequenceStatisticsInc object. If I am looking for the swaption's npv, that > will then be given by stats.mean(), where stats is the generated > SequenceStatisticsInc object. > > Perfect! (If I understand it correctly). > > Do you know by chance if there is any mapping function that maps an existing > QuantLib::Swaption object to the corresponding MarketModelMultiProduct > object? > > Of' course I can write my own, but it wouldn't hurt if one was available > already. I am asking, because I work already extensively with > QuantLib::Swaption objects, which I would now like to price using the > available market model apparatus. > > Best regards and thanks a lot once more and a happy new year, > > Ioannis > > > > Peter Caspers <[hidden email]> schrieb am 18:35 Samstag, 31.Dezember > 2016: > > > Hi Ioannis, > > no, there isn't. There are two Libor Market Model implementations and > the "non-legacy" one under ql/models/marketmodels requires instruments > to inherit from MarketModelMultiProduct. This interface is quite > different from QuantLib::Instrument, for example it is obviously > designed towards pricing in the specific model implementation. > Otherwise there is lots of example code for this e.g. > > https://github.com/lballabio/QuantLib/blob/master/test-suite/marketmodel.cpp > https://github.com/lballabio/QuantLib/blob/master/Examples/MarketModels/MarketModels.cpp#L113 > > Is there a reason why you want the usual QuantLib instrument interface > (like e.g. you have an existing infrastructure with pluggable pricing > engines)? > > Best Regards > Peter > > On 29 December 2016 at 10:05, Yannis <[hidden email]> wrote: >> Hi, >> >> I am looking for code that demonstrates the usage of market models. >> >> Is there anywhere in the test folder a piece of code that prices any kind >> of >> Instrument (i.e. an object the type of which derives from >> QuantLib::Instrument) based on a non-experimental, non-legacy Market >> Model? >> >> For example, searching for a pricing example of a QuantLib::Swaption, I >> have >> only found code that makes use of QuantLib::LfmSwaptionEngine, which >> unfortunately is part of the legacy folder. >> >> Thanks, >> >> Ioannis > >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot >> _______________________________________________ >> QuantLib-users mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/quantlib-users > >> > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
This is exactly what I had in mind. The existing setup is an aberration from the usual Instrument-Engine design and I don't know why. But I am actually glad the hard work for the market model implementation has been done, even if one needs to adopt to the new interface. Regards Ioannis Peter Caspers <[hidden email]> schrieb am 14:17 Montag, 2.Januar 2017: Happy new year. Here is a European swaption implementation which could be a starting point for you https://github.com/lballabio/QuantLib/blob/master/ql/models/marketmodels/products/multistep/multistepswaption.hpp I don't think there is a mapping from QuantLib::Swaption implemented already. Maybe it would be nice to have a QuantLib::PricingEngine (more specifically an engine inheriting from Swaption::engine) that takes a MarketModel instance in its ctor and then (within the calculate() method) creates a temporary MarketModelMultiProduct from the QuantLib::Swaption arguments and wraps the whole LMM pricing as you described it above. Best Regards Peter On 31 December 2016 at 19:42, Yannis <[hidden email]> wrote: > Thanks for responding back Peter! It's comforting to know I am not the only > one working tonight... > > I have been sort of suspecting an answer along these lines, but I wanted to > be sure that using the MarketModelMultiProduct was indeed the right way to > go. > > Looking at the code I understand that in order to price a bermudan swaption > I must first create the appropriate MarketModelMultiProduct object that > represents that swaption and then do what the function "simulate" in > marketmodel.cpp does, namely use a MarketModelEvolver to generate a > SequenceStatisticsInc object. If I am looking for the swaption's npv, that > will then be given by stats.mean(), where stats is the generated > SequenceStatisticsInc object. > > Perfect! (If I understand it correctly). > > Do you know by chance if there is any mapping function that maps an existing > QuantLib::Swaption object to the corresponding MarketModelMultiProduct > object? > > Of' course I can write my own, but it wouldn't hurt if one was available > already. I am asking, because I work already extensively with > QuantLib::Swaption objects, which I would now like to price using the > available market model apparatus. > > Best regards and thanks a lot once more and a happy new year, > > Ioannis > > > > Peter Caspers <[hidden email]> schrieb am 18:35 Samstag, 31.Dezember > 2016: > > > Hi Ioannis, > > no, there isn't. There are two Libor Market Model implementations and > the "non-legacy" one under ql/models/marketmodels requires instruments > to inherit from MarketModelMultiProduct. This interface is quite > different from QuantLib::Instrument, for example it is obviously > designed towards pricing in the specific model implementation. > Otherwise there is lots of example code for this e.g. > > https://github.com/lballabio/QuantLib/blob/master/test-suite/marketmodel.cpp > https://github.com/lballabio/QuantLib/blob/master/Examples/MarketModels/MarketModels.cpp#L113 > > Is there a reason why you want the usual QuantLib instrument interface > (like e.g. you have an existing infrastructure with pluggable pricing > engines)? > > Best Regards > Peter > > On 29 December 2016 at 10:05, Yannis <[hidden email]> wrote: >> Hi, >> >> I am looking for code that demonstrates the usage of market models. >> >> Is there anywhere in the test folder a piece of code that prices any kind >> of >> Instrument (i.e. an object the type of which derives from >> QuantLib::Instrument) based on a non-experimental, non-legacy Market >> Model? >> >> For example, searching for a pricing example of a QuantLib::Swaption, I >> have >> only found code that makes use of QuantLib::LfmSwaptionEngine, which >> unfortunately is part of the legacy folder. >> >> Thanks, >> >> Ioannis > >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot >> _______________________________________________ >> QuantLib-users mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/quantlib-users > >> > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
I think it's mainly for speed optimisation and simplicity. For example
a single MultiProduct can represent several deals, and you can combine them further using the CompositeProduct. The result is a "super-deal" with the only purpose of feeding all the cashflows into a single market model simulation pass. Also, within the market model machinery you never see a DayCounter, Date and so on, all is (or has to be) precomputed to doubles. There are no lazy objects, no observers (as far as I know), and so on. This has advantages, but is also less universal: If you for example look into multisteptarn.cpp you can also see how the implementation depends on the model and its resolution method, this representation clearly wouldn't make sense for a Hull White PDE solver. Anyway good luck for your adapter implementation, let us know how it goes. Best Regards Peter On 2 January 2017 at 15:48, Yannis <[hidden email]> wrote: > This is exactly what I had in mind. The existing setup is an aberration from > the usual Instrument-Engine design and I don't know why. > > But I am actually glad the hard work for the market model implementation has > been done, even if one needs to adopt to the new interface. > > Regards > Ioannis > > > Peter Caspers <[hidden email]> schrieb am 14:17 Montag, 2.Januar > 2017: > > > Happy new year. Here is a European swaption implementation which could > be a starting point for you > > https://github.com/lballabio/QuantLib/blob/master/ql/models/marketmodels/products/multistep/multistepswaption.hpp > > I don't think there is a mapping from QuantLib::Swaption implemented > already. Maybe it would be nice to have a QuantLib::PricingEngine > (more specifically an engine inheriting from Swaption::engine) that > takes a MarketModel instance in its ctor and then (within the > calculate() method) creates a temporary MarketModelMultiProduct from > the QuantLib::Swaption arguments and wraps the whole LMM pricing as > you described it above. > > Best Regards > Peter > > > On 31 December 2016 at 19:42, Yannis <[hidden email]> wrote: >> Thanks for responding back Peter! It's comforting to know I am not the >> only >> one working tonight... >> >> I have been sort of suspecting an answer along these lines, but I wanted >> to >> be sure that using the MarketModelMultiProduct was indeed the right way to >> go. >> >> Looking at the code I understand that in order to price a bermudan >> swaption >> I must first create the appropriate MarketModelMultiProduct object that >> represents that swaption and then do what the function "simulate" in >> marketmodel.cpp does, namely use a MarketModelEvolver to generate a >> SequenceStatisticsInc object. If I am looking for the swaption's npv, that >> will then be given by stats.mean(), where stats is the generated >> SequenceStatisticsInc object. >> >> Perfect! (If I understand it correctly). >> >> Do you know by chance if there is any mapping function that maps an >> existing >> QuantLib::Swaption object to the corresponding MarketModelMultiProduct >> object? >> >> Of' course I can write my own, but it wouldn't hurt if one was available >> already. I am asking, because I work already extensively with >> QuantLib::Swaption objects, which I would now like to price using the >> available market model apparatus. >> >> Best regards and thanks a lot once more and a happy new year, >> >> Ioannis >> >> >> >> Peter Caspers <[hidden email]> schrieb am 18:35 Samstag, >> 31.Dezember >> 2016: >> >> >> Hi Ioannis, >> >> no, there isn't. There are two Libor Market Model implementations and >> the "non-legacy" one under ql/models/marketmodels requires instruments >> to inherit from MarketModelMultiProduct. This interface is quite >> different from QuantLib::Instrument, for example it is obviously >> designed towards pricing in the specific model implementation. >> Otherwise there is lots of example code for this e.g. >> >> >> https://github.com/lballabio/QuantLib/blob/master/test-suite/marketmodel.cpp >> >> https://github.com/lballabio/QuantLib/blob/master/Examples/MarketModels/MarketModels.cpp#L113 >> >> Is there a reason why you want the usual QuantLib instrument interface >> (like e.g. you have an existing infrastructure with pluggable pricing >> engines)? >> >> Best Regards >> Peter >> >> On 29 December 2016 at 10:05, Yannis <[hidden email]> wrote: >>> Hi, >>> >>> I am looking for code that demonstrates the usage of market models. >>> >>> Is there anywhere in the test folder a piece of code that prices any kind >>> of >>> Instrument (i.e. an object the type of which derives from >>> QuantLib::Instrument) based on a non-experimental, non-legacy Market >>> Model? >>> >>> For example, searching for a pricing example of a QuantLib::Swaption, I >>> have >>> only found code that makes use of QuantLib::LfmSwaptionEngine, which >>> unfortunately is part of the legacy folder. >>> >>> Thanks, >>> >>> Ioannis >> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Check out the vibrant tech community on one of the world's most >>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot >>> _______________________________________________ >>> QuantLib-users mailing list >>> [hidden email] >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> >>> >> >> > > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |