@@ -74,17 +74,12 @@ namespace data {
7474
7575using Helpers = InfJyBuilder::Helpers;
7676
77- InfJyBuilder::InfJyBuilder (
78- const boost::shared_ptr<Market>& market,
79- const boost::shared_ptr<InfJyData>& data,
80- const string& configuration,
81- const string& referenceCalibrationGrid)
82- : market_(market),
83- configuration_ (configuration),
84- data_(data),
85- referenceCalibrationGrid_(referenceCalibrationGrid),
86- marketObserver_(boost::make_shared<MarketObserver>()),
87- zeroInflationIndex_(*market_->zeroInflationIndex (data_->index (), configuration_)) {
77+ InfJyBuilder::InfJyBuilder (const boost::shared_ptr<Market>& market, const boost::shared_ptr<InfJyData>& data,
78+ const string& configuration, const string& referenceCalibrationGrid,
79+ const bool dontCalibrate)
80+ : market_(market), configuration_(configuration), data_(data), referenceCalibrationGrid_(referenceCalibrationGrid),
81+ dontCalibrate_ (dontCalibrate), marketObserver_(boost::make_shared<MarketObserver>()),
82+ zeroInflationIndex_(*market_->zeroInflationIndex (data_->index (), configuration_)) {
8883
8984 LOG (" InfJyBuilder: building model for inflation index " << data_->index ());
9085
@@ -130,22 +125,22 @@ Helpers InfJyBuilder::indexBasket() const {
130125}
131126
132127bool InfJyBuilder::requiresRecalibration () const {
133- return (data_->realRateVolatility ().calibrate () ||
134- data_->realRateReversion ().calibrate () ||
135- data_->indexVolatility ().calibrate ()) &&
136- (marketObserver_->hasUpdated (false ) ||
137- forceCalibration_ ||
138- pricesChanged (false ));
128+ return (data_->realRateVolatility ().calibrate () || data_->realRateReversion ().calibrate () ||
129+ data_->indexVolatility ().calibrate ()) &&
130+ (marketObserver_->hasUpdated (false ) || forceCalibration_ || pricesChanged (false ));
139131}
140132
141133void InfJyBuilder::performCalculations () const {
142134 if (requiresRecalibration ()) {
143- marketObserver_->hasUpdated (true );
144135 buildCalibrationBaskets ();
145- pricesChanged (true );
146136 }
147137}
148138
139+ void InfJyBuilder::setCalibrationDone () const {
140+ marketObserver_->hasUpdated (true );
141+ pricesChanged (true );
142+ }
143+
149144void InfJyBuilder::forceRecalculate () {
150145 forceCalibration_ = true ;
151146 ModelBuilder::forceRecalculate ();
@@ -291,7 +286,7 @@ Helpers InfJyBuilder::buildCpiCapFloorBasket(const CalibrationBasket& cb,
291286 // Also some variables used in the loop below.
292287 auto calendar = zeroInflationIndex_->fixingCalendar ();
293288 auto baseDate = zts->baseDate ();
294- auto baseCpi = zeroInflationIndex_->fixing (baseDate);
289+ auto baseCpi = dontCalibrate_ ? 100.0 : zeroInflationIndex_->fixing (baseDate);
295290 auto bdc = cpiVolatility_->businessDayConvention ();
296291 auto obsLag = cpiVolatility_->observationLag ();
297292
@@ -340,7 +335,7 @@ Helpers InfJyBuilder::buildCpiCapFloorBasket(const CalibrationBasket& cb,
340335 inst->setPricingEngine (engine);
341336
342337 // Build the helper using the NPV as the premium.
343- auto premium = inst->NPV ();
338+ auto premium = dontCalibrate_ ? 0.01 : inst->NPV ();
344339 auto helper = boost::make_shared<CpiCapFloorHelper>(capfloor, baseCpi, maturity, calendar, bdc, calendar, bdc,
345340 strikeValue, inflationIndex, obsLag, premium,
346341 observationInterpolation);
@@ -459,7 +454,7 @@ Helpers InfJyBuilder::buildYoYCapFloorBasket(const CalibrationBasket& cb, vector
459454 helperInst->setPricingEngine (engine);
460455
461456 // Update the helper's market quote with the fair rate.
462- quote->setValue (helperInst->NPV ());
457+ quote->setValue (dontCalibrate_ ? 0.1 : helperInst->NPV ());
463458
464459 // Add the helper's time to expiry.
465460 auto fixingDate = helperInst->lastYoYInflationCoupon ()->fixingDate ();
@@ -710,7 +705,8 @@ boost::shared_ptr<FxBsParametrization> InfJyBuilder::createIndexParam() const {
710705 boost::shared_ptr<QuantExt::FxBsParametrization> indexParam;
711706
712707 Handle<Quote> baseCpiQuote (boost::make_shared<SimpleQuote>(
713- zeroInflationIndex_->fixing (zeroInflationIndex_->zeroInflationTermStructure ()->baseDate ())));
708+ dontCalibrate_ ? 100
709+ : zeroInflationIndex_->fixing (zeroInflationIndex_->zeroInflationTermStructure ()->baseDate ())));
714710
715711 // Index volatility parameter constraints
716712 const auto & cc = data_->calibrationConfiguration ();
@@ -807,6 +803,8 @@ void InfJyBuilder::initialiseMarket() {
807803}
808804
809805bool InfJyBuilder::pricesChanged (bool updateCache) const {
806+ if (dontCalibrate_)
807+ return false ;
810808
811809 // Build the calibration instruments again before checking the market price below.
812810 // Don't need to do this if updateCache is true, because only called above after buildCalibrationBaskets().
0 commit comments