Re: Why doesn't there exist a QuantLib Leg Hierachy?
Posted by Sebastian Poloczek on Nov 18, 2012; 9:37pm
URL: http://quantlib.414.s1.nabble.com/Why-doesn-t-there-exist-a-QuantLib-Leg-Hierachy-tp9632p9634.html
Hi Jan,
you are right that deriving from a STL container may be a bad idea. This problem can be circumvented by redefining the Leg (Class) via composition.
What I'm trying to do is (somehow) making a snapshot of a QuantLib environment, e.g. a swap, including legs, pricing engines, market data objects,... . This snapshot should contain enough information to reopen it in an Excel session. In the current QL Leg design the leg type informations are lost after passing (casting) it into a swap instrument.
For example if you want to "export" a simple QL swap including an iborLeg and a FixedRateLeg into Excel a nice result would be a call to three QLXL functions (either just in single cells or including some fancy parameter boxes): qlswap, qlIborLeg, qlFixedRateLeg. But because the swap has lost the information of the underlying leg types this is difficult to achieve.
I imagine that leg type information could also be helpful in other algorithmic tasks.
Regards,
Sebastian