Skip to content

Commit 393b121

Browse files
pcaspersjenkins
authored andcommitted
QPR-11773 support subperiod coupon in numeric lgm multileg option engine
1 parent ded0ca3 commit 393b121

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

QuantExt/qle/pricingengines/numericlgmmultilegoptionengine.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ using namespace QuantLib;
3434

3535
#define THROW_ERROR_CPN_NOT_SUPPORTED \
3636
QL_FAIL("NumericLgmMultiLegOptionEngineBase: coupon type not handled, supported coupon types: Fix, (capfloored) " \
37-
"Ibor, (capfloored) ON comp, (capfloored) ON avg, BMA/SIFMA")
37+
"Ibor, (capfloored) ON comp, (capfloored) ON avg, BMA/SIFMA, subperiod")
3838

3939
/* For a given cashflow and option exercise date, return the simulation date on which we determine the coupon amout.
4040
- If the pay date is <= today, null is returned.
@@ -65,6 +65,8 @@ Date getSimulationDates(const Date& today, const Date& latestOptionDate, const b
6565
return std::max(minDate, cfon->underlying()->fixingDates().front());
6666
} else if (auto cfav = boost::dynamic_pointer_cast<QuantExt::CappedFlooredAverageONIndexedCoupon>(cpn)) {
6767
return std::max(minDate, cfav->underlying()->fixingDates().front());
68+
} else if( auto sub = boost::dynamic_pointer_cast<QuantExt::SubPeriodsCoupon>(cpn)) {
69+
return std::max(minDate, sub->fixingDates().front());
6870
}
6971
THROW_ERROR_CPN_NOT_SUPPORTED;
7072
} else {
@@ -151,6 +153,10 @@ RandomVariable getUnderlyingCashflowPv(const LgmVectorised& lgm, const Real t, c
151153
cfav->nakedOption(), t, x) *
152154
RandomVariable(x.size(), cfav->accrualPeriod() * cfav->nominal()) *
153155
lgm.reducedDiscountBond(t, T, x, discountCurve);
156+
} else if (auto sub = boost::dynamic_pointer_cast<QuantExt::SubPeriodsCoupon1>(cpn)) {
157+
return lgm.subperiodsRate(sub->index(), sub->fixingDates(), t, x) *
158+
RandomVariable(x.size(), cfon->accrualPeriod() * cfon->nominal()) *
159+
lgm.reducedDiscountBond(t, T, x, discountCurve);
154160
}
155161
THROW_ERROR_CPN_NOT_SUPPORTED;
156162
} else {

0 commit comments

Comments
 (0)