Coupons and Fixed Rate Legs

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Coupons and Fixed Rate Legs

John Maiden
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

Toyin Akin

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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

FORNAROLA CHIARA
In reply to this post by John Maiden
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

Toyin Akin

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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

FORNAROLA CHIARA
In reply to this post by John Maiden
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

Stefan Johansson-2
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
>
>
>  
>



-------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

FORNAROLA CHIARA
In reply to this post by John Maiden
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
>>
>>
>>
>>
>


-------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

Toyin Akin
In reply to this post by FORNAROLA CHIARA

Hi,

Sorry I jumped the gun there.

You're right that he his description, he refers to a bond, but he prices via
a fixed leg object.
Thus I assumed he really wants to price a fix leg and I guess for you he
really wants to price a bond.

I was refering to the object he was using to create the leg object (a fixed
leg rather than a Bond object). However, the two should be equal for non
exotic bond legs.

I believe that the daily frequency is probably where the issues are...
concerning his code.

Toy out.

>From: "FORNAROLA CHIARA" <[hidden email]>
>To: "Toyin Akin" <[hidden email]>,
><[hidden email]>,<[hidden email]>
>Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>Date: Fri, 20 Jul 2007 11:07:51 +0200
>
>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/
>

_________________________________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

Toyin Akin
In reply to this post by FORNAROLA CHIARA

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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

FORNAROLA CHIARA
In reply to this post by John Maiden
Hi Toyin,

to be honest I've obtained the right schedule using QuantLibXL (to be
quick) and all the parameters passed by John...
The "1D" period works both if you pass it as it is or as period(daily).
So I can't replicate what you mentioned to be a "bug".
For me it isn't a bug since I can replicate the correct schedule...

Chiara

Ps may I ask what release are you using?

>-----Original Message-----
>From: Toyin Akin [mailto:[hidden email]]
>Sent: Friday, July 20, 2007 1:53 PM
>To: FORNAROLA CHIARA; [hidden email]
>Cc: [hidden email]; [hidden email]
>Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>
>
>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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

John Maiden
In reply to this post by FORNAROLA CHIARA
Thanks for all of your great responses! To clear up, the maturity date is
February 1, 2009 (sorry about that), and yes, I'm really looking at a bond.
Actually I'm looking at a convertible bond. The program I'm writing gives the
user an option to change the underlying schedule frequency (with the number of
time steps tied to the frequency). Thus the coupon gets tied to this schedule.
I'll try Chiara's suggestions and get back to you.


-------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

John Maiden
In reply to this post by John Maiden
Ok, I've come up with a temporary fix. Since I'm working with the convertible
bond class, the program adds the accrued at every coupon date. I want a daily
(or weekly, monthly, yearly, depending on user preferences) schedule with daily
(or etc) accrued coupons added, so that we know how to compute the convert price
at any time until maturity. What I've done is to set up a coupon schedule that
reflects the actual schedule (in this case, semiannual) using Chiara's comments.
Then I create a new schedule (daily, weekly, etc) that calculates the accrued
for each date. The only weird part of it is that I get a full semi-annual coupon
due the next to last date and the last date. I guess this is what Chiara meant
about the odd coupon.

Code is below for those that are interested:

// 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);

                Frequency frequency = Semiannual;
                BusinessDayConvention convention = Unadjusted;
               
                Calendar calendar = UnitedStates(UnitedStates::Market::NYSE);
                Date today(29, January, 1999);
                Date nexttoday = calendar.advance(today, Period(frequency), convention, true);

                Date exerciseDate = Date(1, February, 2009);
                Date beforelast = calendar.advance(exerciseDate, -Period(frequency),
convention, true);
               
                Schedule schedule_(today, exerciseDate, Period(frequency), calendar,
convention, convention,
                        true, true, nexttoday, beforelast);

                DayCounter dayCount = Thirty360();

                Leg cashFlows_ = FixedRateLeg(faceAmount_, schedule_, coupons, dayCount,
                        schedule_.businessDayConvention());

                cout << "Beginning Date: " << today << endl;
                cout << "First Coupon: " << nexttoday << endl;
                cout << "Next to Last Coupon: " << beforelast << endl;
                cout << "Stop Date: " << exerciseDate << endl;
                cout << endl;

                for(int i = 0; i < cashFlows_.size(); i++){
                                cout << cashFlows_[i]->date() << "\t" << cashFlows_[i]->amount() << endl;
                }

                                system("PAUSE");

                Size i = 0;
                for(Date d = today; d <= exerciseDate; d += 1){
                        boost::shared_ptr<FixedRateCoupon> testflow =
                                boost::dynamic_pointer_cast<FixedRateCoupon>(cashFlows_[i]);
                        cout << d << "\t" << testflow->accruedAmount(d) << endl;
                        if((d == cashFlows_[i]->date()) && (d <
cashFlows_[cashFlows_.size()-1]->date())){
                                i++;
                        }
                }
       
        } catch (std::exception& e) {
                cout << e.what() << endl;
        }

        system("PAUSE");
        return 0;
}


