@@ -217,11 +217,11 @@ YieldCurveConfig::YieldCurveConfig(const string& curveID, const string& curveDes
217217 const vector<boost::shared_ptr<YieldCurveSegment>>& curveSegments,
218218 const string& interpolationVariable, const string& interpolationMethod,
219219 const string& zeroDayCounter, bool extrapolation,
220- const BootstrapConfig& bootstrapConfig)
220+ const BootstrapConfig& bootstrapConfig, const Size mixedInterpolationCutoff )
221221 : CurveConfig(curveID, curveDescription), currency_(currency), discountCurveID_(discountCurveID),
222222 curveSegments_ (curveSegments), interpolationVariable_(interpolationVariable),
223223 interpolationMethod_(interpolationMethod), zeroDayCounter_(zeroDayCounter), extrapolation_(extrapolation),
224- bootstrapConfig_(bootstrapConfig) {
224+ bootstrapConfig_(bootstrapConfig), mixedInterpolationCutoff_(mixedInterpolationCutoff) {
225225 populateRequiredCurveIds ();
226226}
227227
@@ -309,26 +309,11 @@ void YieldCurveConfig::fromXML(XMLNode* node) {
309309 // Read in the optional nodes.
310310
311311 // Empty strings if not there (or if there and empty).
312- interpolationVariable_ = XMLUtils::getChildValue (node, " InterpolationVariable" , false );
313- interpolationMethod_ = XMLUtils::getChildValue (node, " InterpolationMethod" , false );
314- zeroDayCounter_ = XMLUtils::getChildValue (node, " YieldCurveDayCounter" , false );
315-
316- // Add hardcoded defaults for now.
317- if (interpolationVariable_.empty ()) {
318- interpolationVariable_ = " Discount" ;
319- }
320- if (interpolationMethod_.empty ()) {
321- interpolationMethod_ = interpolationVariable_ == " Zero" ? " Linear" : " LogLinear" ;
322- }
323- if (zeroDayCounter_.empty ()) {
324- zeroDayCounter_ = " A365" ;
325- }
326- XMLNode* nodeToTest = XMLUtils::getChildNode (node, " Extrapolation" );
327- if (nodeToTest) {
328- extrapolation_ = XMLUtils::getChildValueAsBool (node, " Extrapolation" , false );
329- } else {
330- extrapolation_ = true ;
331- }
312+ interpolationVariable_ = XMLUtils::getChildValue (node, " InterpolationVariable" , false , " Discount" );
313+ interpolationMethod_ = XMLUtils::getChildValue (node, " InterpolationMethod" , false , interpolationVariable_ == " Zero" ? " Linear" : " LogLinear" );
314+ mixedInterpolationCutoff_ = XMLUtils::getChildValueAsInt (node, " MixedInterpolationCutoff" , false , 1 );
315+ zeroDayCounter_ = XMLUtils::getChildValue (node, " YieldCurveDayCounter" , false , " A365" );
316+ extrapolation_ = XMLUtils::getChildValueAsBool (node, " Extrapolation" , false , true );
332317
333318 // Optional bootstrap configuration
334319 if (XMLNode* n = XMLUtils::getChildNode (node, " BootstrapConfig" )) {
@@ -367,6 +352,7 @@ XMLNode* YieldCurveConfig::toXML(XMLDocument& doc) {
367352 // Add the defaultable elements.
368353 XMLUtils::addChild (doc, node, " InterpolationVariable" , interpolationVariable_);
369354 XMLUtils::addChild (doc, node, " InterpolationMethod" , interpolationMethod_);
355+ XMLUtils::addChild (doc, node, " MixedInterpolationCutoff" , (int )mixedInterpolationCutoff_);
370356 XMLUtils::addChild (doc, node, " YieldCurveDayCounter" , zeroDayCounter_);
371357 XMLUtils::addChild (doc, node, " Tolerance" , bootstrapConfig_.accuracy ());
372358 XMLUtils::addChild (doc, node, " Extrapolation" , extrapolation_);
@@ -447,6 +433,8 @@ void YieldCurveSegment::fromXML(XMLNode* node) {
447433 pillarChoice_ = parsePillarChoice (XMLUtils::getChildValue (node, " PillarChoice" , false , " LastRelevantDate" ));
448434 QL_REQUIRE (pillarChoice_ == QuantLib::Pillar::MaturityDate || pillarChoice_ == QuantLib::Pillar::LastRelevantDate,
449435 " PillarChoice " << pillarChoice_ << " not supported, expected MaturityDate, LastRelevantDate" );
436+ priority_ = XMLUtils::getChildValueAsInt (node, " Priority" , false , 0 );
437+ minDistance_ = XMLUtils::getChildValueAsInt (node, " MinDistance" , false , 1 );
450438}
451439
452440XMLNode* YieldCurveSegment::toXML (XMLDocument& doc) {
@@ -481,6 +469,8 @@ XMLNode* YieldCurveSegment::toXML(XMLDocument& doc) {
481469 if (!conventionsID_.empty ())
482470 XMLUtils::addChild (doc, node, " Conventions" , conventionsID_);
483471 XMLUtils::addChild (doc, node, " PillarChoice" , ore::data::to_string (pillarChoice_));
472+ XMLUtils::addChild (doc, node, " Priority" , (int )priority_);
473+ XMLUtils::addChild (doc, node, " MinDistance" , (int )minDistance_);
484474 return node;
485475}
486476
0 commit comments