pricing stepped coupon bond

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

pricing stepped coupon bond

Khanh Nguyen
Hi,

I am trying to implement this function that prices step-coupon bond
using quantlib http://www.mathworks.com/access/helpdesk/help/toolbox/finfixed/stepcpnprice.html

Since there is no StepCouponBond in quantlib, my approach is to use
FloatingRateBond in which the IborIndex should replicate the term
structure implied by variable "ConvDates" ,  "CouponRates". The spread
= 0. Is this approach correct?

Thanks

-k

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond

Piter Dias-4
Khanh,

> I am trying to implement this function that prices step-coupon bond
> using quantlib
>
http://www.mathworks.com/access/helpdesk/help/toolbox/finfixed/stepcpnprice.html
Just for curiosity, do you have terms and conditions of a live bond? I saw
something like this in Brazil years ago, but since then local market moved
to more standard issues.

> Since there is no StepCouponBond in quantlib, my approach is to use
> FloatingRateBond in which the IborIndex should replicate the term
I didn't work with floating bonds on QuantLib yet, so I can't help in your
choice.

However, You may think about extending (at least a new constructor,
perhaps) FixedRateBond class and include a vector of conversion dates. The
vector of coupon rates is already there (I included for Brazilian bonds
modelling) but current implementation is based on coupon dates (the rates
can only change on coupon dates). The new vector of conversion dates could
be used to get the correct InterestRate objects for a given period. I am
not sure if it is easy but sounds feasible.

Regards,

-------------------------

Piter Dias
[hidden email]

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond

Luigi Ballabio
On Wed, 2010-01-20 at 07:21 -0200, Piter Dias wrote:

> > I am trying to implement this function that prices step-coupon bond
> > using quantlib
> >
> http://www.mathworks.com/access/helpdesk/help/toolbox/finfixed/stepcpnprice.html
>
> However, You may think about extending (at least a new constructor,
> perhaps) FixedRateBond class and include a vector of conversion dates. The
> vector of coupon rates is already there (I included for Brazilian bonds
> modelling) but current implementation is based on coupon dates (the rates
> can only change on coupon dates). The new vector of conversion dates could
> be used to get the correct InterestRate objects for a given period. I am
> not sure if it is easy but sounds feasible.

Khanh,
        The coupon does look fixed rather than floating. I'm not sure that I'd
add yet another constructor to FixedRateBond, though. You might create a
new coupon class and a corresponding bond.

Luigi


--

Weiler's Law:
Nothing is impossible for the man who doesn't have to
do it himself.



------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond -> endofmonth

Magnus Nystrom-3
When looking at the Mathworks link ... their EndMonthRule rule caught my
attention. They say "This rule applies only when Maturity is an end-of-month
date for a month having 30 or fewer days". Is this really correct? How is
this implemented in Quantlib? Thanks.

/Magnus

> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Wednesday, January 20, 2010 8:10
> To: Piter Dias
> Cc: [hidden email]; Khanh Nguyen
> Subject: Re: [Quantlib-users] pricing stepped coupon bond
>
> On Wed, 2010-01-20 at 07:21 -0200, Piter Dias wrote:
> > > I am trying to implement this function that prices step-coupon bond
> > > using quantlib
> > >
> >
> http://www.mathworks.com/access/helpdesk/help/toolbox/finfixed/stepcpnp
> rice.html
> >
> > However, You may think about extending (at least a new constructor,
> > perhaps) FixedRateBond class and include a vector of conversion
> dates. The
> > vector of coupon rates is already there (I included for Brazilian
> bonds
> > modelling) but current implementation is based on coupon dates (the
> rates
> > can only change on coupon dates). The new vector of conversion dates
> could
> > be used to get the correct InterestRate objects for a given period. I
> am
> > not sure if it is easy but sounds feasible.
>
> Khanh,
> The coupon does look fixed rather than floating. I'm not sure
> that I'd
> add yet another constructor to FixedRateBond, though. You might create
> a
> new coupon class and a corresponding bond.
>
> Luigi
>
>
> --
>
> Weiler's Law:
> Nothing is impossible for the man who doesn't have to
> do it himself.
>
>
>
> -----------------------------------------------------------------------
> -------
> Throughout its 18-year history, RSA Conference consistently attracts
> the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important issues
> through
> interactions with peers, luminaries and emerging and established
> companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond -> endofmonth

Luigi Ballabio
On Wed, 2010-01-20 at 10:33 -0300, MN wrote:
> When looking at the Mathworks link ... their EndMonthRule rule caught my
> attention. They say "This rule applies only when Maturity is an end-of-month
> date for a month having 30 or fewer days". Is this really correct? How is
> this implemented in Quantlib?

I think it's correct, in the sense that if the the maturity is the 31st
of the month, EndMonthRule=0 and EndMonthRule=1 are the same (0 = always
on the 31st, and if there's no such day or if it's a holiday, go on the
last actual day---which is the same as case 1.)

