Re: Coupons and Fixed Rate Legs

Posted by Toyin Akin on
URL: http://quantlib.414.s1.nabble.com/Coupons-and-Fixed-Rate-Legs-tp1151p1169.html


Hi,

It does look wierd indeed.

Assuming that you really want to create a Fixed Rate object with daily
coupons...

My guess is that the Period constructor does not convert from your daily
Frequency to a Period object correctly.

If you are able to construct a Period obect of a one day period without
going through the Frequency type then try that first.

If that doesn't work, then it looks like the Schedule class cannot compute
daily periods correctly.

Try extracting the dates array from the Schedule object. If this is correct
then it's the FixedRateLeg object.

Best Regards,
Toyin Akin,
CapeTools QuantTools
www.QuantTools.com

>From: John Maiden <[hidden email]>
>To: [hidden email]
>Subject: [Quantlib-users] Coupons and Fixed Rate Legs
>Date: Thu, 19 Jul 2007 19:36:57 +0000 (UTC)
>
>How exactly does the fixed rate leg work? I'm asking because I'd like to
>know
>how it determines a coupon date (and set up my own coupon dates). For
>example, I
>get a weird coupon schedule for a 4.75 fixed rate bond that goes from today
>(July 19, 2007) to February 1, 2008. Weird as in I don't understand the
>logic of
>how it was set up. Assuming that a zero coupon amount means a coupon
>payment,
>the code below gives me the following coupon dates:
>
>Aug 1, 2007
>Sept 1, 2007
>Nov 1, 2007
>Jan 1, 2008
>Feb 1, 2008
>Apr 1, 2008
>Jun 1, 2008
>Aug 1, 2008
>Sept 1, 2008
>Nov 1, 2008
>Jan 1, 2009
>Feb 1, 2009
>
>Here's the code:
>
>// TestQuantLib.cpp : Defines the entry point for the console application.
>//
>#include "stdafx.h"
>#include <ql/quantlib.hpp>
>#include <boost/timer.hpp>
>
>using namespace std;
>using namespace QuantLib;
>
>int _tmain(int argc, _TCHAR* argv[])
>{
> try{
>
> std::vector<Real> coupons(1, 0.0475);
> std::vector<Real> faceAmount_(1, 100);
>
> Calendar calendar = UnitedStates(UnitedStates::Market::NYSE);
> Date today = calendar.adjust(Date::todaysDate());
>
> BusinessDayConvention convention = Unadjusted;
>
> Frequency frequency = Daily;
>
> Date exerciseDate = Date(2, February, 2009);
>
> Schedule schedule_(today, exerciseDate, Period(frequency), calendar,
>convention, convention,
> true, false);
>
> DayCounter dayCount = Thirty360();
>
> Leg cashFlows_ = FixedRateLeg(faceAmount_, schedule_, coupons, dayCount,
> schedule_.businessDayConvention());
>
> for(int i = 0; i < cashFlows_.size(); i++){
> cout << cashFlows_[i]->amount() << endl;
> if(i % 10 == 0)
> system("PAUSE");
> }
>
> } catch (std::exception& e) {
> cout << e.what() << endl;
> }
>
> system("PAUSE");
> return 0;
>}
>
>Thanks in advance for any help.
>
>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Microsoft
>Defy all challenges. Microsoft(R) Visual Studio 2005.
>http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>_______________________________________________
>QuantLib-users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/quantlib-users

_________________________________________________________________
The next generation of Hotmail is here! http://www.newhotmail.co.uk


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users