-------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

Toyin Akin
In reply to this post by FORNAROLA CHIARA

Hi,

I was refering to John's original code (email).

There is a frequency of daily, but yet the schedule (from the Fixed leg)
produced is not... hence the bug.

Unless of course John only provided only a snapshot of the generated
schedule, but they are certainly not daily. Whether the bug is in the
schedule or the FixedLeg object is the issue I was raising.

There could also be the possibility that the schedule that John provided
didn't really come from the code snippet he posted.

If you are saying that when you run his code you get daily periods, then all
is well, but that is not what John originally reported...

I noticed in the latest code of his, he has changed the frequency to
semi-annual.

John, did the schedule you posted actually come from the code snippet posted
too? This is important because there are cases where one would like to price
averging legs (OIS swaps for example) where pricing via a Bond is not the
way to go.

Toy out.

>From: "FORNAROLA CHIARA" <[hidden email]>
>To: "Toyin Akin" <[hidden email]>, <[hidden email]>
>CC: <[hidden email]>, <[hidden email]>
>Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>Date: Fri, 20 Jul 2007 14:30:09 +0200
>
>Hi Toyin,
>
>to be honest I've obtained the right schedule using QuantLibXL (to be
>quick) and all the parameters passed by John...
>The "1D" period works both if you pass it as it is or as period(daily).
>So I can't replicate what you mentioned to be a "bug".
>For me it isn't a bug since I can replicate the correct schedule...
>
>Chiara
>
>Ps may I ask what release are you using?
>
> >-----Original Message-----
> >From: Toyin Akin [mailto:[hidden email]]
> >Sent: Friday, July 20, 2007 1:53 PM
> >To: FORNAROLA CHIARA; [hidden email]
> >Cc: [hidden email]; [hidden email]
> >Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
> >
> >
> >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
>

_________________________________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

FORNAROLA CHIARA
In reply to this post by John Maiden
>Hi Toyin,
>
>to be honest I've obtained the right schedule using QuantLibXL (to be
>quick) and all the parameters passed by John...
>The "1D" period works both if you pass it as it is or as period(daily).

>-----Original Message-----
>From: Toyin Akin [mailto:[hidden email]]
>Sent: Friday, July 20, 2007 4:35 PM
>To: FORNAROLA CHIARA; [hidden email]
>Cc: [hidden email]; [hidden email]
>Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>
>
>Hi,
>
>I was refering to John's original code (email).
>
>There is a frequency of daily, but yet the schedule (from the Fixed
leg)
>produced is not... hence the bug.
>
>Unless of course John only provided only a snapshot of the generated
>schedule, but they are certainly not daily. Whether the bug is in the
>schedule or the FixedLeg object is the issue I was raising.
>
>There could also be the possibility that the schedule that John
provided
>didn't really come from the code snippet he posted.
>
>If you are saying that when you run his code you get daily periods,
then

>all
>is well, but that is not what John originally reported...
>
>I noticed in the latest code of his, he has changed the frequency to
>semi-annual.
>
>John, did the schedule you posted actually come from the code snippet
>posted
>too? This is important because there are cases where one would like to
>price
>averging legs (OIS swaps for example) where pricing via a Bond is not
the

