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

Container for storing Bond Spread Rate conventions. More...

#include <ored/configuration/conventions.hpp>

+ Inheritance diagram for SecuritySpreadConvention:
+ Collaboration diagram for SecuritySpreadConvention:

Public Member Functions

Constructors
 SecuritySpreadConvention ()
 Default constructor. More...
 
 SecuritySpreadConvention (const string &id, const string &dayCounter, const string &compounding, const string &compoundingFrequency)
 
 SecuritySpreadConvention (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 Bond Spread Rate conventions.

Definition at line 1148 of file conventions.hpp.

Constructor & Destructor Documentation

◆ SecuritySpreadConvention() [1/3]

Default constructor.

Definition at line 1153 of file conventions.hpp.

1153{}

◆ SecuritySpreadConvention() [2/3]

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

Definition at line 1337 of file conventions.cpp.

+ Here is the call graph for this function:

◆ SecuritySpreadConvention() [3/3]

SecuritySpreadConvention ( 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 1344 of file conventions.cpp.

1352 build();
1353}
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 1165 of file conventions.hpp.

1165{ return dayCounter_; }

◆ tenorCalendar()

const Calendar & tenorCalendar ( ) const

Return the calendar used for converting tenor points into dates.

Definition at line 1167 of file conventions.hpp.

◆ compounding()

Compounding compounding ( ) const

Zero rate compounding.

Definition at line 1169 of file conventions.hpp.

1169{ return compounding_; }

◆ compoundingFrequency()

Frequency compoundingFrequency ( ) const

Zero rate compounding frequency.

Definition at line 1171 of file conventions.hpp.

◆ spotLag()

Natural spotLag ( ) const

Zero rate spot lag.

Definition at line 1173 of file conventions.hpp.

◆ spotCalendar()

const Calendar & spotCalendar ( ) const

Calendar used for spot date adjustment.

Definition at line 1175 of file conventions.hpp.

◆ rollConvention()

BusinessDayConvention rollConvention ( ) const

Business day convention used in converting tenor points into dates.

Definition at line 1177 of file conventions.hpp.

1177{ return rollConvention_; }
BusinessDayConvention rollConvention_

◆ eom()

bool eom ( )

End of month adjustment.

Definition at line 1179 of file conventions.hpp.

◆ tenorBased()

bool tenorBased ( )

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

Definition at line 1181 of file conventions.hpp.

1181{ return tenorBased_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 1368 of file conventions.cpp.

1368 {
1369
1370 XMLUtils::checkNode(node, "BondSpread");
1372 id_ = XMLUtils::getChildValue(node, "Id", true);
1373 tenorBased_ = XMLUtils::getChildValueAsBool(node, "TenorBased", true);
1374
1375 // Get string values from xml
1376 strDayCounter_ = XMLUtils::getChildValue(node, "DayCounter", true);
1377 strCompoundingFrequency_ = XMLUtils::getChildValue(node, "CompoundingFrequency", false);
1378 strCompounding_ = XMLUtils::getChildValue(node, "Compounding", false);
1379 if (tenorBased_) {
1380 strTenorCalendar_ = XMLUtils::getChildValue(node, "TenorCalendar", true);
1381 strSpotLag_ = XMLUtils::getChildValue(node, "SpotLag", false);
1382 strSpotCalendar_ = XMLUtils::getChildValue(node, "SpotCalendar", false);
1383 strRollConvention_ = XMLUtils::getChildValue(node, "RollConvention", false);
1384 strEom_ = XMLUtils::getChildValue(node, "EOM", false);
1385 }
1386 build();
1387}
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 1389 of file conventions.cpp.

1389 {
1390
1391 XMLNode* node = doc.allocNode("BondSpread");
1392 XMLUtils::addChild(doc, node, "Id", id_);
1393 XMLUtils::addChild(doc, node, "TenorBased", tenorBased_);
1394 XMLUtils::addChild(doc, node, "DayCounter", strDayCounter_);
1395 if (!strCompoundingFrequency_.empty())
1396 XMLUtils::addChild(doc, node, "CompoundingFrequency", strCompoundingFrequency_);
1397 if (!strCompounding_.empty())
1398 XMLUtils::addChild(doc, node, "Compounding", strCompounding_);
1399 if (tenorBased_) {
1400 XMLUtils::addChild(doc, node, "TenorCalendar", strTenorCalendar_);
1401 if (!strSpotLag_.empty())
1402 XMLUtils::addChild(doc, node, "SpotLag", strSpotLag_);
1403 if (!strSpotCalendar_.empty())
1404 XMLUtils::addChild(doc, node, "SpotCalendar", strSpotCalendar_);
1405 if (!strRollConvention_.empty())
1406 XMLUtils::addChild(doc, node, "RollConvention", strRollConvention_);
1407 if (!strEom_.empty())
1408 XMLUtils::addChild(doc, node, "EOM", strEom_);
1409 }
1410
1411 return node;
1412}
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 1355 of file conventions.cpp.

1355 {
1359 if (tenorBased_) {
1361 spotLag_ = strSpotLag_.empty() ? 0 : lexical_cast<Natural>(strSpotLag_);
1362 spotCalendar_ = strSpotCalendar_.empty() ? NullCalendar() : parseCalendar(strSpotCalendar_);
1364 eom_ = strEom_.empty() ? false : parseBool(strEom_);
1365 }
1366}
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 1192 of file conventions.hpp.

◆ tenorCalendar_

Calendar tenorCalendar_
private

Definition at line 1193 of file conventions.hpp.

◆ compounding_

Compounding compounding_
private

Definition at line 1194 of file conventions.hpp.

◆ compoundingFrequency_

Frequency compoundingFrequency_
private

Definition at line 1195 of file conventions.hpp.

◆ spotLag_

Natural spotLag_
private

Definition at line 1196 of file conventions.hpp.

◆ spotCalendar_

Calendar spotCalendar_
private

Definition at line 1197 of file conventions.hpp.

◆ rollConvention_

BusinessDayConvention rollConvention_
private

Definition at line 1198 of file conventions.hpp.

◆ eom_

bool eom_
private

Definition at line 1199 of file conventions.hpp.

◆ tenorBased_

bool tenorBased_
private

Definition at line 1200 of file conventions.hpp.

◆ strDayCounter_

string strDayCounter_
private

Definition at line 1203 of file conventions.hpp.

◆ strTenorCalendar_

string strTenorCalendar_
private

Definition at line 1204 of file conventions.hpp.

◆ strCompounding_

string strCompounding_
private

Definition at line 1205 of file conventions.hpp.

◆ strCompoundingFrequency_

string strCompoundingFrequency_
private

Definition at line 1206 of file conventions.hpp.

◆ strSpotLag_

string strSpotLag_
private

Definition at line 1207 of file conventions.hpp.

◆ strSpotCalendar_

string strSpotCalendar_
private

Definition at line 1208 of file conventions.hpp.

◆ strRollConvention_

string strRollConvention_
private

Definition at line 1209 of file conventions.hpp.

◆ strEom_

string strEom_
private

Definition at line 1210 of file conventions.hpp.