Login  Register

Re: Why doesn't there exist a QuantLib Leg Hierachy?

Posted by Luigi Ballabio on Nov 26, 2012; 2:44pm
URL: http://quantlib.414.s1.nabble.com/Why-doesn-t-there-exist-a-QuantLib-Leg-Hierachy-tp9632p9635.html

Hi Sebastian,
    the problem is that we'd like to provide the means to build a
custom leg more or less manually, and that can play havoc with the
types as set in a hierarchy.  For instance, if one wants to create a
fixed-to-floater leg and writes:

Leg l = FloatingRateLeg(...);
l[0] = shared_ptr<CashFlow>(new FixedRateCoupon(...));

then you'd have something which is a floating-rate leg in type, but
not in reality.  Trying to prevent this would lead to restrict too
much (in my opinion, at least) the interface of Leg.  Actually, I
don't even think I would want to prevent the above code...

Luigi



On Sun, Nov 18, 2012 at 10:37 PM, Sebastian Poloczek
<[hidden email]> wrote:

>
> 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
> --
> View this message in context: http://old.nabble.com/Why-doesn%27t-there-exist-a-QuantLib-Leg-Hierachy--tp34689442p34694954.html
> Sent from the quantlib-dev mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev