QuantLib C++ library - FixedRateBond coupons
Asked Answered
C

2

5

With the QuantLib C++ library, I'm trying to evaluate bonds which have different coupons during their lifetime (for example 6% for the first three years, then 4% for the remaining three years).

I noticed that the constructor of the FixedRateBond class accepts a vector of coupons: const std::vector< Rate > &coupons:

FixedRateBond (Natural settlementDays,
Real faceAmount,
const Schedule &schedule,
const std::vector< Rate > &coupons,
const DayCounter &accrualDayCounter,
BusinessDayConvention paymentConvention=Following,
Real redemption=100.0,
const Date &issueDate=Date(),
const Calendar &paymentCalendar=Calendar())

That seems to be useful for my purpose, but how can I specify at which dates each coupon starts to apply?

Chatter answered 14/10, 2013 at 13:34 Comment(0)
S
6

Just count the coupons. If your bond pays annual coupons, you'll have three coupon in the first three years and three afterwards. In that case, pass (0.06, 0.06, 0.06, 0.04, 0.04, 0.04) as the vector of coupon rates. If the coupons are semiannual, there are six of them in three years; in that case, pass a vector containing 0.06 six times and 0.04 another six times. You get the idea: pass the rate for each coupon.

Spontaneity answered 14/10, 2013 at 16:21 Comment(0)
P
1

At a wild stab in the dark, the schedule sounds likely.
This takes a vector of dates. See the docs

Peroxidize answered 14/10, 2013 at 14:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.