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

#include <ored/configuration/inflationcurveconfig.hpp>

+ Inheritance diagram for InflationCurveConfig:
+ Collaboration diagram for InflationCurveConfig:

Public Types

enum class  Type { ZC , YY }
 

Public Member Functions

 InflationCurveConfig ()
 
 InflationCurveConfig (const string &curveID, const string &curveDescription, const string &nominalTermStructure, const Type type, const vector< string > &quotes, const string &conventions, const bool extrapolate, const Calendar &calendar, const DayCounter &dayCounter, const Period &lag, const Frequency &frequency, const Real baseRate, const Real tolerance, const bool useLastAvailableFixingAsBaseDate, const Date &seasonalityBaseDate, const Frequency &seasonalityFrequency, const vector< string > &seasonalityFactors, const vector< double > &overrideSeasonalityFactors=std::vector< double >())
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
const string & nominalTermStructure () const
 
const Typetype () const
 
const string & conventions () const
 
const boolextrapolate () const
 
const Calendar & calendar () const
 
const DayCounter & dayCounter () const
 
const Period & lag () const
 
const Frequency & frequency () const
 
const Real & baseRate () const
 
const Real & tolerance () const
 
const booluseLastAvailableFixingAsBaseDate () const
 
const Date & seasonalityBaseDate () const
 
const Frequency & seasonalityFrequency () const
 
const vector< string > & seasonalityFactors () const
 
const vector< double > & overrideSeasonalityFactors () const
 
const vector< string > & swapQuotes ()
 
string & nominalTermStructure ()
 
Typetype ()
 
string & conventions ()
 
boolextrapolate ()
 
Calendar & calendar ()
 
DayCounter & dayCounter ()
 
Period & lag ()
 
Frequency & frequency ()
 
Real & baseRate ()
 
Real & tolerance ()
 
booluseLastAvailableFixingAsBaseDate ()
 
Date & seasonalityBaseDate ()
 
Frequency & seasonalityFrequency ()
 
vector< string > & seasonalityFactors ()
 
vector< double > & overrideSeasonalityFactors ()
 
- Public Member Functions inherited from CurveConfig
 CurveConfig (const string &curveID, const string &curveDescription, const vector< string > &quotes=vector< string >())
 Detailed constructor. More...
 
 CurveConfig ()
 Default constructor. More...
 
const string & curveID () const
 
const string & curveDescription () const
 
const set< string > & requiredCurveIds (const CurveSpec::CurveType &curveType) const
 
const map< CurveSpec::CurveType, set< string > > & requiredCurveIds () const
 
string & curveID ()
 
string & curveDescription ()
 
set< string > & requiredCurveIds (const CurveSpec::CurveType &curveType)
 
map< CurveSpec::CurveType, set< string > > & requiredCurveIds ()
 
virtual const vector< string > & quotes ()
 Return all the market quotes required for this config. More...
 
- 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 Member Functions

void populateRequiredCurveIds ()
 

Private Attributes

vector< string > swapQuotes_
 
string nominalTermStructure_
 
Type type_
 
string conventions_
 
string interpolationMethod_
 
bool extrapolate_
 
Calendar calendar_
 
DayCounter dayCounter_
 
Period lag_
 
Frequency frequency_
 
Real baseRate_
 
Real tolerance_
 
bool useLastAvailableFixingAsBaseDate_
 
Date seasonalityBaseDate_
 
Frequency seasonalityFrequency_
 
vector< string > seasonalityFactors_
 
vector< double > overrideSeasonalityFactors_
 

Additional Inherited Members

- Protected Attributes inherited from CurveConfig
string curveID_
 
string curveDescription_
 
vector< string > quotes_
 
map< CurveSpec::CurveType, set< string > > requiredCurveIds_
 

Detailed Description

Definition at line 45 of file inflationcurveconfig.hpp.

Member Enumeration Documentation

◆ Type

enum class Type
strong

Constructor & Destructor Documentation

◆ InflationCurveConfig() [1/2]

