From 4d249218250ab347e82ccc05da4d52f9553c12dd Mon Sep 17 00:00:00 2001 From: Alex Chow Date: Wed, 12 Jul 2023 11:33:35 +0100 Subject: [PATCH] Add support for SubPeriodsCoupon (IborIndex only) in AMC --- QuantExt/qle/pricingengines/mcmultilegbaseengine.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/QuantExt/qle/pricingengines/mcmultilegbaseengine.cpp b/QuantExt/qle/pricingengines/mcmultilegbaseengine.cpp index 6cdbd4120c..4f9fb850af 100644 --- a/QuantExt/qle/pricingengines/mcmultilegbaseengine.cpp +++ b/QuantExt/qle/pricingengines/mcmultilegbaseengine.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -646,6 +647,17 @@ void McMultiLegBaseEngine::calculate() const { bmaIndex->forwardingTermStructure()), bma->gearing(), bma->spread(), bma->referencePeriodStart(), bma->referencePeriodEnd(), bma->dayCounter(), false, Date()); + } else if (auto spc = boost::dynamic_pointer_cast(cpn)) { + auto iborIndex = boost::dynamic_pointer_cast(spc->index()); + QL_REQUIRE(iborIndex, "McMultiLegBaseEngine: SubPeriodsCoupon with non-ibor index is not supported."); + flr = boost::make_shared( + spc->date(), spc->nominal(), spc->accrualStartDate(), spc->accrualEndDate(), spc->fixingDays(), + boost::make_shared( + "proxy-ibor", (spc->accrualEndDate() - spc->accrualStartDate()) * Days, spc->fixingDays(), + iborIndex->currency(), iborIndex->fixingCalendar(), Following, false, spc->dayCounter(), + iborIndex->forwardingTermStructure()), + spc->gearing(), spc->spread(), spc->referencePeriodStart(), spc->referencePeriodEnd(), + spc->dayCounter(), false, Date()); } // in arrears?