Re: add .asOptionlet() to MakeCapFloor ?
Posted by
Chris Kenyon-2 on
URL: http://quantlib.414.s1.nabble.com/add-asOptionlet-to-MakeCapFloor-tp11828p11831.html
Hi Nando,
I like your second suggestion - simple and addresses an equivalent issue directly (getting the n-th caplet), avoids market convention issues, and avoids doing something awkward (forward starts). The output should still be a capfloor, but with just one cashflow. I can put a patch together or would you like to?
Regards,
Chris
----- Original Message ----
From: Ferdinando Ametrano <
[hidden email]>
To: Chris Kenyon <
[hidden email]>
Cc:
[hidden email]Sent: Friday, March 7, 2008 11:15:12 AM
Subject: Re: [Quantlib-dev] add .asOptionlet() to
MakeCapFloor ?
Hi Chris,not sure I get your point.
Couldn't you obtain the same result just using the standard constructor: MakeCapFloor(CapFloor::Type capFloorType,
const Period& capFloorTenor, const boost::shared_ptr<IborIndex>& iborIndex,
Rate strike = Null<Rate>(), const Period& forwardStart = 0*Days);
E.g. let's assume you want the last caplet in a 3Y cap on 6M ibor rate:
MakeCapFloor(Cap, 6*Months, my6mIborIndex, myStrike, 30*Months);
If this is not equivalent because of market conventions used in the 30M fwd start swap calculation, then I still have another point.
To obtain the sequence of distinct caplets contained in a standard cap, we could have something like CapFloor::optionlet(Size i) instead: this would allow to create just one single cap and to extract all caplets from it, avoiding multiple redundant cap creations
I look forward to your feedback
ciao -- NandoOn Fri, Mar 7, 2008 at 11:35 AM, Chris Kenyon <[hidden email]> wrote:
> > Hi,
> > this would make life easier. Effect: only the last cashflow is returned.
> The extra code could be something like:>
> In .hpp after line 66>
> //! Only get last coupon, i.e. get caplet version of cap > //! or floorlet version of floor, etc.
> MakeCapFloor& asOptionlet();>
> Also before closing };>
> bool asOptionlet_;>
> In .cpp after line 38 in constructor (and before {}):>
> asOptionlet_(false) >
> after new line 53>
> //! only leaves the last coupon> if (asOptionlet_ && leg.size()>1)
> leg.erase(leg.begin(), --leg.end());>
> Best regards,> Chris
> > > -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________> QuantLib-dev mailing list
> [hidden email]> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
> >
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev