Skip to content

Commit 88c3a2c

Browse files
Merge branch 'QPR-11772' into 'master'
QPR-11772 implement fixingDate() method for BMA Coupon Closes QPR-11772 See merge request qs/quantlib!56
2 parents 116cf70 + 4274655 commit 88c3a2c

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

ql/cashflows/averagebmacoupon.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ namespace QuantLib {
129129
new AverageBMACouponPricer));
130130
}
131131

132-
Date AverageBMACoupon::fixingDate() const {
133-
QL_FAIL("no single fixing date for average-BMA coupon");
134-
}
135-
136132
std::vector<Date> AverageBMACoupon::fixingDates() const {
137133
return fixingSchedule_.dates();
138134
}
139135

136+
Date AverageBMACoupon::fixingDate() const {
137+
QL_REQUIRE(fixingSchedule_.dates().size() >= 2,
138+
"AverageBMACoupon::fixingDate(): expected at least 2 dates in fixing schedule");
139+
return *std::next(fixingSchedule_.dates().end(), -2);
140+
}
141+
140142
Rate AverageBMACoupon::indexFixing() const {
141143
QL_FAIL("no single fixing for average-BMA coupon");
142144
}

ql/cashflows/averagebmacoupon.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace QuantLib {
5656

5757
//! \name FloatingRateCoupon interface
5858
//@{
59-
//! not applicable here; use fixingDates() instead
59+
//! the date when the coupon is fully determined
6060
Date fixingDate() const override;
6161
//! fixing dates of the rates to be averaged
6262
std::vector<Date> fixingDates() const;

0 commit comments

Comments
 (0)