Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
InflationSwapConvention Class Reference

#include <ored/configuration/conventions.hpp>

+ Inheritance diagram for InflationSwapConvention:
+ Collaboration diagram for InflationSwapConvention:

Public Types

enum class  PublicationRoll { None , OnPublicationDate , AfterPublicationDate }
 Rule for determining when inflation swaps roll to observing latest inflation index release. More...
 
- Public Types inherited from Convention
enum class  Type {
  Zero , Deposit , Future , FRA ,
  OIS , Swap , AverageOIS , TenorBasisSwap ,
  TenorBasisTwoSwap , BMABasisSwap , FX , CrossCcyBasis ,
  CrossCcyFixFloat , CDS , IborIndex , OvernightIndex ,
  SwapIndex , ZeroInflationIndex , InflationSwap , SecuritySpread ,
  CMSSpreadOption , CommodityForward , CommodityFuture , FxOption ,
  BondYield
}
 Supported convention types. More...
 

Public Member Functions

 InflationSwapConvention ()
 
 InflationSwapConvention (const string &id, const string &strFixCalendar, const string &strFixConvention, const string &strDayCounter, const string &strIndex, const string &strInterpolated, const string &strObservationLag, const string &strAdjustInfObsDates, const string &strInfCalendar, const string &strInfConvention, PublicationRoll publicationRoll=PublicationRoll::None, const QuantLib::ext::shared_ptr< ScheduleData > &publicationScheduleData=nullptr)
 
const Calendar & fixCalendar () const
 
BusinessDayConvention fixConvention () const
 
const DayCounter & dayCounter () const
 
QuantLib::ext::shared_ptr< ZeroInflationIndexindex () const
 
const string & indexName () const
 
bool interpolated () const
 
Period observationLag () const
 
bool adjustInfObsDates () const
 
const Calendar & infCalendar () const
 
BusinessDayConvention infConvention () const
 
PublicationRoll publicationRoll () const
 
const Schedule & publicationSchedule () const
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
virtual void build () override
 
- Public Member Functions inherited from Convention
virtual ~Convention ()
 Default destructor. More...
 
const string & id () const
 
Type type () const
 
- Public Member Functions inherited from XMLSerializable
virtual ~XMLSerializable ()
 
virtual void fromXML (XMLNode *node)=0
 
virtual XMLNodetoXML (XMLDocument &doc) const =0
 
void fromFile (const std::string &filename)
 
void toFile (const std::string &filename) const
 
void fromXMLString (const std::string &xml)
 Parse from XML string. More...
 
std::string toXMLString () const
 Parse from XML string. More...
 

Private Attributes

Calendar fixCalendar_
 
BusinessDayConvention fixConvention_
 
DayCounter dayCounter_
 
QuantLib::ext::shared_ptr< ZeroInflationIndexindex_
 
bool interpolated_
 
Period observationLag_
 
bool adjustInfObsDates_
 
Calendar infCalendar_
 
BusinessDayConvention infConvention_
 
Schedule publicationSchedule_
 
string strFixCalendar_
 
string strFixConvention_
 
string strDayCounter_
 
string strIndex_
 
string strInterpolated_
 
string strObservationLag_
 
string strAdjustInfObsDates_
 
string strInfCalendar_
 
string strInfConvention_
 
PublicationRoll publicationRoll_
 
QuantLib::ext::shared_ptr< ScheduleDatapublicationScheduleData_
 

Additional Inherited Members

- Protected Member Functions inherited from Convention
 Convention ()
 
 Convention (const string &id, Type type)
 
- Protected Attributes inherited from Convention
Type type_
 
string id_
 

Detailed Description

Definition at line 1083 of file conventions.hpp.

Member Enumeration Documentation

◆ PublicationRoll

enum class PublicationRoll
strong

Rule for determining when inflation swaps roll to observing latest inflation index release.

Enumerator
None 
OnPublicationDate 
AfterPublicationDate 

Definition at line 1086 of file conventions.hpp.

Constructor & Destructor Documentation

◆ InflationSwapConvention() [1/2]

◆ InflationSwapConvention() [2/2]

InflationSwapConvention ( const string &  id,
const string &  strFixCalendar,
const string &  strFixConvention,
const string &  strDayCounter,
const string &  strIndex,
const string &  strInterpolated,
const string &  strObservationLag,
const string &  strAdjustInfObsDates,
const string &  strInfCalendar,
const string &  strInfConvention,
PublicationRoll  publicationRoll = PublicationRoll::None,
const QuantLib::ext::shared_ptr< ScheduleData > &  publicationScheduleData = nullptr 
)

Definition at line 1239 of file conventions.cpp.

