Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional redemption argument for amortizing bond constructors #1790

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ql/instruments/bonds/amortizingcmsratebond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ namespace QuantLib {
const std::vector<Rate>& caps,
const std::vector<Rate>& floors,
bool inArrears,
const Date& issueDate)
const Date& issueDate,
const std::vector<Real>& redemptions)
: Bond(settlementDays, schedule.calendar(), issueDate) {

maturityDate_ = schedule.endDate();
Expand All @@ -54,7 +55,7 @@ namespace QuantLib {
.withFloors(floors)
.inArrears(inArrears);

addRedemptionsToCashflows();
addRedemptionsToCashflows(redemptions);

QL_ENSURE(!cashflows().empty(), "bond with no cashflows!");

Expand Down
5 changes: 3 additions & 2 deletions ql/instruments/bonds/amortizingcmsratebond.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ namespace QuantLib {
const std::vector<Rate>& caps = {},
const std::vector<Rate>& floors = {},
bool inArrears = false,
const Date& issueDate = Date());
const Date& issueDate = Date(),
const std::vector<Real>& redemptions = { 100.0 });
};

}

#endif
10 changes: 7 additions & 3 deletions ql/instruments/bonds/amortizingfixedratebond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ namespace QuantLib {
const Period& exCouponPeriod,
const Calendar& exCouponCalendar,
const BusinessDayConvention exCouponConvention,
bool exCouponEndOfMonth)
bool exCouponEndOfMonth,
const std::vector<Real>& redemptions,
Natural paymentLag)
: Bond(settlementDays, schedule.calendar(), issueDate),
frequency_(schedule.tenor().frequency()),
dayCounter_(accrualDayCounter) {
Expand All @@ -49,9 +51,10 @@ namespace QuantLib {
.withExCouponPeriod(exCouponPeriod,
exCouponCalendar,
exCouponConvention,
exCouponEndOfMonth);
exCouponEndOfMonth)
.withPaymentLag(paymentLag);

addRedemptionsToCashflows();
addRedemptionsToCashflows(redemptions);

QL_ENSURE(!cashflows().empty(), "bond with no cashflows!");
}
Expand Down Expand Up @@ -89,6 +92,7 @@ namespace QuantLib {
addRedemptionsToCashflows();
}


