Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
List of all members
ZeroRateConvention Class Reference

Container for storing Zero Rate conventions. More...

#include <ored/configuration/conventions.hpp>

+ Inheritance diagram for ZeroRateConvention:
+ Collaboration diagram for ZeroRateConvention:

Public Member Functions

Constructors
 ZeroRateConvention ()
 Default constructor. More...
 
 ZeroRateConvention (const string &id, const string &dayCounter, const string &compounding, const string &compoundingFrequency)
 
 ZeroRateConvention (const string &id, const string &dayCounter, const string &tenorCalendar, const string &compounding="Continuous", const string &compoundingFrequency="Annual", const string &spotLag="", const string &spotCalendar="", const string &rollConvention="", const string &eom="")
 
Inspectors
const DayCounter & dayCounter () const
 Zero rate day counter. More...
 
const Calendar & tenorCalendar () const
 Return the calendar used for converting tenor points into dates. More...
 
Compounding compounding () const
 Zero rate compounding. More...
 
Frequency compoundingFrequency () const
 Zero rate compounding frequency. More...
 
Natural spotLag () const
 Zero rate spot lag. More...
 
const Calendar & spotCalendar () const
 Calendar used for spot date adjustment. More...
 
BusinessDayConvention rollConvention () const
 Business day convention used in converting tenor points into dates. More...
 
bool eom ()
 End of month adjustment. More...
 
bool tenorBased ()
 Flag to indicate whether the Zero Rate convention is based on a tenor input. More...
 
- 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...
 

Serialisation

DayCounter dayCounter_
 
Calendar tenorCalendar_
 
Compounding compounding_
 
Frequency compoundingFrequency_
 
Natural spotLag_
 
Calendar spotCalendar_
 
BusinessDayConvention rollConvention_
 
bool eom_
 
bool tenorBased_
 
string strDayCounter_
 
string strTenorCalendar_
 
string strCompounding_
 
string strCompoundingFrequency_
 
string strSpotLag_
 
string strSpotCalendar_
 
string strRollConvention_
 
string strEom_
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
virtual void build () override
 

Additional Inherited Members

- 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...
 
- Protected Member Functions inherited from Convention
 Convention ()
 
 Convention (const string &id, Type type)
 
- Protected Attributes inherited from Convention
Type type_
 
string id_
 

Detailed Description

Container for storing Zero Rate conventions.

Definition at line 183 of file conventions.hpp.

Constructor & Destructor Documentation

◆ ZeroRateConvention() [1/3]

Default constructor.

Definition at line 188 of file conventions.hpp.

188{}

◆ ZeroRateConvention() [2/3]

ZeroRateConvention ( const string &  id,
const string &  dayCounter,
const string &  compounding,
const string &  compoundingFrequency 
)

Definition at line 98 of file conventions.cpp.

102 build();
103}
const DayCounter & dayCounter() const
Zero rate day counter.
Compounding compounding() const
Zero rate compounding.
Frequency compoundingFrequency() const
Zero rate compounding frequency.
virtual void build() override
+ Here is the call graph for this function:

◆ ZeroRateConvention() [3/3]

ZeroRateConvention ( const string &  id,
const string &  dayCounter,
const string &  tenorCalendar,
const string &  compounding = "Continuous",
const string &  compoundingFrequency = "Annual",
const string &  spotLag = "",
const string &  spotCalendar = "",
const string &  rollConvention = "",
const string &  eom = "" 
)

Definition at line 105 of file conventions.cpp.

112 build();
113}
const Calendar & spotCalendar() const
Calendar used for spot date adjustment.
const Calendar & tenorCalendar() const
Return the calendar used for converting tenor points into dates.
bool eom()
End of month adjustment.
Natural spotLag() const
Zero rate spot lag.
BusinessDayConvention rollConvention() const
Business day convention used in converting tenor points into dates.
+ Here is the call graph for this function:

Member Function Documentation

◆ dayCounter()

const DayCounter & dayCounter ( ) const

Zero rate day counter.

Definition at line 200 of file conventions.hpp.

200{ return dayCounter_; }

◆ tenorCalendar()

const Calendar & tenorCalendar ( ) const

Return the calendar used for converting tenor points into dates.

Definition at line 202 of file conventions.hpp.

202{ return tenorCalendar_; }

◆ compounding()

Compounding compounding ( ) const

Zero rate compounding.

Definition at line 204 of file conventions.hpp.

204{ return compounding_; }

◆ compoundingFrequency()

Frequency compoundingFrequency ( ) const

Zero rate compounding frequency.

Definition at line 206 of file conventions.hpp.

◆ spotLag()

Natural spotLag ( ) const

Zero rate spot lag.

Definition at line 208 of file conventions.hpp.

208{ return spotLag_; }

◆ spotCalendar()

const Calendar & spotCalendar ( ) const

Calendar used for spot date adjustment.

Definition at line 210 of file conventions.hpp.

210{ return spotCalendar_; }

◆ rollConvention()

BusinessDayConvention rollConvention ( ) const

Business day convention used in converting tenor points into dates.

Definition at line 212 of file conventions.hpp.

212{ return rollConvention_; }
BusinessDayConvention rollConvention_

