Skip to content

Commit ef8c5bd

Browse files
pcaspersjenkins
authored andcommitted
QPR-12430 make calendar and bdc optional in conventions and default to the index values
1 parent e74e52f commit ef8c5bd

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

OREData/ored/configuration/conventions.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,20 @@ IRSwapConvention::IRSwapConvention(const string& id, const string& fixedCalendar
474474
}
475475

476476
void IRSwapConvention::build() {
477-
fixedCalendar_ = parseCalendar(strFixedCalendar_);
478477
fixedFrequency_ = parseFrequency(strFixedFrequency_);
479-
fixedConvention_ = parseBusinessDayConvention(strFixedConvention_);
480478
fixedDayCounter_ = parseDayCounter(strFixedDayCounter_);
481-
parseIborIndex(strIndex_);
479+
auto ind = parseIborIndex(strIndex_);
480+
481+
if (strFixedCalendar_.empty())
482+
fixedCalendar_ = ind->fixingCalendar();
483+
else
484+
fixedCalendar_ = parseCalendar(strFixedCalendar_);
485+
486+
if (strFixedConvention_.empty())
487+
fixedConvention_ = ind->businessDayConvention();
488+
else
489+
fixedConvention_ = parseBusinessDayConvention(strFixedConvention_);
490+
482491
if (hasSubPeriod_) {
483492
floatFrequency_ = parseFrequency(strFloatFrequency_);
484493
subPeriodsCouponType_ = parseSubPeriodsCouponType(strSubPeriodsCouponType_);
@@ -495,13 +504,13 @@ void IRSwapConvention::fromXML(XMLNode* node) {
495504
id_ = XMLUtils::getChildValue(node, "Id", true);
496505

497506
// Get string values from xml
498-
strFixedCalendar_ = XMLUtils::getChildValue(node, "FixedCalendar", true);
499507
strFixedFrequency_ = XMLUtils::getChildValue(node, "FixedFrequency", true);
500-
strFixedConvention_ = XMLUtils::getChildValue(node, "FixedConvention", true);
501508
strFixedDayCounter_ = XMLUtils::getChildValue(node, "FixedDayCounter", true);
502509
strIndex_ = XMLUtils::getChildValue(node, "Index", true);
503510

504511
// optional
512+
strFixedCalendar_ = XMLUtils::getChildValue(node, "FixedCalendar", false);
513+
strFixedConvention_ = XMLUtils::getChildValue(node, "FixedConvention", false);
505514
strFloatFrequency_ = XMLUtils::getChildValue(node, "FloatFrequency", false);
506515
strSubPeriodsCouponType_ = XMLUtils::getChildValue(node, "SubPeriodsCouponType", false);
507516
hasSubPeriod_ = (strFloatFrequency_ != "");

xsd/conventions.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@
111111
<xs:complexType name="swapType">
112112
<xs:all>
113113
<xs:element type="xs:string" name="Id" minOccurs="1" maxOccurs="1"/>
114-
<xs:element type="xs:string" name="FixedCalendar" minOccurs="1" maxOccurs="1"/>
114+
<xs:element type="xs:string" name="FixedCalendar" minOccurs="0" maxOccurs="1"/>
115115
<xs:element type="frequencyType" name="FixedFrequency" minOccurs="1" maxOccurs="1"/>
116-
<xs:element type="businessDayConvention" name="FixedConvention" minOccurs="1" maxOccurs="1"/>
116+
<xs:element type="businessDayConvention" name="FixedConvention" minOccurs="0" maxOccurs="1"/>
117117
<xs:element type="dayCounter" name="FixedDayCounter" minOccurs="1" maxOccurs="1"/>
118118
<xs:element type="xs:string" name="Index" minOccurs="1" maxOccurs="1"/>
119119
<xs:element type="frequencyType" name="FloatFrequency" minOccurs="0" maxOccurs="1"/>

0 commit comments

Comments
 (0)