@@ -344,6 +344,13 @@ Helpers InfJyBuilder::buildCpiCapFloorBasket(const CalibrationBasket& cb,
344344 // Add the helper's time to expiry.
345345 auto fixingDate = helper->instrument ()->fixingDate ();
346346 auto t = inflationTime (fixingDate, *zts, false );
347+
348+ // if time is not positive deactivate helper
349+ if (t < 0.0 || QuantLib::close_enough (t, 0.0 )) {
350+ active[i] = false ;
351+ continue ;
352+ }
353+
347354 auto p = expiryTimes.insert (t);
348355 QL_REQUIRE (data_->ignoreDuplicateCalibrationExpiryTimes () || p.second ,
349356 " InfJyBuilder: a CPI cap floor calibration "
@@ -459,6 +466,13 @@ Helpers InfJyBuilder::buildYoYCapFloorBasket(const CalibrationBasket& cb, vector
459466 // Add the helper's time to expiry.
460467 auto fixingDate = helperInst->lastYoYInflationCoupon ()->fixingDate ();
461468 auto t = inflationTime (fixingDate, *yoyTs, yoyInflationIndex_->interpolated ());
469+
470+ // if time is not positive deactivate helper
471+ if (t < 0.0 || QuantLib::close_enough (t, 0.0 )) {
472+ active[i] = false ;
473+ continue ;
474+ }
475+
462476 auto p = expiryTimes.insert (t);
463477 QL_REQUIRE (data_->ignoreDuplicateCalibrationExpiryTimes () || p.second ,
464478 " InfJyBuilder: a YoY cap floor calibration "
@@ -575,7 +589,7 @@ Helpers InfJyBuilder::buildYoYSwapBasket(const CalibrationBasket& cb,
575589 t = inflationTime (denFixingDate, *yoyTs, yoyInflationIndex_->interpolated ());
576590 }
577591
578- if (t <= 0 ) {
592+ if (t < 0 || close_enough (t, 0.0 ) ) {
579593 DLOG (" The year on year swap with maturity tenor, " << yoySwap->tenor () << " , and date, " << maturity <<
580594 " , has a non-positive parameter time, " << t << " , so skipping this as a calibration instrument." );
581595 continue ;
0 commit comments