◆ eom()

bool eom ( )

End of month adjustment.

Definition at line 214 of file conventions.hpp.

214{ return eom_; }

◆ tenorBased()

bool tenorBased ( )

Flag to indicate whether the Zero Rate convention is based on a tenor input.

Definition at line 216 of file conventions.hpp.

216{ return tenorBased_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 128 of file conventions.cpp.

128 {
129
130 XMLUtils::checkNode(node, "Zero");
132 id_ = XMLUtils::getChildValue(node, "Id", true);
133 tenorBased_ = XMLUtils::getChildValueAsBool(node, "TenorBased", true);
134
135 // Get string values from xml
136 strDayCounter_ = XMLUtils::getChildValue(node, "DayCounter", true);
137 strCompoundingFrequency_ = XMLUtils::getChildValue(node, "CompoundingFrequency", false);
138 strCompounding_ = XMLUtils::getChildValue(node, "Compounding", false);
139 if (tenorBased_) {
140 strTenorCalendar_ = XMLUtils::getChildValue(node, "TenorCalendar", true);
141 strSpotLag_ = XMLUtils::getChildValue(node, "SpotLag", false);
142 strSpotCalendar_ = XMLUtils::getChildValue(node, "SpotCalendar", false);
143 strRollConvention_ = XMLUtils::getChildValue(node, "RollConvention", false);
144 strEom_ = XMLUtils::getChildValue(node, "EOM", false);
145 }
146 build();
147}
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
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 149 of file conventions.cpp.

149 {
150
151 XMLNode* node = doc.allocNode("Zero");
152 XMLUtils::addChild(doc, node, "Id", id_);
153 XMLUtils::addChild(doc, node, "TenorBased", tenorBased_);
154 XMLUtils::addChild(doc, node, "DayCounter", strDayCounter_);
155 XMLUtils::addChild(doc, node, "CompoundingFrequency", strCompoundingFrequency_);
156 XMLUtils::addChild(doc, node, "Compounding", strCompounding_);
157 if (tenorBased_) {
158 XMLUtils::addChild(doc, node, "TenorCalendar", strTenorCalendar_);
159 XMLUtils::addChild(doc, node, "SpotLag", strSpotLag_);
160 XMLUtils::addChild(doc, node, "SpotCalendar", strSpotCalendar_);
161 XMLUtils::addChild(doc, node, "RollConvention", strRollConvention_);
162 XMLUtils::addChild(doc, node, "EOM", strEom_);
163 }
164
165 return node;
166}
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ build()

void build ( )
overridevirtual

Implements Convention.

Definition at line 115 of file conventions.cpp.

115 {
119 if (tenorBased_) {
121 spotLag_ = strSpotLag_.empty() ? 0 : lexical_cast<Natural>(strSpotLag_);
122 spotCalendar_ = strSpotCalendar_.empty() ? NullCalendar() : parseCalendar(strSpotCalendar_);
124 eom_ = strEom_.empty() ? false : parseBool(strEom_);
125 }
126}
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
Frequency parseFrequency(const string &s)
Convert text to QuantLib::Frequency.
Definition: parsers.cpp:348
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
Compounding parseCompounding(const string &s)
Convert text to QuantLib::Compounding;.
Definition: parsers.cpp:376
DayCounter parseDayCounter(const string &s)
Convert text to QuantLib::DayCounter.
Definition: parsers.cpp:209
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ dayCounter_

DayCounter dayCounter_
private

Definition at line 227 of file conventions.hpp.

◆ tenorCalendar_

Calendar tenorCalendar_
private

Definition at line 228 of file conventions.hpp.

◆ compounding_

Compounding compounding_
private

Definition at line 229 of file conventions.hpp.

◆ compoundingFrequency_

Frequency compoundingFrequency_
private

Definition at line 230 of file conventions.hpp.

◆ spotLag_

Natural spotLag_
private

Definition at line 231 of file conventions.hpp.

◆ spotCalendar_

Calendar spotCalendar_
private

Definition at line 232 of file conventions.hpp.

◆ rollConvention_

BusinessDayConvention rollConvention_
private

Definition at line 233 of file conventions.hpp.

◆ eom_

bool eom_
private

Definition at line 234 of file conventions.hpp.

◆ tenorBased_

bool tenorBased_
private

Definition at line 235 of file conventions.hpp.

◆ strDayCounter_

string strDayCounter_
private

Definition at line 238 of file conventions.hpp.

◆ strTenorCalendar_

string strTenorCalendar_
private

Definition at line 239 of file conventions.hpp.

◆ strCompounding_

string strCompounding_
private

Definition at line 240 of file conventions.hpp.

◆ strCompoundingFrequency_

string strCompoundingFrequency_
private

Definition at line 241 of file conventions.hpp.

◆ strSpotLag_

string strSpotLag_
private

Definition at line 242 of file conventions.hpp.

◆ strSpotCalendar_

string strSpotCalendar_
private

Definition at line 243 of file conventions.hpp.

◆ strRollConvention_

string strRollConvention_
private

Definition at line 244 of file conventions.hpp.

◆ strEom_

string strEom_
private

Definition at line 245 of file conventions.hpp.