>way to go.
>
>Toy out.
>
>>From: "FORNAROLA CHIARA" <[hidden email]>
>>To: "Toyin Akin" <[hidden email]>, <[hidden email]>
>>CC: <[hidden email]>, <[hidden email]>
>>Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>>Date: Fri, 20 Jul 2007 14:30:09 +0200
>>
>>Hi Toyin,
>>
>>to be honest I've obtained the right schedule using QuantLibXL (to be
>>quick) and all the parameters passed by John...
>>The "1D" period works both if you pass it as it is or as
period(daily).

>>So I can't replicate what you mentioned to be a "bug".
>>For me it isn't a bug since I can replicate the correct schedule...
>>
>>Chiara
>>
>>Ps may I ask what release are you using?
>>
>> >-----Original Message-----
>> >From: Toyin Akin [mailto:[hidden email]]
>> >Sent: Friday, July 20, 2007 1:53 PM
>> >To: FORNAROLA CHIARA; [hidden email]
>> >Cc: [hidden email]; [hidden email]
>> >Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>> >
>> >
>> >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
>>
>
>_________________________________________________________________
>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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

Toyin Akin
Hi,

So we are concluding that the schedule sent by John with the daily frequency
in his code was indeed incorrect.

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

Toy out...


>From: "FORNAROLA CHIARA" <[hidden email]>
>To: "Toyin Akin" <[hidden email]>, <[hidden email]>
>CC: [hidden email], [hidden email]
>Subject: Re: [Quantlib-users] Coupons and Fixed Rate Legs
>Date: Fri, 20 Jul 2007 16:46:24 +0200
>
> >Hi Toyin,
> >
> >to be honest I've obtained the right schedule using QuantLibXL (to be
> >quick) and all the parameters passed by John...
> >The "1D" period works both if you pass it as it is or as period(daily).
>
> >-----Original Message-----
> >From: Toyin Akin [mailto:[hidden email]]
> >Sent: Friday, July 20, 2007 4:35 PM
> >To: FORNAROLA CHIARA; [hidden email]
> >Cc: [hidden email]; [hidden email]
> >Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
> >
> >
> >Hi,
> >
> >I was refering to John's original code (email).
> >
> >There is a frequency of daily, but yet the schedule (from the Fixed
>leg)
> >produced is not... hence the bug.
> >
> >Unless of course John only provided only a snapshot of the generated
> >schedule, but they are certainly not daily. Whether the bug is in the
> >schedule or the FixedLeg object is the issue I was raising.
> >
> >There could also be the possibility that the schedule that John
>provided
> >didn't really come from the code snippet he posted.
> >
> >If you are saying that when you run his code you get daily periods,
>then
> >all
> >is well, but that is not what John originally reported...
> >
> >I noticed in the latest code of his, he has changed the frequency to
> >semi-annual.
> >
> >John, did the schedule you posted actually come from the code snippet
> >posted
> >too? This is important because there are cases where one would like to
> >price
> >averging legs (OIS swaps for example) where pricing via a Bond is not
>the
> >way to go.
> >
> >Toy out.
> >
> >>From: "FORNAROLA CHIARA" <[hidden email]>
> >>To: "Toyin Akin" <[hidden email]>, <[hidden email]>
> >>CC: <[hidden email]>, <[hidden email]>
> >>Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
> >>Date: Fri, 20 Jul 2007 14:30:09 +0200
> >>
> >>Hi Toyin,
> >>
> >>to be honest I've obtained the right schedule using QuantLibXL (to be
> >>quick) and all the parameters passed by John...
> >>The "1D" period works both if you pass it as it is or as
>period(daily).
> >>So I can't replicate what you mentioned to be a "bug".
> >>For me it isn't a bug since I can replicate the correct schedule...
> >>
> >>Chiara
> >>
> >>Ps may I ask what release are you using?
> >>
> >> >-----Original Message-----
> >> >From: Toyin Akin [mailto:[hidden email]]
> >> >Sent: Friday, July 20, 2007 1:53 PM
> >> >To: FORNAROLA CHIARA; [hidden email]
> >> >Cc: [hidden email]; [hidden email]
> >> >Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
> >> >
> >> >
> >> >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
> >>
> >
> >_________________________________________________________________
> >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

_________________________________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

FORNAROLA CHIARA
In reply to this post by John Maiden
Sorry, I believe I don't have enough skills in writing English so to
make myself be understood.


