Re: shortSwapIndexBase in SwaptionVolCube2 (AUD as example)
Posted by
Ferdinando M. Ametrano on
URL: http://quantlib.414.s1.nabble.com/reference-of-boost-shared-ptr-instead-of-Handle-tp7623p7647.html
On Fri, Sep 18, 2009 at 5:38 AM, Yan Kuang <[hidden email]> 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.
I agree that EuriborSwap is already a SwapIndex factory based on tenor. It's flawed in 4 ways:
1) it doesn't have a discount curve2) it only has 1 forwarding curve instad of 2 (3M/6M)
3) it doesn't allow to create non-standard swap (eg 10Y fixed rate vs 3M euribor)4) it focuses on tenor
Unfortunately we have to keep it for backward compatibility (I for once don't care at all about backward compatibility, but I do understand the point). Anyway moving to
EuriborSwap(const Period& tenor, const Handle<YieldTermStructure>& fdw =
Handle<YieldTermStructure>(), const Handle<YieldTermStructure>& discount =
Handle<YieldTermStructure>());
fixes point (1) in a backward compatible way. Adding the new constructor
EuriborSwap(const Period& tenor, const boost::shared_ptr<Euribor>& euribor,
const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>());
would satisfy (3) and would allow to circumvent (2) in an incremental way.
Point (4) cannot be fixed as it was the key design choice, which was good enough until a couple years ago. In the past the relevant point of a 10Y fixed rate vs floating rate was the 10Y length, and you almost didn't care if it was 3M or 6M floating rate. Today this is not true anymore.
So I would add a new EuriborSwap factory (the only one I would use, deprecating/removing the old one). Let's call it EuriborSwap2 for sake of clarity
EuriborSwap2(const Handle<Euribor>& euribor6M, const Handle<Euribor>& euribor3M,
const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>());
EuriborSwap2(const Handle<YieldTermStructure>& fdw6M, const Handle<YieldTermStructure>& fdw3M,
const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>());
boost::shared_ptr<EuriborSwap2> create(const Period& tenor, const Handle<Euribor>& euribor =
Handle<Euribor>(), const Handle<YieldTermStructure>& discount =
Handle<YieldTermStructure>()) const;Finally, I'm not sure I would give up SwapIndex subtyping. I must confess I've never exploited SwapIndex subtyping for compile time checks but the code above shows how IborIndex subtyping is used, requesting Euribor indexes instead of generic Ibor indexes. One day we might need something similar for SwapIndex, anyway I don't have strong opinion on this.
Any code duplication between different currencies and fixing agencies could be avoided using template
ciao -- Nando--
RSS feed: http://www.google.com/reader/shared/ferdinando.ametrano
------------------------------------------------------------------------------
Come build with us! The BlackBerry® 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-12, 2009. Register now!
http://p.sf.net/sfu/devconf_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users