Instead, if the maturity is on, say, June 30th, you want to specify
whether it rolls on the 30th of each month or the end of each month, so
you look at the parameter (in the Mathworks link, "this rule applies"
means "we take into account the value of the parameter".)

You can see this as "the rule is only applied for 30-day months" (which
in a way is true, since for the others you roll on the 31st---which is
the same as the end) or as "the rule is always applied" (which in
another way is also true, since you roll on the end---which is the same
as the 31st.)  QuantLib takes the second view (i.e., there's no check
for month length.)

Luigi


--

To err is human -- to blame it on a computer is even more so.
-- unknown



------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond -> endofmonth

Magnus Nystrom-3
Thanks for the quick comment.

I agree that the roll dates will be the same if maturity is on the 31st regardless of the EndMonthRule-flag but it seems to me it is important to set EndMonthRule=1 (if it is such a security) even if the maturity is on the 31st. I am thinking of the 30360 daycount convention as used for US corporate bonds in relation to how the month of February is handled.

BTW, if the bond has an odd last coupon period I think it is not the maturity date that will determine if the endofmonth rule will be in effect.

/Magnus    

> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Wednesday, January 20, 2010 11:50
> To: MN
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] pricing stepped coupon bond -> endofmonth
>
> On Wed, 2010-01-20 at 10:33 -0300, MN wrote:
> > When looking at the Mathworks link ... their EndMonthRule rule caught
> my
> > attention. They say "This rule applies only when Maturity is an end-
> of-month
> > date for a month having 30 or fewer days". Is this really correct?
> How is
> > this implemented in Quantlib?
>
> I think it's correct, in the sense that if the the maturity is the 31st
> of the month, EndMonthRule=0 and EndMonthRule=1 are the same (0 =
> always
> on the 31st, and if there's no such day or if it's a holiday, go on the
> last actual day---which is the same as case 1.)
>
> Instead, if the maturity is on, say, June 30th, you want to specify
> whether it rolls on the 30th of each month or the end of each month, so
> you look at the parameter (in the Mathworks link, "this rule applies"
> means "we take into account the value of the parameter".)
>
> You can see this as "the rule is only applied for 30-day months" (which
> in a way is true, since for the others you roll on the 31st---which is
> the same as the end) or as "the rule is always applied" (which in
> another way is also true, since you roll on the end---which is the same
> as the 31st.)  QuantLib takes the second view (i.e., there's no check
> for month length.)
>
> Luigi
>
>
> --
>
> To err is human -- to blame it on a computer is even more so.
> -- unknown



------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond

Khanh Nguyen
In reply to this post by Piter Dias-4
> Just for curiosity, do you have terms and conditions of a live bond? I saw
> something like this in Brazil years ago, but since then local market moved
> to more standard issues.

No, I dont have any information of a live bond. I am working on an R
project to mirror that matlab's fixed income functions. That explains
my previous (and future) "obsession" with Matlab on this list :)...

>> Since there is no StepCouponBond in quantlib, my approach is to use
>> FloatingRateBond in which the IborIndex should replicate the term
> I didn't work with floating bonds on QuantLib yet, so I can't help in your
> choice.
>
> However, You may think about extending (at least a new constructor,
> perhaps) FixedRateBond class and include a vector of conversion dates. The
> vector of coupon rates is already there (I included for Brazilian bonds
> modelling) but current implementation is based on coupon dates (the rates
> can only change on coupon dates). The new vector of conversion dates could
> be used to get the correct InterestRate objects for a given period. I am
> not sure if it is easy but sounds feasible.

Thank you very much for the suggestion. My quantlib kung fu is weak
but I will give it a try.

My line of thinking was that since the coupon rates change on
conversion dates, the shape of the curve will look like a Heaviside
step function. Thus, a step coupon bond can be modelled as a
FloatingRate whose IborIndex have the shape of the heaviside step
function implied by the conversion dates and coupon rates and the
spread equals 0. What is wrong with this picture? My understanding of
these bonds are limited to Wikipedia, so feel free to flame my mental
retardation...

Cheers,

-k

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond -> endofmonth

Luigi Ballabio
In reply to this post by Magnus Nystrom-3
Hi Magnus,

On Wed, 2010-01-20 at 12:16 -0300, MN wrote:
> I agree that the roll dates will be the same if maturity is on the
> 31st regardless of the EndMonthRule-flag but it seems to me it is
> important to set EndMonthRule=1 (if it is such a security) even if the
> maturity is on the 31st. I am thinking of the 30360 daycount
> convention as used for US corporate bonds in relation to how the month
> of February is handled.

I'm not sure that I follow.  With a maturity on the 31st, a February
payment will be on the 28th, whether we specified end-of-month or not.
Then, it's a matter of whether the 30/360US day counter does the right
when passed the two dates. Maybe you can write a couple of test cases we
can use to check that?