>-----Original Message-----
>From: Toyin Akin [mailto:[hidden email]]
>Sent: Friday, July 20, 2007 4:56 PM
>To: FORNAROLA CHIARA; [hidden email]
>Cc: [hidden email]; [hidden email]
>Subject: Re: [Quantlib-users] Coupons and Fixed Rate Legs
>
>Hi,
>
>So we are concluding that the schedule sent by John with the daily
>frequency
>in his code was indeed incorrect.
>
>> >> >> >>>>>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
>
>Toy out...
>
>
>>From: "FORNAROLA CHIARA" <[hidden email]>
>>To: "Toyin Akin" <[hidden email]>, <[hidden email]>
>>CC: [hidden email], [hidden email]
>>Subject: Re: [Quantlib-users] Coupons and Fixed Rate Legs
>>Date: Fri, 20 Jul 2007 16:46:24 +0200
>>
>> >Hi Toyin,
>> >
>> >to be honest I've obtained the right schedule using QuantLibXL (to
be
>> >quick) and all the parameters passed by John...
>> >The "1D" period works both if you pass it as it is or as
period(daily).

>>
>> >-----Original Message-----
>> >From: Toyin Akin [mailto:[hidden email]]
>> >Sent: Friday, July 20, 2007 4:35 PM
>> >To: FORNAROLA CHIARA; [hidden email]
>> >Cc: [hidden email]; [hidden email]
>> >Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>> >
>> >
>> >Hi,
>> >
>> >I was refering to John's original code (email).
>> >
>> >There is a frequency of daily, but yet the schedule (from the Fixed
>>leg)
>> >produced is not... hence the bug.
>> >
>> >Unless of course John only provided only a snapshot of the generated
>> >schedule, but they are certainly not daily. Whether the bug is in
the

>> >schedule or the FixedLeg object is the issue I was raising.
>> >
>> >There could also be the possibility that the schedule that John
>>provided
>> >didn't really come from the code snippet he posted.
>> >
>> >If you are saying that when you run his code you get daily periods,
>>then
>> >all
>> >is well, but that is not what John originally reported...
>> >
>> >I noticed in the latest code of his, he has changed the frequency to
>> >semi-annual.
>> >
>> >John, did the schedule you posted actually come from the code
snippet
>> >posted
>> >too? This is important because there are cases where one would like
to
>> >price
>> >averging legs (OIS swaps for example) where pricing via a Bond is
not

>>the
>> >way to go.
>> >
>> >Toy out.
>> >
>> >>From: "FORNAROLA CHIARA" <[hidden email]>
>> >>To: "Toyin Akin" <[hidden email]>, <[hidden email]>
>> >>CC: <[hidden email]>, <[hidden email]>
>> >>Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>> >>Date: Fri, 20 Jul 2007 14:30:09 +0200
>> >>
>> >>Hi Toyin,
>> >>
>> >>to be honest I've obtained the right schedule using QuantLibXL (to
be

>> >>quick) and all the parameters passed by John...
>> >>The "1D" period works both if you pass it as it is or as
>>period(daily).
>> >>So I can't replicate what you mentioned to be a "bug".
>> >>For me it isn't a bug since I can replicate the correct schedule...
>> >>
>> >>Chiara
>> >>
>> >>Ps may I ask what release are you using?
>> >>
>> >> >-----Original Message-----
>> >> >From: Toyin Akin [mailto:[hidden email]]
>> >> >Sent: Friday, July 20, 2007 1:53 PM
>> >> >To: FORNAROLA CHIARA; [hidden email]
>> >> >Cc: [hidden email]; [hidden email]
>> >> >Subject: RE: [Quantlib-users] Coupons and Fixed Rate Legs
>> >> >
>> >> >
>> >> >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
>> >>
>> >
>> >_________________________________________________________________
>> >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
>
>_________________________________________________________________
>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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

John Maiden
In reply to this post by Toyin Akin
     To summarize the initial problem, I started with a convertible bond where
the coupon schedule was set as the same schedule as the bond (schedule
determines calls/puts, dividends). I isolated the Leg because I wanted to play
with the coupon schedule.

     If I decided to evaluate the bond on a daily schedule, then the coupon