1246 : Convention(id, Type::InflationSwap), strFixCalendar_(strFixCalendar), strFixConvention_(strFixConvention),
1247 strDayCounter_(strDayCounter), strIndex_(strIndex), strInterpolated_(strInterpolated),
1248 strObservationLag_(strObservationLag), strAdjustInfObsDates_(strAdjustInfObsDates),
1249 strInfCalendar_(strInfCalendar), strInfConvention_(strInfConvention),
1250 publicationRoll_(publicationRoll), publicationScheduleData_(publicationScheduleData) {
1251 build();
1252}
QuantLib::ext::shared_ptr< ScheduleData > publicationScheduleData_
PublicationRoll publicationRoll() const
virtual void build() override
+ Here is the call graph for this function:

Member Function Documentation

◆ fixCalendar()

const Calendar & fixCalendar ( ) const

Definition at line 1101 of file conventions.hpp.

◆ fixConvention()

BusinessDayConvention fixConvention ( ) const

Definition at line 1102 of file conventions.hpp.

1102{ return fixConvention_; }

◆ dayCounter()

const DayCounter & dayCounter ( ) const

Definition at line 1103 of file conventions.hpp.

1103{ return dayCounter_; }

◆ index()

QuantLib::ext::shared_ptr< ZeroInflationIndex > index ( ) const

Definition at line 1333 of file conventions.cpp.

1333 {
1334 return parseZeroInflationIndex(strIndex_, Handle<ZeroInflationTermStructure>());
1335}
QuantLib::ext::shared_ptr< ZeroInflationIndex > parseZeroInflationIndex(const string &s, const Handle< ZeroInflationTermStructure > &h)
Convert std::string to QuantLib::ZeroInflationIndex.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ indexName()

const string & indexName ( ) const

Definition at line 1105 of file conventions.hpp.

1105{ return strIndex_; }

◆ interpolated()

bool interpolated ( ) const

Definition at line 1106 of file conventions.hpp.

1106{ return interpolated_; }

◆ observationLag()

Period observationLag ( ) const

Definition at line 1107 of file conventions.hpp.

◆ adjustInfObsDates()

bool adjustInfObsDates ( ) const

Definition at line 1108 of file conventions.hpp.

1108{ return adjustInfObsDates_; }

◆ infCalendar()

const Calendar & infCalendar ( ) const

Definition at line 1109 of file conventions.hpp.

◆ infConvention()

BusinessDayConvention infConvention ( ) const

Definition at line 1110 of file conventions.hpp.

1110{ return infConvention_; }

◆ publicationRoll()

PublicationRoll publicationRoll ( ) const

Definition at line 1111 of file conventions.hpp.

1111{ return publicationRoll_; }
+ Here is the caller graph for this function:

◆ publicationSchedule()

const Schedule & publicationSchedule ( ) const

Definition at line 1112 of file conventions.hpp.

+ Here is the caller graph for this function:

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 1272 of file conventions.cpp.

1272 {
1273
1274 XMLUtils::checkNode(node, "InflationSwap");
1276 id_ = XMLUtils::getChildValue(node, "Id", true);
1277
1278 // Get string values from xml
1279 strFixCalendar_ = XMLUtils::getChildValue(node, "FixCalendar", true);
1280 strFixConvention_ = XMLUtils::getChildValue(node, "FixConvention", true);
1281 strDayCounter_ = XMLUtils::getChildValue(node, "DayCounter", true);
1282 strIndex_ = XMLUtils::getChildValue(node, "Index", true);
1283 strInterpolated_ = XMLUtils::getChildValue(node, "Interpolated", true);
1284 strObservationLag_ = XMLUtils::getChildValue(node, "ObservationLag", true);
1285 strAdjustInfObsDates_ = XMLUtils::getChildValue(node, "AdjustInflationObservationDates", true);
1286 strInfCalendar_ = XMLUtils::getChildValue(node, "InflationCalendar", true);
1287 strInfConvention_ = XMLUtils::getChildValue(node, "InflationConvention", true);
1288
1290 if (XMLNode* n = XMLUtils::getChildNode(node, "PublicationRoll")) {
1292 }
1293
1295 XMLNode* n = XMLUtils::getChildNode(node, "PublicationSchedule");
1296 QL_REQUIRE(n, "PublicationRoll is " << publicationRoll_ << " for " << id() <<
1297 " so expect non-empty PublicationSchedule.");
1298 publicationScheduleData_ = QuantLib::ext::make_shared<ScheduleData>();
1299 publicationScheduleData_->fromXML(n);
1300 }
1301
1302 build();
1303}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static string getNodeValue(XMLNode *node)
Get a node's value.
Definition: xmlutils.cpp:489
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
InflationSwapConvention::PublicationRoll parseInflationSwapPublicationRoll(const string &s)
Convert text to InflationSwapConvention::PublicationRoll.
Definition: parsers.cpp:1012
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 1305 of file conventions.cpp.

