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

#include <ored/model/inflation/infdkdata.hpp>

+ Inheritance diagram for InfDkData:
+ Collaboration diagram for InfDkData:

Public Member Functions

 InfDkData ()
 Default constructor. More...
 
 InfDkData (CalibrationType calibrationType, const std::vector< CalibrationBasket > &calibrationBaskets, const std::string &currency, const std::string &index, const ReversionParameter &reversion, const VolatilityParameter &volatility, const LgmReversionTransformation &reversionTransformation=LgmReversionTransformation(), const bool ignoreDuplicateCalibrationExpiryTimes=false)
 Detailed constructor. More...
 
Inspectors
const ReversionParameterreversion () const
 
const VolatilityParametervolatility () const
 
const LgmReversionTransformationreversionTransformation () const
 
- Public Member Functions inherited from InflationModelData
 InflationModelData ()
 Default constructor. The currency and inflation index are empty. More...
 
 InflationModelData (CalibrationType calibrationType, const std::vector< CalibrationBasket > &calibrationBaskets, const std::string &currency, const std::string &index, const bool ignoreDuplicateCalibrationExpiryTimes)
 
const std::string & currency () const
 
const std::string & index () const
 
bool ignoreDuplicateCalibrationExpiryTimes () const
 
void fromXML (XMLNode *node) override
 
- Public Member Functions inherited from ModelData
 ModelData ()
 Default constructor. More...
 
 ModelData (CalibrationType calibrationType, const std::vector< CalibrationBasket > &calibrationBaskets)
 Detailed constructor. More...
 
CalibrationType calibrationType () const
 
const std::vector< CalibrationBasket > & calibrationBaskets () const
 
void fromXML (XMLNode *node) override
 
- 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...
 

Serialisation

ReversionParameter reversion_
 
VolatilityParameter volatility_
 
LgmReversionTransformation reversionTransformation_
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
void populateCalibrationBaskets (XMLNode *node)
 Support legacy XML interface for reading calibration instruments. More...
 

Additional Inherited Members

- Protected Member Functions inherited from InflationModelData
void append (XMLDocument &doc, XMLNode *node) const override
 Method used by toXML in derived classes to add the members here to a node. More...
 
- Protected Member Functions inherited from ModelData
- Protected Attributes inherited from ModelData
std::vector< CalibrationBasketcalibrationBaskets_
 

Detailed Description

Dodgson Kainth inflation model data

Model data specifying the Dodgson Kainth inflation model described in Modern Derivatives Pricing and Credit Exposure Analysis, Chapter 13.

Definition at line 43 of file infdkdata.hpp.

Constructor & Destructor Documentation

◆ InfDkData() [1/2]

InfDkData ( )

Default constructor.

Definition at line 28 of file infdkdata.cpp.

28{}

◆ InfDkData() [2/2]

InfDkData ( CalibrationType  calibrationType,
const std::vector< CalibrationBasket > &  calibrationBaskets,
const std::string &  currency,
const std::string &  index,
const ReversionParameter reversion,
const VolatilityParameter volatility,
const LgmReversionTransformation reversionTransformation = LgmReversionTransformation(),
const bool  ignoreDuplicateCalibrationExpiryTimes = false 
)

Detailed constructor.

Definition at line 30 of file infdkdata.cpp.

LgmReversionTransformation reversionTransformation_
Definition: infdkdata.hpp:75
ReversionParameter reversion_
Definition: infdkdata.hpp:73
const VolatilityParameter & volatility() const
Definition: infdkdata.cpp:47
VolatilityParameter volatility_
Definition: infdkdata.hpp:74
const ReversionParameter & reversion() const
Definition: infdkdata.cpp:43
const LgmReversionTransformation & reversionTransformation() const
Definition: infdkdata.cpp:51
const std::string & index() const
const std::string & currency() const
bool ignoreDuplicateCalibrationExpiryTimes() const
InflationModelData()
Default constructor. The currency and inflation index are empty.
CalibrationType calibrationType() const
Definition: modeldata.cpp:34
const std::vector< CalibrationBasket > & calibrationBaskets() const
Definition: modeldata.cpp:38

Member Function Documentation

◆ reversion()

const ReversionParameter & reversion ( ) const

Definition at line 43 of file infdkdata.cpp.

43 {
44 return reversion_;
45}

◆ volatility()

const VolatilityParameter & volatility ( ) const

Definition at line 47 of file infdkdata.cpp.

47 {
48 return volatility_;
49}

◆ reversionTransformation()

const LgmReversionTransformation & reversionTransformation ( ) const

Definition at line 51 of file infdkdata.cpp.

51 {
53}

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 55 of file infdkdata.cpp.