> BTW, if the bond has an odd last coupon period I think it is not the
> maturity date that will determine if the endofmonth rule will be in
> effect.

Yes, and it would be nice if we checked this too in the test suite.
If you could write another test-case for this, that's be great.

Later,
        Luigi


--

Everything that can be invented has been invented.
-- Charles Duell, Director of U.S. Patent Office, 1899



------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond

Luigi Ballabio
In reply to this post by Khanh Nguyen
On Thu, 2010-01-21 at 14:01 -0500, Khanh Nguyen wrote:
> My line of thinking was that since the coupon rates change on
> conversion dates, the shape of the curve will look like a Heaviside
> step function. Thus, a step coupon bond can be modelled as a
> FloatingRate whose IborIndex have the shape of the heaviside step
> function implied by the conversion dates and coupon rates and the
> spread equals 0. What is wrong with this picture?

It might work---in the sense of returning the correct rates---but you're
applying the wrong concept.  The coupons are not floating; the rates are
varying from one coupon to the next, but they're predetermined.  Or am I
missing something?

Luigi


--

It is better to know some of the questions than all of the answers.
-- James Thurber



------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond

Nicolai Lassesen-2
> On Thu, 2010-01-21 at 14:01 -0500, Khanh Nguyen wrote:
> > My line of thinking was that since the coupon rates change on
> > conversion dates, the shape of the curve will look like a Heaviside
> > step function. Thus, a step coupon bond can be modelled as a
> > FloatingRate whose IborIndex have the shape of the heaviside step
> > function implied by the conversion dates and coupon rates and the
> > spread equals 0. What is wrong with this picture?
>
> It might work---in the sense of returning the correct rates---but you're
> applying the wrong concept.  The coupons are not floating; the rates are
> varying from one coupon to the next, but they're predetermined.  Or am I
> missing something?

If I remember it correctly you can have step features on coupons for both fixed
and floating rate bonds. This is in the sense that for a fixed coupon bond it
is just the coupon rate that changes, while for a floater it is the spread
above the index that might change.

Anybody, correct me if this is not so?

Br,
Nicolai


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: pricing stepped coupon bond -> endofmonth

Magnus Nystrom-3
In reply to this post by Luigi Ballabio
Hi again Luigi,

> Then, it's a matter of whether the 30/360US day counter does the right
> when passed the two dates

Yes, the roll dates is not the issue because they will be correct regardless
of the eom-flag when maturity is on the 31st. But, if don't misunderstand
the daycount convention for US corp bonds there are two initial date checks
which is only done when the security follows the EndOfMonth-rule.

1) If security is EOM and (start_date = last-day-of-February) and (end_date
= last-day-of-February), then change end_date to 30.
2) If security is EOM and (start_date = last-day-of-February), then change
start_date to 30.

Assume we have a "US30360"-bond with maturity on 31-aug and we calculate,
for example, the period between 28-feb and 31-mar. As I understand it this
period is 30 days if the security is EOM and 32 otherwise.

I guess one question here would be ... can a security have a maturity on the
31st and be considered NOT following the EOM-rule for daycount purposes
(i.e. daycount with the US corp bond version of 30360)?

Sorry, but regarding testcases ... although it has been my intention for a
long time to get up to speed on coding with Quantlib I have not yet found
the time.

/Magnus  



> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Friday, January 22, 2010 8:26
> To: MN
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] pricing stepped coupon bond -> endofmonth
>
> Hi Magnus,
>
> On Wed, 2010-01-20 at 12:16 -0300, MN wrote:
> > I agree that the roll dates will be the same if maturity is on the
> > 31st regardless of the EndMonthRule-flag but it seems to me it is
> > important to set EndMonthRule=1 (if it is such a security) even if
> the
> > maturity is on the 31st. I am thinking of the 30360 daycount
> > convention as used for US corporate bonds in relation to how the
> month
> > of February is handled.
>
> I'm not sure that I follow.  With a maturity on the 31st, a February
> payment will be on the 28th, whether we specified end-of-month or not.
> Then, it's a matter of whether the 30/360US day counter does the right
> when passed the two dates. Maybe you can write a couple of test cases
> we
> can use to check that?
>
> > BTW, if the bond has an odd last coupon period I think it is not the
> > maturity date that will determine if the endofmonth rule will be in
> > effect.
>
> Yes, and it would be nice if we checked this too in the test suite.
> If you could write another test-case for this, that's be great.
>
> Later,
> Luigi
>
>
> --
>
> Everything that can be invented has been invented.
> -- Charles Duell, Director of U.S. Patent Office, 1899
>
>
>
> -----------------------------------------------------------------------
> -------
> Throughout its 18-year history, RSA Conference consistently attracts
> the
> world's best and brightest in the field, creating opportunities for
> Conference
> attendees to learn about information security's most important issues
> through
> interactions with peers, luminaries and emerging and established
> companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users