Definition at line 49 of file inflationcurveconfig.hpp.

49{}

◆ InflationCurveConfig() [2/2]

InflationCurveConfig ( const string &  curveID,
const string &  curveDescription,
const string &  nominalTermStructure,
const Type  type,
const vector< string > &  quotes,
const string &  conventions,
const bool  extrapolate,
const Calendar &  calendar,
const DayCounter &  dayCounter,
const Period &  lag,
const Frequency &  frequency,
const Real  baseRate,
const Real  tolerance,
const bool  useLastAvailableFixingAsBaseDate,
const Date &  seasonalityBaseDate,
const Frequency &  seasonalityFrequency,
const vector< string > &  seasonalityFactors,
const vector< double > &  overrideSeasonalityFactors = std::vector<double>() 
)

Definition at line 31 of file inflationcurveconfig.cpp.

45 quotes_.insert(quotes_.end(), seasonalityFactors.begin(), seasonalityFactors.end());
47}
vector< string > quotes_
Definition: curveconfig.hpp:74
const string & curveDescription() const
Definition: curveconfig.hpp:55
const string & curveID() const
Definition: curveconfig.hpp:54
CurveConfig()
Default constructor.
Definition: curveconfig.hpp:49
const bool & useLastAvailableFixingAsBaseDate() const
const DayCounter & dayCounter() const
const string & nominalTermStructure() const
const vector< string > & seasonalityFactors() const
const Frequency & seasonalityFrequency() const
const vector< double > & overrideSeasonalityFactors() const
const vector< string > & swapQuotes()
const Frequency & frequency() const
+ Here is the call graph for this function:

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 54 of file inflationcurveconfig.cpp.