schedule was screwy. If you compile the original code, then what I took to be
the pattern of payments (basically a coupon payment of zero between two dates)
seemed random. I realize now that part of it was due to the 30/360 bond day
counter. The day counter divides each coupon payment into 30 day max periods,
and does not pay a coupon on the 31st day (naturally). So I was confusing
possible coupon payments with the 30/360 day count.  But the 30/360 does not
explain the pattern, otherwise I'd see a zero coupon payment roughly every 30
days. To be honest, I have no idea where that pattern came from.

     My solution is to create a coupon schedule (using the FixedRateLeg) using
the actual payment schedule (typically Semiannual). In the last code snippet I
sent it, what I did was then find out the accrued coupon payment by simulating a
new daily schedule (to match a user inputted schedule) and matching the new
schedule to the dates in the FixedRateLeg (using a dynamic_pointer_cast to get
the FixedRateCoupon in the FixedRateLeg). This allowed me to create a new coupon
schedule of accrued coupon payments that matches the original schedule.

     And yes, all the code you see is the code I used.


-------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

Toyin Akin

Hi John,

>      If I decided to evaluate the bond on a daily schedule, then the
>coupon
>schedule was screwy. If you compile the original code, then what I took to
>be
>the pattern of payments (basically a coupon payment of zero between two
>dates)
>seemed random. I realize now that part of it was due to the 30/360 bond day
>counter. The day counter divides each coupon payment into 30 day max
>periods,
>and does not pay a coupon on the 31st day (naturally). So I was confusing
>possible coupon payments with the 30/360 day count.  But the 30/360 does
>not
>explain the pattern, otherwise I'd see a zero coupon payment roughly every
>30
>days. To be honest, I have no idea where that pattern came from.

Thanks John that's all I wanted to know.

I might play with this a little because I'm coming from a non Bond point of
view. Its a bit worrying about the 30/360 day counter because I was under
the impression that day counters *ONLY* compute the year fraction between
coupon periods and does not have an effect on the actual schedule dates
(this should be determined by the Schedule object and in your example this
is daily).

Long week, I'm probably missing something...

Toy out.

>From: John Maiden <[hidden email]>
>To: [hidden email]
>Subject: Re: [Quantlib-users] Coupons and Fixed Rate Legs
>Date: Fri, 20 Jul 2007 15:17:55 +0000 (UTC)
>
>      To summarize the initial problem, I started with a convertible bond
>where
>the coupon schedule was set as the same schedule as the bond (schedule
>determines calls/puts, dividends). I isolated the Leg because I wanted to
>play
>with the coupon schedule.
>
>      If I decided to evaluate the bond on a daily schedule, then the
>coupon
>schedule was screwy. If you compile the original code, then what I took to
>be
>the pattern of payments (basically a coupon payment of zero between two
>dates)
>seemed random. I realize now that part of it was due to the 30/360 bond day
>counter. The day counter divides each coupon payment into 30 day max
>periods,
>and does not pay a coupon on the 31st day (naturally). So I was confusing
>possible coupon payments with the 30/360 day count.  But the 30/360 does
>not
>explain the pattern, otherwise I'd see a zero coupon payment roughly every
>30
>days. To be honest, I have no idea where that pattern came from.
>
>      My solution is to create a coupon schedule (using the FixedRateLeg)
>using
>the actual payment schedule (typically Semiannual). In the last code
>snippet I
>sent it, what I did was then find out the accrued coupon payment by
>simulating a
>new daily schedule (to match a user inputted schedule) and matching the new
>schedule to the dates in the FixedRateLeg (using a dynamic_pointer_cast to
>get
>the FixedRateCoupon in the FixedRateLeg). This allowed me to create a new
>coupon
>schedule of accrued coupon payments that matches the original schedule.
>
>      And yes, all the code you see is the code I used.
>
>
>-------------------------------------------------------------------------
>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 Hotmail about an email that changed your life!  
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
Reply | Threaded
Open this post in threaded view
|

Re: Coupons and Fixed Rate Legs

John Maiden
In reply to this post by FORNAROLA CHIARA
Ok, I feel like an idiot. I finally figured out the screwy schedule. Part of it
wasn't due to the 30/360 day count, all of it was due to the 30/360 day count.
Each of the "coupon dates" (i.e. the dates that have a zero coupon payment) are
near 31 day months, and 30 or less day months are skipped.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users