Posted by
FORNAROLA CHIARA on
URL: http://quantlib.414.s1.nabble.com/Coupons-and-Fixed-Rate-Legs-tp1151p1167.html
Hi John,
In order to correctly reproduce the schedule of: fixed rate bond,
floating rate bond, and cms rate bond, you have pass the following
parameters to the schedule:
datedDate_ i.e. the first interest accrual date of the bond;
maturityDate_, i.e. the maturity date of the bond;
Period(frequency_), i.e. 3m, 6m, 1y depending on the payment frequency
of the bonds (quarterly, semiannual, annual);
calendar_, i.e. the calendar quoted in the prospectus of the bond;
accrualConvention, i.e. the adjustment applied to accrual start and end
dates of the bond (usually for Euro denominated bonds is "unadjusted");
accrualConventionTermination, i.e. the adjustment applied to the
maturity date (usually "unadjusted" if not differently specified in the
prospectus);
fromEnd, i.e. TRUE if you want to build the schedule backward, FALSE if
you want to start building the schedule rolling from the first payment
date (uasually the schedule is generated BACKWARD unless you have odd
last or first coupon).
EOM, i.e. TRUE if you have a payment date which falls for example on the
28th of February and, lets say pays semiannually, you want that the next
nominal date is 31st August (i.e. the last day of the month) rather than
the 28th of August. Usually this parameter is equal to FALSE unless
differently specified in the bond's prospectus;
firstDate, i.e. the nominal date in which the first coupon date is
scheduled (unless you have odd cpn you don't need to pass this
parameter, but if you input this information you have to input a date
without business adjustment);
nextToLastDate, i.e. the nominal date in which the next to last coupon
date is schedule (unless you have odd cpn you don't need to pass this
parameter but if you input this information you have to input a date
without business adjustment).
So your correct schedule will be:
Schedule schedule(datedDate_, maturityDate_, Period(frequency_),
calendar_, accrualConvention,
accrualConvention,
fromEnd, EOM, firstDate, nextToLastDate);
In the example you mentioned, since the first accrual date of your bond
is 19 july 2007 and the maturity date is February 1, 2008 or February 1,
2009 (I don't know which is the actual date), there should be an odd
coupon (you should read all the prospectus to see if it occurs at the
beginning or at the end), so you have to use the proper schedule
generation (backward or forward) and input the correct next to last date
and/or first date.
Regarding zero coupon bond, you don't need to generate the schedule, you
can just use zerocouponbond class.
Hope this will help.
Chiara
>-----Original Message-----
>From:
[hidden email]
[mailto:quantlib-users-
>
[hidden email]] On Behalf Of John Maiden
>Sent: Thursday, July 19, 2007 9:37 PM
>To:
[hidden email]
>Subject: [Quantlib-users] Coupons and Fixed Rate Legs
>
>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-------------------------------------------------------------------------
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