1305 {
1306
1307 XMLNode* node = doc.allocNode("InflationSwap");
1308 XMLUtils::addChild(doc, node, "Id", id_);
1309 XMLUtils::addChild(doc, node, "FixCalendar", strFixCalendar_);
1310 XMLUtils::addChild(doc, node, "FixConvention", strFixConvention_);
1311 XMLUtils::addChild(doc, node, "DayCounter", strDayCounter_);
1312 XMLUtils::addChild(doc, node, "Index", strIndex_);
1313 XMLUtils::addChild(doc, node, "Interpolated", strInterpolated_);
1314 XMLUtils::addChild(doc, node, "ObservationLag", strObservationLag_);
1315 XMLUtils::addChild(doc, node, "AdjustInflationObservationDates", strAdjustInfObsDates_);
1316 XMLUtils::addChild(doc, node, "InflationCalendar", strInfCalendar_);
1317 XMLUtils::addChild(doc, node, "InflationConvention", strInfConvention_);
1318
1320 XMLUtils::addChild(doc, node, "PublicationRoll", to_string(publicationRoll_));
1321 QL_REQUIRE(publicationScheduleData_, "PublicationRoll is " << publicationRoll_ << " for "
1322 << id() << " so expect PublicationSchedule.");
1323
1324 // Need to change the name from ScheduleData to PublicationSchedule.
1325 XMLNode* n = publicationScheduleData_->toXML(doc);
1326 XMLUtils::setNodeName(doc, n, "PublicationSchedule");
1327 XMLUtils::appendNode(node, n);
1328 }
1329
1330 return node;
1331}
static void setNodeName(XMLDocument &doc, XMLNode *node, const string &name)
Definition: xmlutils.cpp:478
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ build()

void build ( )
overridevirtual

Implements Convention.

Definition at line 1254 of file conventions.cpp.

1254 {
1256 parseZeroInflationIndex(strIndex_, Handle<ZeroInflationTermStructure>());
1260 index_ = parseZeroInflationIndex(strIndex_, Handle<ZeroInflationTermStructure>());
1266 QL_REQUIRE(publicationScheduleData_, "Publication roll is " << publicationRoll_ << " for " << id() <<
1267 " so expect non-null publication schedule data.");
1269 }
1270}
QuantLib::ext::shared_ptr< ZeroInflationIndex > index_
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Definition: parsers.cpp:157
BusinessDayConvention parseBusinessDayConvention(const string &s)
Convert text to QuantLib::BusinessDayConvention.
Definition: parsers.cpp:173
Period parsePeriod(const string &s)
Convert text to QuantLib::Period.
Definition: parsers.cpp:171
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
DayCounter parseDayCounter(const string &s)
Convert text to QuantLib::DayCounter.
Definition: parsers.cpp:209
Schedule makeSchedule(const ScheduleDates &data)
Definition: schedule.cpp:263
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ fixCalendar_

Calendar fixCalendar_
private

Definition at line 1119 of file conventions.hpp.

◆ fixConvention_

BusinessDayConvention fixConvention_
private

Definition at line 1120 of file conventions.hpp.

◆ dayCounter_

DayCounter dayCounter_
private

Definition at line 1121 of file conventions.hpp.

◆ index_

QuantLib::ext::shared_ptr<ZeroInflationIndex> index_
private

Definition at line 1122 of file conventions.hpp.

◆ interpolated_

bool interpolated_
private

Definition at line 1123 of file conventions.hpp.

◆ observationLag_

Period observationLag_
private

Definition at line 1124 of file conventions.hpp.

◆ adjustInfObsDates_

bool adjustInfObsDates_
private

Definition at line 1125 of file conventions.hpp.

◆ infCalendar_

Calendar infCalendar_
private

Definition at line 1126 of file conventions.hpp.

◆ infConvention_

BusinessDayConvention infConvention_
private

Definition at line 1127 of file conventions.hpp.

◆ publicationSchedule_

Schedule publicationSchedule_
private

Definition at line 1128 of file conventions.hpp.

◆ strFixCalendar_

string strFixCalendar_
private

Definition at line 1131 of file conventions.hpp.

◆ strFixConvention_

string strFixConvention_
private

Definition at line 1132 of file conventions.hpp.

◆ strDayCounter_

string strDayCounter_
private

Definition at line 1133 of file conventions.hpp.

◆ strIndex_

string strIndex_
private

Definition at line 1134 of file conventions.hpp.

◆ strInterpolated_

string strInterpolated_
private

Definition at line 1135 of file conventions.hpp.

◆ strObservationLag_

string strObservationLag_
private

Definition at line 1136 of file conventions.hpp.

◆ strAdjustInfObsDates_

string strAdjustInfObsDates_
private

Definition at line 1137 of file conventions.hpp.

◆ strInfCalendar_

string strInfCalendar_
private

Definition at line 1138 of file conventions.hpp.

◆ strInfConvention_

string strInfConvention_
private

Definition at line 1139 of file conventions.hpp.

◆ publicationRoll_

PublicationRoll publicationRoll_
private

Definition at line 1140 of file conventions.hpp.

◆ publicationScheduleData_

QuantLib::ext::shared_ptr<ScheduleData> publicationScheduleData_
private

Definition at line 1141 of file conventions.hpp.