26 QL_REQUIRE(
coupon_,
"SubPeriodsCoupon required");
28 index_ = QuantLib::ext::dynamic_pointer_cast<InterestRateIndex>(
coupon_->index());
29 QL_REQUIRE(
index_,
"InterestRateIndex required");
41 Size numPeriods = accrualFractions.size();
49 accumulatedRate = 0.0;
50 for (Size i = 0; i < numPeriods; ++i) {
51 accumulatedRate += (fixings[i] + incSpread) * accrualFractions[i];
55 accumulatedRate = 1.0;
56 for (Size i = 0; i < numPeriods; ++i) {
57 accumulatedRate *= (1.0 + (fixings[i] + incSpread) * accrualFractions[i]);
61 QL_FAIL(
"Invalid sub-period coupon type");
bool includeSpread() const
whether to include/exclude spread in compounding/averaging
const std::vector< Time > & accrualFractions() const
accrual periods for the sub-periods
const std::vector< Rate > & indexFixings() const
fixings for the sub-periods
Type type() const
whether sub-period fixings are averaged or compounded
Spread spread() const
Need to be able to change spread to solve for fair spread.
const SubPeriodsCoupon1 * coupon_
void initialize(const FloatingRateCoupon &coupon) override
QuantLib::ext::shared_ptr< InterestRateIndex > index_
SubPeriodsCoupon1::Type type_
Rate swapletRate() const override
Pricer for sub-period coupons.