54 {
55 XMLUtils::checkNode(node, "InflationCurve");
56
57 curveID_ = XMLUtils::getChildValue(node, "CurveId", true);
58 curveDescription_ = XMLUtils::getChildValue(node, "CurveDescription", true);
59 nominalTermStructure_ = XMLUtils::getChildValue(node, "NominalTermStructure", true);
60
61 string type = XMLUtils::getChildValue(node, "Type", true);
62 if (type == "ZC") {
64 } else if (type == "YY") {
66 } else
67 QL_FAIL("Type " << type << " not recognized");
68
69 swapQuotes_ = XMLUtils::getChildrenValues(node, "Quotes", "Quote", true);
70
71 conventions_ = XMLUtils::getChildValue(node, "Conventions", true);
72 extrapolate_ = XMLUtils::getChildValueAsBool(node, "Extrapolation", false);
73
74 string cal = XMLUtils::getChildValue(node, "Calendar", true);
76
77 string dc = XMLUtils::getChildValue(node, "DayCounter", true);
79
80 string lag = XMLUtils::getChildValue(node, "Lag", true);
82
83 string freq = XMLUtils::getChildValue(node, "Frequency", true);
85
86 baseRate_ = QuantLib::Null<Real>();
87 string baseZr = XMLUtils::getChildValue(node, "BaseRate", false);
88 if (baseZr != "")
89 baseRate_ = parseReal(baseZr);
90
91 string tol = XMLUtils::getChildValue(node, "Tolerance", true);
92 tolerance_ = parseReal(tol);
93
94 useLastAvailableFixingAsBaseDate_ = XMLUtils::getChildValueAsBool(node, "UseLastFixingDate", false, false);
95
96 XMLNode* seasonalityNode = XMLUtils::getChildNode(node, "Seasonality");
97 seasonalityBaseDate_ = QuantLib::Null<Date>();
98 seasonalityFrequency_ = QuantLib::NoFrequency;
99 seasonalityFactors_.clear();
101 if (seasonalityNode != nullptr) {
102 seasonalityBaseDate_ = parseDate(XMLUtils::getChildValue(seasonalityNode, "BaseDate", true));
103 seasonalityFrequency_ = parseFrequency(XMLUtils::getChildValue(seasonalityNode, "Frequency", true));
104 seasonalityFactors_ = XMLUtils::getChildrenValues(seasonalityNode, "Factors", "Factor", false);
105 quotes_.insert(quotes_.end(), seasonalityFactors_.begin(), seasonalityFactors_.end());
106 std::string overrideFctStr = XMLUtils::getChildValue(seasonalityNode, "OverrideFactors", false);
107 overrideSeasonalityFactors_ = parseListOfValues<Real>(overrideFctStr, &parseReal);
108 }
110}
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 bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
Definition: xmlutils.cpp:296
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static vector< string > getChildrenValues(XMLNode *node, const string &names, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:306
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Definition: parsers.cpp:157
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
Period parsePeriod(const string &s)
Convert text to QuantLib::Period.
Definition: parsers.cpp:171
Frequency parseFrequency(const string &s)
Convert text to QuantLib::Frequency.
Definition: parsers.cpp:348
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
DayCounter parseDayCounter(const string &s)
Convert text to QuantLib::DayCounter.
Definition: parsers.cpp:209
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 112 of file inflationcurveconfig.cpp.

112 {
113 XMLNode* node = doc.allocNode("InflationCurve");
114
115 XMLUtils::addChild(doc, node, "CurveId", curveID_);
116 XMLUtils::addChild(doc, node, "CurveDescription", curveDescription_);
117 XMLUtils::addChild(doc, node, "NominalTermStructure", nominalTermStructure_);
118
119 if (type_ == Type::ZC) {
120 XMLUtils::addChild(doc, node, "Type", "ZC");
121 } else if (type_ == Type::YY) {
122 XMLUtils::addChild(doc, node, "Type", "YY");
123 } else
124 QL_FAIL("Unknown Type in InflationCurveConfig::toXML()");
125
126 XMLUtils::addChildren(doc, node, "Quotes", "Quote", swapQuotes_);
127 XMLUtils::addChild(doc, node, "Conventions", conventions_);
128 string extrap = (extrapolate_ ? "true" : "false");
129 XMLUtils::addChild(doc, node, "Extrapolation", extrap);
130
131 string baseRateStr;
132 if (baseRate_ != QuantLib::Null<Real>())
133 baseRateStr = to_string(baseRate_);
134 else
135 baseRateStr = "";
136
137 XMLUtils::addChild(doc, node, "Calendar", to_string(calendar_));
138 XMLUtils::addChild(doc, node, "DayCounter", to_string(dayCounter_));
139 XMLUtils::addChild(doc, node, "Lag", to_string(lag_));
140 XMLUtils::addChild(doc, node, "Frequency", to_string(frequency_));
141 XMLUtils::addChild(doc, node, "BaseRate", baseRateStr);
142 XMLUtils::addChild(doc, node, "Tolerance", tolerance_);
143
145 XMLUtils::addChild(doc, node, "UseLastFixingDate", to_string(useLastAvailableFixingAsBaseDate_));
146
147 if (seasonalityBaseDate_ != QuantLib::Null<Date>()) {
148 XMLNode* seasonalityNode = XMLUtils::addChild(doc, node, "Seasonality");
149 std::ostringstream dateStr, sFreq;
150 dateStr << QuantLib::io::iso_date(seasonalityBaseDate_);
151 sFreq << seasonalityFrequency_;
152 XMLUtils::addChild(doc, seasonalityNode, "BaseDate", dateStr.str());
153 XMLUtils::addChild(doc, seasonalityNode, "Frequency", sFreq.str());
154 if (!seasonalityFactors_.empty())
155 XMLUtils::addChildren(doc, seasonalityNode, "Factors", "Factor", seasonalityFactors_);
156 if (!overrideSeasonalityFactors_.empty())
157 XMLUtils::addChild(doc, seasonalityNode, "OverrideFactors", overrideSeasonalityFactors_);
158 }
159
160 return node;
161}
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
static void addChildren(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values)
Definition: xmlutils.cpp:502
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ nominalTermStructure() [1/2]

const string & nominalTermStructure ( ) const

Definition at line 62 of file inflationcurveconfig.hpp.

62{ return nominalTermStructure_; }
+ Here is the caller graph for this function:

◆ type() [1/2]

const Type & type ( ) const

Definition at line 63 of file inflationcurveconfig.hpp.

63{ return type_; }
+ Here is the caller graph for this function:

◆ conventions() [1/2]

const string & conventions ( ) const

Definition at line 64 of file inflationcurveconfig.hpp.

64{ return conventions_; }

◆ extrapolate() [1/2]

const bool & extrapolate ( ) const

Definition at line 65 of file inflationcurveconfig.hpp.

65{ return extrapolate_; }

◆ calendar() [1/2]

const Calendar & calendar ( ) const

Definition at line 66 of file inflationcurveconfig.hpp.

66{ return calendar_; }

◆ dayCounter() [1/2]

const DayCounter & dayCounter ( ) const

Definition at line 67 of file inflationcurveconfig.hpp.

67{ return dayCounter_; }

◆ lag() [1/2]

const Period & lag ( ) const

Definition at line 68 of file inflationcurveconfig.hpp.

68{ return lag_; }
+ Here is the caller graph for this function:

◆ frequency() [1/2]

const Frequency & frequency ( ) const

Definition at line 69 of file inflationcurveconfig.hpp.

69{ return frequency_; }

◆ baseRate() [1/2]

const Real & baseRate ( ) const

Definition at line 70 of file inflationcurveconfig.hpp.

70{ return baseRate_; }

◆ tolerance() [1/2]

const Real & tolerance ( ) const

Definition at line 71 of file inflationcurveconfig.hpp.

71{ return tolerance_; }

◆ useLastAvailableFixingAsBaseDate() [1/2]

const bool & useLastAvailableFixingAsBaseDate ( ) const

Definition at line 72 of file inflationcurveconfig.hpp.

◆ seasonalityBaseDate() [1/2]

const Date & seasonalityBaseDate ( ) const

Definition at line 73 of file inflationcurveconfig.hpp.

73{ return seasonalityBaseDate_; }

◆ seasonalityFrequency() [1/2]

const Frequency & seasonalityFrequency ( ) const

Definition at line 74 of file inflationcurveconfig.hpp.

74{ return seasonalityFrequency_; }

◆ seasonalityFactors() [1/2]

const vector< string > & seasonalityFactors ( ) const

Definition at line 75 of file inflationcurveconfig.hpp.

75{ return seasonalityFactors_; }
+ Here is the caller graph for this function:

◆ overrideSeasonalityFactors() [1/2]

const vector< double > & overrideSeasonalityFactors ( ) const

Definition at line 76 of file inflationcurveconfig.hpp.

◆ swapQuotes()

const vector< string > & swapQuotes ( )

Definition at line 77 of file inflationcurveconfig.hpp.

77{ return swapQuotes_; }
+ Here is the caller graph for this function:

◆ nominalTermStructure() [2/2]

string & nominalTermStructure ( )

Definition at line 80 of file inflationcurveconfig.hpp.

80{ return nominalTermStructure_; }

◆ type() [2/2]

Type & type ( )

Definition at line 81 of file inflationcurveconfig.hpp.

81{ return type_; }

◆ conventions() [2/2]

string & conventions ( )

Definition at line 82 of file inflationcurveconfig.hpp.

82{ return conventions_; }

◆ extrapolate() [2/2]

bool & extrapolate ( )

Definition at line 83 of file inflationcurveconfig.hpp.

83{ return extrapolate_; }

◆ calendar() [2/2]

Calendar & calendar ( )

Definition at line 84 of file inflationcurveconfig.hpp.

84{ return calendar_; }

◆ dayCounter() [2/2]

DayCounter & dayCounter ( )

Definition at line 85 of file inflationcurveconfig.hpp.

85{ return dayCounter_; }

◆ lag() [2/2]

Period & lag ( )

Definition at line 86 of file inflationcurveconfig.hpp.

86{ return lag_; }

◆ frequency() [2/2]

Frequency & frequency ( )

Definition at line 87 of file inflationcurveconfig.hpp.

87{ return frequency_; }

◆ baseRate() [2/2]

Real & baseRate ( )

Definition at line 88 of file inflationcurveconfig.hpp.

88{ return baseRate_; }

◆ tolerance() [2/2]

Real & tolerance ( )

Definition at line 89 of file inflationcurveconfig.hpp.

89{ return tolerance_; }

◆ useLastAvailableFixingAsBaseDate() [2/2]

bool & useLastAvailableFixingAsBaseDate ( )

Definition at line 90 of file inflationcurveconfig.hpp.

◆ seasonalityBaseDate() [2/2]

Date & seasonalityBaseDate ( )

Definition at line 91 of file inflationcurveconfig.hpp.

91{ return seasonalityBaseDate_; }

◆ seasonalityFrequency() [2/2]

Frequency & seasonalityFrequency ( )

Definition at line 92 of file inflationcurveconfig.hpp.

92{ return seasonalityFrequency_; }

◆ seasonalityFactors() [2/2]

vector< string > & seasonalityFactors ( )

Definition at line 93 of file inflationcurveconfig.hpp.

93{ return seasonalityFactors_; }

◆ overrideSeasonalityFactors() [2/2]

vector< double > & overrideSeasonalityFactors ( )

Definition at line 94 of file inflationcurveconfig.hpp.

◆ populateRequiredCurveIds()

void populateRequiredCurveIds ( )
private

Definition at line 49 of file inflationcurveconfig.cpp.

49 {
50 if (!nominalTermStructure().empty())
52}
map< CurveSpec::CurveType, set< string > > requiredCurveIds_
Definition: curveconfig.hpp:75
QuantLib::ext::shared_ptr< CurveSpec > parseCurveSpec(const string &s)
function to convert a string into a curve spec
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ swapQuotes_

vector<string> swapQuotes_
private

Definition at line 99 of file inflationcurveconfig.hpp.

◆ nominalTermStructure_

string nominalTermStructure_
private

Definition at line 100 of file inflationcurveconfig.hpp.

◆ type_

Type type_
private

Definition at line 101 of file inflationcurveconfig.hpp.

◆ conventions_

string conventions_
private

Definition at line 102 of file inflationcurveconfig.hpp.

◆ interpolationMethod_

string interpolationMethod_
private

Definition at line 103 of file inflationcurveconfig.hpp.

◆ extrapolate_

bool extrapolate_
private

Definition at line 104 of file inflationcurveconfig.hpp.

◆ calendar_

Calendar calendar_
private

Definition at line 105 of file inflationcurveconfig.hpp.

◆ dayCounter_

DayCounter dayCounter_
private

Definition at line 106 of file inflationcurveconfig.hpp.

◆ lag_

Period lag_
private

Definition at line 107 of file inflationcurveconfig.hpp.

◆ frequency_

Frequency frequency_
private

Definition at line 108 of file inflationcurveconfig.hpp.

◆ baseRate_

Real baseRate_
private

Definition at line 109 of file inflationcurveconfig.hpp.

◆ tolerance_

Real tolerance_
private

Definition at line 110 of file inflationcurveconfig.hpp.

◆ useLastAvailableFixingAsBaseDate_

bool useLastAvailableFixingAsBaseDate_
private

Definition at line 111 of file inflationcurveconfig.hpp.

◆ seasonalityBaseDate_

Date seasonalityBaseDate_
private

Definition at line 112 of file inflationcurveconfig.hpp.

◆ seasonalityFrequency_

Frequency seasonalityFrequency_
private

Definition at line 113 of file inflationcurveconfig.hpp.

◆ seasonalityFactors_

vector<string> seasonalityFactors_
private

Definition at line 114 of file inflationcurveconfig.hpp.

◆ overrideSeasonalityFactors_

vector<double> overrideSeasonalityFactors_
private

Definition at line 115 of file inflationcurveconfig.hpp.