AmortizingFixedRateBond::AmortizingFixedRateBond(
Natural settlementDays,
const std::vector<Real>& notionals,
Expand Down
8 changes: 6 additions & 2 deletions ql/instruments/bonds/amortizingfixedratebond.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace QuantLib {
//! amortizing fixed-rate bond
class AmortizingFixedRateBond : public Bond {
public:
AmortizingFixedRateBond(Natural settlementDays,
AmortizingFixedRateBond(Natural settlementDays,
const std::vector<Real>& notionals,
const Schedule& schedule,
const std::vector<Rate>& coupons,
Expand All @@ -44,7 +44,10 @@ namespace QuantLib {
const Period& exCouponPeriod = Period(),
const Calendar& exCouponCalendar = Calendar(),
BusinessDayConvention exCouponConvention = Unadjusted,
bool exCouponEndOfMonth = false);
bool exCouponEndOfMonth = false,
const std::vector<Real>& redemptions = { 100.0 },
Natural PaymentLag = 0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are already a bunch of default parameters before these ones, so it doesn't matter much, but I think paymentLag is more likely to be passed than redemptions, isn't it? If so, I'd change the order.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, in what case is the payment lag needed? I've seen it mentioned in swaps but not in bonds so far.

Copy link
Contributor Author

@gyansinha gyansinha Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paymentLag in this situation is probably more appropriately referred to as Delay Days - in US MBS for example, borrowers payments for the accrual period in the prior calendar month are passed through to investors on the 25th of the month. It is this delay that paymentLag is supposed to capture. TBH I don't quite understand the role of the already existing argument in the amortizingFloatingBond constructor?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing days? Those would affect the index fixing; for instance, a coupon starting on Wednesday 20 would use as rate the Euribor fixing of Monday 18, 2 days before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a paymentLag arg in the amortizingFloatingRateBond constructor - that is what I was referring to.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added by this pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK - I got my signals crossed with the aborted attempts. So in both cases they act as delay days between the end of the accrual period and when the cashflow is actually received.



/*! \deprecated Use the other constructor after calling sinkingSchedule
and sinkingNotionals to generate the required parameters.
Expand Down Expand Up @@ -79,6 +82,7 @@ namespace QuantLib {
BusinessDayConvention exCouponConvention = Unadjusted,
bool exCouponEndOfMonth = false);


Frequency frequency() const { return frequency_; }
const DayCounter& dayCounter() const { return dayCounter_; }
protected:
Expand Down
11 changes: 7 additions & 4 deletions ql/instruments/bonds/amortizingfloatingratebond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@

namespace QuantLib {

AmortizingFloatingRateBond::AmortizingFloatingRateBond(

AmortizingFloatingRateBond::AmortizingFloatingRateBond(
Natural settlementDays,
const std::vector<Real>& notionals,
const Schedule& schedule,
const ext::shared_ptr<IborIndex>& index,
const DayCounter& paymentDayCounter,
BusinessDayConvention paymentConvention,
Natural fixingDays,
Natural fixingDays, Natural paymentLag,
const std::vector<Real>& gearings,
const std::vector<Spread>& spreads,
const std::vector<Rate>& caps,
Expand All @@ -42,7 +43,8 @@ namespace QuantLib {
const Period& exCouponPeriod,
const Calendar& exCouponCalendar,
const BusinessDayConvention exCouponConvention,
bool exCouponEndOfMonth)
bool exCouponEndOfMonth,
const std::vector<Real>& redemptions)
: Bond(settlementDays, schedule.calendar(), issueDate) {

maturityDate_ = schedule.endDate();
Expand All @@ -52,6 +54,7 @@ namespace QuantLib {
.withPaymentDayCounter(paymentDayCounter)
.withPaymentAdjustment(paymentConvention)
.withFixingDays(fixingDays)
.withPaymentLag(paymentLag)
.withGearings(gearings)
.withSpreads(spreads)
.withCaps(caps)
Expand All @@ -62,7 +65,7 @@ namespace QuantLib {
exCouponEndOfMonth)
.inArrears(inArrears);

addRedemptionsToCashflows();
addRedemptionsToCashflows(redemptions);

QL_ENSURE(!cashflows().empty(), "bond with no cashflows!");

Expand Down
9 changes: 6 additions & 3 deletions ql/instruments/bonds/amortizingfloatingratebond.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ namespace QuantLib {
//! amortizing floating-rate bond (possibly capped and/or floored)
class AmortizingFloatingRateBond : public Bond {
public:

AmortizingFloatingRateBond(Natural settlementDays,
const std::vector<Real>& notional,
const Schedule& schedule,
const ext::shared_ptr<IborIndex>& index,
const DayCounter& accrualDayCounter,
BusinessDayConvention paymentConvention = Following,
Natural fixingDays = Null<Natural>(),
Natural paymentLag = Null<Natural>(),
gyansinha marked this conversation as resolved.
Show resolved Hide resolved
const std::vector<Real>& gearings = { 1.0 },
const std::vector<Spread>& spreads = { 0.0 },
const std::vector<Rate>& caps = {},
Expand All @@ -50,9 +52,10 @@ namespace QuantLib {
const Period& exCouponPeriod = Period(),
const Calendar& exCouponCalendar = Calendar(),
BusinessDayConvention exCouponConvention = Unadjusted,
bool exCouponEndOfMonth = false);
};

bool exCouponEndOfMonth = false,
const std::vector<Real>& redemptions = { 100.0 });
};

}

#endif