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

#include <ored/portfolio/referencedata.hpp>

+ Inheritance diagram for CreditIndexConstituent:
+ Collaboration diagram for CreditIndexConstituent:

Public Member Functions

 CreditIndexConstituent ()
 
 CreditIndexConstituent (const std::string &name, QuantLib::Real weight, QuantLib::Real priorWeight=QuantLib::Null< QuantLib::Real >(), QuantLib::Real recovery=QuantLib::Null< QuantLib::Real >(), const QuantLib::Date &auctionDate=QuantLib::Date(), const QuantLib::Date &auctionSettlementDate=QuantLib::Date(), const QuantLib::Date &defaultDate=QuantLib::Date(), const QuantLib::Date &eventDeterminationDate=QuantLib::Date())
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (ore::data::XMLDocument &doc) const override
 
const std::string & name () const
 
QuantLib::Real weight () const
 
QuantLib::Real priorWeight () const
 
QuantLib::Real recovery () const
 
const QuantLib::Date & auctionDate () const
 
const QuantLib::Date & auctionSettlementDate () const
 
const QuantLib::Date & defaultDate () const
 
const QuantLib::Date & eventDeterminationDate () 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

std::string name_
 
QuantLib::Real weight_
 
QuantLib::Real priorWeight_
 
QuantLib::Real recovery_
 
QuantLib::Date auctionDate_
 
QuantLib::Date auctionSettlementDate_
 
QuantLib::Date defaultDate_
 
QuantLib::Date eventDeterminationDate_
 

Detailed Description

Hold reference data on a constituent of a credit index.

Gives the name and the weight of the credit index constituent. A weight of zero indicates that there has been a credit event relating to the constituent. In this case, the weight of the constituent prior to the credit event is supplied along with the recovery rate, i.e. final auction price, default date, event determination date, auction date and auction cash settlement date. Not all of these fields are required by every engine in the event of default.

Definition at line 144 of file referencedata.hpp.

Constructor & Destructor Documentation

◆ CreditIndexConstituent() [1/2]

Definition at line 111 of file referencedata.cpp.

112 : weight_(Null<Real>()), priorWeight_(Null<Real>()), recovery_(Null<Real>()) {}

◆ CreditIndexConstituent() [2/2]

CreditIndexConstituent ( const std::string &  name,
QuantLib::Real  weight,
QuantLib::Real  priorWeight = QuantLib::Null< QuantLib::Real >(),
QuantLib::Real  recovery = QuantLib::Null< QuantLib::Real >(),
const QuantLib::Date &  auctionDate = QuantLib::Date(),
const QuantLib::Date &  auctionSettlementDate = QuantLib::Date(),
const QuantLib::Date &  defaultDate = QuantLib::Date(),
const QuantLib::Date &  eventDeterminationDate = QuantLib::Date() 
)

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 121 of file referencedata.cpp.

121 {
122
123 name_ = XMLUtils::getChildValue(node, "Name", true);
124 weight_ = XMLUtils::getChildValueAsDouble(node, "Weight", true);
125
126 if (close(weight_, 0.0)) {
127 priorWeight_ = Null<Real>();
128 if (auto n = XMLUtils::getChildNode(node, "PriorWeight"))
130
131 recovery_ = Null<Real>();
132 if (auto n = XMLUtils::getChildNode(node, "RecoveryRate"))
134
135 auctionDate_ = Date();
136 if (auto n = XMLUtils::getChildNode(node, "AuctionDate"))
138
139 auctionSettlementDate_ = Date();
140 if (auto n = XMLUtils::getChildNode(node, "AuctionSettlementDate"))
142
143 defaultDate_ = Date();
144 if (auto n = XMLUtils::getChildNode(node, "DefaultDate"))
146
148 if (auto n = XMLUtils::getChildNode(node, "EventDeterminationDate"))
150 }
151}
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
Definition: xmlutils.cpp:286
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
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

XMLNode * toXML ( ore::data::XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 153 of file referencedata.cpp.

153 {
154
155 XMLNode* node = doc.allocNode("Underlying");
156
157 XMLUtils::addChild(doc, node, "Name", name_);
158 XMLUtils::addChild(doc, node, "Weight", weight_);
159
160 if (close(weight_, 0.0)) {
161 if (priorWeight_ != Null<Real>())
162 XMLUtils::addChild(doc, node, "PriorWeight", priorWeight_);
163
164 if (recovery_ != Null<Real>())
165 XMLUtils::addChild(doc, node, "RecoveryRate", recovery_);
166
167 if (auctionDate_ != Date())
168 XMLUtils::addChild(doc, node, "AuctionDate", to_string(auctionDate_));
169
170 if (auctionSettlementDate_ != Date())
171 XMLUtils::addChild(doc, node, "AuctionSettlementDate", to_string(auctionSettlementDate_));
172
173 if (defaultDate_ != Date())
174 XMLUtils::addChild(doc, node, "DefaultDate", to_string(defaultDate_));
175
176 if (eventDeterminationDate_ != Date())
177 XMLUtils::addChild(doc, node, "EventDeterminationDate", to_string(eventDeterminationDate_));
178 }
179
180 return node;
181}
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ name()

const string & name ( ) const

Definition at line 183 of file referencedata.cpp.

183{ return name_; }
+ Here is the caller graph for this function:

◆ weight()

Real weight ( ) const

Definition at line 185 of file referencedata.cpp.

185{ return weight_; }

◆ priorWeight()

Real priorWeight ( ) const

Definition at line 187 of file referencedata.cpp.

187{ return priorWeight_; }

◆ recovery()

Real recovery ( ) const

Definition at line 189 of file referencedata.cpp.

189{ return recovery_; }

◆ auctionDate()

const Date & auctionDate ( ) const

Definition at line 191 of file referencedata.cpp.

191{ return auctionDate_; }

◆ auctionSettlementDate()

const Date & auctionSettlementDate ( ) const

Definition at line 193 of file referencedata.cpp.

193{ return auctionSettlementDate_; }

◆ defaultDate()

const Date & defaultDate ( ) const

Definition at line 195 of file referencedata.cpp.

195{ return defaultDate_; }

◆ eventDeterminationDate()

const Date & eventDeterminationDate ( ) const

Definition at line 197 of file referencedata.cpp.

197{ return eventDeterminationDate_; }

Member Data Documentation

◆ name_

std::string name_
private

Definition at line 170 of file referencedata.hpp.

◆ weight_

QuantLib::Real weight_
private

Definition at line 171 of file referencedata.hpp.

◆ priorWeight_

QuantLib::Real priorWeight_
private

Definition at line 172 of file referencedata.hpp.

◆ recovery_

QuantLib::Real recovery_
private

Definition at line 173 of file referencedata.hpp.

◆ auctionDate_

QuantLib::Date auctionDate_
private

Definition at line 174 of file referencedata.hpp.

◆ auctionSettlementDate_

QuantLib::Date auctionSettlementDate_
private

Definition at line 175 of file referencedata.hpp.

◆ defaultDate_

QuantLib::Date defaultDate_
private

Definition at line 176 of file referencedata.hpp.

◆ eventDeterminationDate_

QuantLib::Date eventDeterminationDate_
private

Definition at line 177 of file referencedata.hpp.