@@ -382,33 +382,27 @@ CPILeg::operator Leg() const {
382382 BusinessDayConvention bdc = schedule_.businessDayConvention ();
383383 refEnd = schedule_.calendar ().adjust (start + schedule_.tenor (), bdc);
384384 }
385- if (detail::get (fixedRates_, i, 1.0 ) == 0.0 ) { // fixed coupon
386- leg.push_back (ext::shared_ptr<CashFlow>(
387- new FixedRateCoupon (paymentDate, detail::get (notionals_, i, 0.0 ),
388- detail::effectiveFixedRate (spreads_, caps_, floors_, i), paymentDayCounter_,
389- start, end, refStart, refEnd, exCouponDate)));
390- } else { // zero inflation coupon
391- ext::shared_ptr<CPICoupon> coup;
392-
393- coup = ext::make_shared<CPICoupon>(
394- baseCPI_, // all have same base for ratio
395- baseDate,
396- paymentDate, detail::get (notionals_, i, 0.0 ), start, end, index_,
397- observationLag_, observationInterpolation_, paymentDayCounter_, detail::get (fixedRates_, i, 0.0 ),
398- detail::get (spreads_, i, 0.0 ), refStart, refEnd, exCouponDate, subtractInflationNominalAllCoupons_);
399-
400- // set a pricer for the underlying coupon straight away because it only provides computation - not data
401- ext::shared_ptr<CPICouponPricer> pricer (new CPICouponPricer (Handle<YieldTermStructure>(rateCurve_)));
402- coup->setPricer (pricer);
403-
404- if (detail::noOption (caps_, floors_, i)) { // just swaplet
405- leg.push_back (ext::dynamic_pointer_cast<CashFlow>(coup));
406- } else { // cap/floorlet
407- ext::shared_ptr<CappedFlooredCPICoupon> cfCoup = ext::make_shared<CappedFlooredCPICoupon>(
408- coup, startDate_, detail::get (caps_, i, Null<Rate>()), detail::get (floors_, i, Null<Rate>()));
409- // in this case we need to set the "outer" pricer later that handles cap and floor
410- leg.push_back (ext::dynamic_pointer_cast<CashFlow>(cfCoup));
411- }
385+
386+ ext::shared_ptr<CPICoupon> coup;
387+
388+ coup = ext::make_shared<CPICoupon>(
389+ baseCPI_, // all have same base for ratio
390+ baseDate,
391+ paymentDate, detail::get (notionals_, i, 0.0 ), start, end, index_,
392+ observationLag_, observationInterpolation_, paymentDayCounter_, detail::get (fixedRates_, i, 0.0 ),
393+ detail::get (spreads_, i, 0.0 ), refStart, refEnd, exCouponDate, subtractInflationNominalAllCoupons_);
394+
395+ // set a pricer for the underlying coupon straight away because it only provides computation - not data
396+ ext::shared_ptr<CPICouponPricer> pricer (new CPICouponPricer (Handle<YieldTermStructure>(rateCurve_)));
397+ coup->setPricer (pricer);
398+
399+ if (detail::noOption (caps_, floors_, i)) { // just swaplet
400+ leg.push_back (ext::dynamic_pointer_cast<CashFlow>(coup));
401+ } else { // cap/floorlet
402+ ext::shared_ptr<CappedFlooredCPICoupon> cfCoup = ext::make_shared<CappedFlooredCPICoupon>(
403+ coup, startDate_, detail::get (caps_, i, Null<Rate>()), detail::get (floors_, i, Null<Rate>()));
404+ // in this case we need to set the "outer" pricer later that handles cap and floor
405+ leg.push_back (ext::dynamic_pointer_cast<CashFlow>(cfCoup));
412406 }
413407 }
414408 }
0 commit comments