Re: shortSwapIndexBase in SwaptionVolCube2 (AUD as example)

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/reference-of-boost-shared-ptr-instead-of-Handle-tp7623p7646.html

On Fri, 2009-09-18 at 13:38 +1000, Yan Kuang wrote:
> EuriborSwap is already a 'Factory', it create a 'SwapIndex' according
> to tenor.
> The tenor decide which one of two 'IborIndex' (and the associated
> forward curves) to use.

Oh, I see. You're talking about the QuantLibAddin class.  I thought we
were still talking about QuantLib proper.

Ok, that is a factory indeed.  And of course it could have any data
members it needs to instantiate the swap indexes.


> If you just want to create a SwapIndex with one Euribor and assocated
> forecast curve, why don't  
> you just use constructor of SwapIndex. So I am questioning why you
> need the following two constructor?
>
> EuriborSwap(const Period& tenor,
>             const Handle<YieldTermStructure>& fdw =
>                                     Handle<YieldTermStructure>(),
>             const Handle<YieldTermStructure>& discount =
>                                     Handle<YieldTermStructure>());

(Note: I'm talking about the core library here, since we might want to
modify some code there as well.  The addin could choose a different
design.  In the core library, the above should be a constructor for,
e.g., EurLiborSwapIsdaFixA.)
By having such constructors, you don't have to look up and insert the
correct market conventions (calendars, business-day conventions, day
counters etc.)
It's true that you might delegate this entirely to a factory. But when
you just need one index, it's simpler to build it directly (I see
EurLiborSwapIsdaFixA as subtypes, not as factories) than to build a
factory and ask it for the index. So all in all, I'd keep the subclasses
and add the factories.

Probably after 1.0, though.

Luigi


--

Within C++, there is a much smaller and cleaner language struggling to
get out.
-- Bjarne Stroustrup



------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users