Re: Coupons and Fixed Rate Legs

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


Hi,

So if this version works with the "1D" tenor, then there must be a bug in
converting from a frequency type to a period object.

I understand though, that you guys are advocating the use of Period objects
as the way to go thus one should not go through a Frequency type.

Can someone let us know if the "1D" period type actually works?

Toy out.

>From: "FORNAROLA CHIARA" <[hidden email]>
>To: "Stefan Johansson" <[hidden email]>
>CC: "Toyin Akin" <[hidden email]>,
><[hidden email]>,<[hidden email]>
>Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>Date: Fri, 20 Jul 2007 11:47:55 +0200
>
>Thanks Stefan for the example!
>Anyway the schedule object in quantlib can be created also with
>period=1d.
>Chiara
>
> >-----Original Message-----
> >From: Stefan Johansson [mailto:[hidden email]]
> >Sent: Friday, July 20, 2007 11:43 AM
> >To: FORNAROLA CHIARA
> >Cc: Toyin Akin; [hidden email];
>[hidden email]
> >Subject: Re: [Quantlib-users] Coupons and Fixed Rate Legs
> >
> >Hi,
> >
> >Synthetic discount bonds with daily coupons may very well be components
> >in "structured products", so support for it may be useful and may
> >broaden the field of applications for quantlib, if not yet included.
> >
> >BR,
> >Stefan
> >
> >FORNAROLA CHIARA wrote:
> >
> >>Hi Toyin
> >>
> >>I was answering to John's question....I didn't meant to say anything
> >>about your email..
> >>Anyway John in his email mentioned:
> >>" a 4.75 fixed rate bond that goes from
> >>
> >>
> >>>>today
> >>>>
> >>>>
> >>>>>(July 19, 2007) to February 1, 2008."
> >>>>>
> >>>>>
> >>(I'm just quoting his email)
> >>The schedule behaves as I described replying to John's email also for
> >>fixed rate, floating rate, cms rate leg not just for bonds.
> >>FirstDate and Next to last date are optional parameters, you need them
> >>only if the deal you have as an odd coupon.
> >>Now I'm sorry I can't think of a deal which has daily payments (I will
> >>appreciate an input from you since I believe you see different
>markets).
> >>I always dealt with Euro denominated bonds and Swaps so usually the
> >>period is 3m, 6m and 1y.
> >>
> >>Chiara
> >>
> >>
> >>
> >>
> >>>-----Original Message-----
> >>>From: Toyin Akin [mailto:[hidden email]]
> >>>Sent: Friday, July 20, 2007 10:52 AM
> >>>To: FORNAROLA CHIARA; [hidden email]; quantlib-
> >>>[hidden email]
> >>>Subject: Re: [Quantlib-users] Coupons and Fixed Rate Legs
> >>>
> >>>
> >>>Hi,
> >>>
> >>>I'm a bit confused.
> >>>
> >>>This does not answer the question of why a daily frequency builds an
> >>>
> >>>
> >>output
> >>
> >>
> >>>of non-daily periods.
> >>>
> >>>Are you saying the schedule constructor used before is incorrect for
> >>>
> >>>
> >>daily
> >>
> >>
> >>>frequencies and that the one you propose with the additional
>parameters
> >>>does?
> >>>
> >>>Also, John is construting a fixed leg leg object and not a Bond
>object.
> >>>With
> >>>fixed leg objects, you should be able to construct legs without the
> >>>additional stub dates. These should be considered optional.
> >>>
> >>>Best Regards,
> >>>Toyin Akin.
> >>>
> >>>
> >>>
> >>>>From: "FORNAROLA CHIARA" <[hidden email]>
> >>>>To: "John Maiden"
> >>>><[hidden email]>,<[hidden email]>
> >>>>Subject: Re: [Quantlib-users] Coupons and Fixed Rate Legs
> >>>>Date: Fri, 20 Jul 2007 10:06:13 +0200
> >>>>
> >>>>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
> >>>>
> >>>>
> >>>_________________________________________________________________
> >>>Tell MSN about your most memorable emails!
> >>>
> >>>
> >>http://www.emailbritain.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
> >>
> >>
> >>
> >>
> >
>

_________________________________________________________________
Watch all 9 Live Earth concerts live on MSN.  http://liveearth.uk.msn.com


-------------------------------------------------------------------------
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