55 {
56
57 // Check the node is not null and that name is LGM or DodgsonKainth. LGM is for backward compatibility.
58 QL_REQUIRE(node, "XML Node should not be null");
59 QL_REQUIRE(XMLUtils::getNodeName(node) == "LGM" || XMLUtils::getNodeName(node) == "DodgsonKainth", "Expected " <<
60 "node name to be either LGM or DodgsonKainth");
61
63 reversion_.fromXML(XMLUtils::getChildNode(node, "Reversion"));
64 volatility_.fromXML(XMLUtils::getChildNode(node, "Volatility"));
65
66 // Read in calibration instruments to create calibration baskets. We support the legacy XML interface which was
67 // a single CalibrationCapFloors node and the new interface which is a vector of serialisable CalibrationBasket
68 // objects.
69 if (XMLNode* n = XMLUtils::getChildNode(node, "CalibrationCapFloors")) {
70 // Check that we have not already populated the calibration baskets.
71 QL_REQUIRE(calibrationBaskets_.empty(), "Calibration baskets have already been populated.");
72 // Legacy interface.
74 }
75
76 if (XMLNode* n = XMLUtils::getChildNode(node, "ParameterTransformation")) {
78 }
79}
void populateCalibrationBaskets(XMLNode *node)
Support legacy XML interface for reading calibration instruments.
Definition: infdkdata.cpp:92
void fromXML(XMLNode *node) override
void fromXML(XMLNode *node) override
Definition: lgmdata.cpp:260
std::vector< CalibrationBasket > calibrationBaskets_
Definition: modeldata.hpp:66
void fromXML(XMLNode *node) override
void fromXML(XMLNode *node) override
static string getNodeName(XMLNode *n)
Get and set a node's name.
Definition: xmlutils.cpp:473
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 81 of file infdkdata.cpp.

81 {
82
83 XMLNode* node = doc.allocNode("DodgsonKainth");
88
89 return node;
90}
void append(XMLDocument &doc, XMLNode *node) const override
Method used by toXML in derived classes to add the members here to a node.
XMLNode * toXML(XMLDocument &doc) const override
Definition: lgmdata.cpp:266
XMLNode * toXML(XMLDocument &doc) const override
XMLNode * toXML(XMLDocument &doc) const override
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
+ Here is the call graph for this function:

◆ populateCalibrationBaskets()

void populateCalibrationBaskets ( XMLNode node)
private

Support legacy XML interface for reading calibration instruments.

Definition at line 92 of file infdkdata.cpp.

92 {
93
94 // Get the values from the XML
95 auto type = parseCapFloorType(XMLUtils::getChildValue(node, "CapFloor", true));
96 auto maturities = XMLUtils::getChildrenValuesAsStrings(node, "Expiries", true);
97 auto strikes = XMLUtils::getChildrenValuesAsStrings(node, "Strikes", true);
98
99 if (!strikes.empty()) {
100
101 QL_REQUIRE(strikes.size() == maturities.size(), "Number of maturities and strikes for inflation index " <<
102 index() << " should match but got " << strikes.size() << " strikes and " << maturities.size() <<
103 " maturities.");
104
105 // If any of the strikes are ATM, relabel to ATM/AtmFwd so that parseBaseStrike works below.
106 for (string& s : strikes) {
107 if (s == "ATM")
108 s = "ATM/AtmFwd";
109 }
110 } else {
111 // Default to ATM if no strikes provided.
112 strikes.resize(maturities.size(), "ATM/AtmFwd");
113 }
114
115 // Create a vector of CPI cap floor calibration instruments.
116 vector<QuantLib::ext::shared_ptr<CalibrationInstrument>> instruments;
117 for (Size i = 0; i < maturities.size(); ++i) {
118 auto p = parseDateOrPeriod(maturities[i]);
119 QuantLib::ext::shared_ptr<BaseStrike> s = parseBaseStrike(strikes[i]);
120 instruments.push_back(QuantLib::ext::make_shared<CpiCapFloor>(type, p, s));
121 }
122
123 // Populate the calibrationBaskets_ member.
124 calibrationBaskets_ = { CalibrationBasket(instruments) };
125}
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static vector< string > getChildrenValuesAsStrings(XMLNode *node, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:342
boost::variant< QuantLib::Date, QuantLib::Period > parseDateOrPeriod(const string &s)
Convert text to QuantLib::Period or QuantLib::Date.
Definition: parsers.cpp:493
CapFloor::Type parseCapFloorType(const string &s)
Definition: parsers.cpp:815
QuantLib::ext::shared_ptr< BaseStrike > parseBaseStrike(const string &strStrike)
Parse a Strike from its string representation, strStrike.
Definition: strike.cpp:262
vector< Real > strikes
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ reversion_

ReversionParameter reversion_
private

Definition at line 73 of file infdkdata.hpp.

◆ volatility_

VolatilityParameter volatility_
private

Definition at line 74 of file infdkdata.hpp.

◆ reversionTransformation_

LgmReversionTransformation reversionTransformation_
private

Definition at line 75 of file infdkdata.hpp.