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

#include <ored/portfolio/underlying.hpp>

+ Inheritance diagram for BondUnderlying:
+ Collaboration diagram for BondUnderlying:

Public Member Functions

 BondUnderlying ()
 Default constructor. More...
 
 BondUnderlying (const std::string &name)
 Constructor with full bond name (e.g. ISIN:DE00001142867) More...
 
 BondUnderlying (const std::string &identifier, const std::string &identifierType, const QuantLib::Real weight)
 Constructor with identifer infomation (e.g. identifier = DE00001142867, identifierType = ISIN) More...
 
const std::string & name () const override
 
const std::string & identifierType () const
 
double bidAskAdjustment () const
 
void setBondName ()
 set name of bond More...
 
- Public Member Functions inherited from Underlying
 Underlying ()
 Default Constructor. More...
 
 Underlying (const std::string &type, const std::string &name, const QuantLib::Real weight=QuantLib::Null< QuantLib::Real >())
 Constructor with type, name, weight. More...
 
void setType (const string &type)
 
void setName (const string &name)
 
void setWeight (const QuantLib::Real weight)
 
void setNodeName (const string &nodeName)
 
void setBasicUnderlyingNodeName (const string &basicUnderlyingNodeName)
 
const std::string & type () const
 
Real weight () 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

std::string bondName_
 
std::string identifierType_
 
double bidAskAdjustment_ = 0.0
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 

Additional Inherited Members

- Protected Attributes inherited from Underlying
std::string type_
 
std::string name_
 
Real weight_ = QuantLib::Null<QuantLib::Real>()
 
std::string nodeName_
 
std::string basicUnderlyingNodeName_
 
bool isBasic_ = false
 

Detailed Description

Definition at line 228 of file underlying.hpp.

Constructor & Destructor Documentation

◆ BondUnderlying() [1/3]

Default constructor.

Definition at line 231 of file underlying.hpp.

231: Underlying() { setType("Bond"); }
Underlying()
Default Constructor.
Definition: underlying.hpp:40
void setType(const string &type)
Definition: underlying.hpp:53
+ Here is the call graph for this function:

◆ BondUnderlying() [2/3]

BondUnderlying ( const std::string &  name)
explicit

Constructor with full bond name (e.g. ISIN:DE00001142867)

Definition at line 234 of file underlying.hpp.

234: Underlying("Bond", name) { isBasic_ = true; };
const std::string & name() const override
Definition: underlying.hpp:240

◆ BondUnderlying() [3/3]

BondUnderlying ( const std::string &  identifier,
const std::string &  identifierType,
const QuantLib::Real  weight 
)

Constructor with identifer infomation (e.g. identifier = DE00001142867, identifierType = ISIN)

Definition at line 237 of file underlying.hpp.

238 : Underlying("Bond", identifier, weight), identifierType_(identifierType){};
const std::string & identifierType() const
Definition: underlying.hpp:241
Real weight() const
Definition: underlying.hpp:65

Member Function Documentation

◆ name()

const std::string & name ( ) const
overridevirtual

Reimplemented from Underlying.

Definition at line 240 of file underlying.hpp.

240{ return bondName_.empty() ? name_ : bondName_; };

◆ identifierType()

const std::string & identifierType ( ) const

Definition at line 241 of file underlying.hpp.

241{ return identifierType_; }

◆ bidAskAdjustment()

double bidAskAdjustment ( ) const

Definition at line 242 of file underlying.hpp.

242{ return bidAskAdjustment_; }

◆ setBondName()

void setBondName ( )

set name of bond

Definition at line 267 of file underlying.cpp.

267 {
268 if (bondName_.empty()) {
269 if (!identifierType_.empty())
271 else
273 }
274}
+ Here is the caller graph for this function:

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Reimplemented from Underlying.

Definition at line 276 of file underlying.cpp.

276 {
279 isBasic_ = true;
280 } else if (XMLUtils::getNodeName(node) == nodeName_) {
282 QL_REQUIRE(type_ == "Bond", "Underlying must be of type 'Bond'.");
283 identifierType_ = XMLUtils::getChildValue(node, "IdentifierType", false);
284 setBondName();
285 isBasic_ = false;
286 } else {
287 QL_FAIL("Need either a " << basicUnderlyingNodeName_ << " or " << nodeName_ << " for BondUnderlying.");
288 }
289 bidAskAdjustment_ = XMLUtils::getChildValueAsDouble(node, "BidAskAdjustment", false, 0.0);
290 setType("Bond");
291}
void setBondName()
set name of bond
Definition: underlying.cpp:267
std::string basicUnderlyingNodeName_
Definition: underlying.hpp:71
std::string nodeName_
Definition: underlying.hpp:71
virtual void fromXML(ore::data::XMLNode *node) override
Definition: underlying.cpp:33
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
Definition: xmlutils.cpp:286
static string getNodeName(XMLNode *n)
Get and set a node's name.
Definition: xmlutils.cpp:473
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static string getNodeValue(XMLNode *node)
Get a node's value.
Definition: xmlutils.cpp:489
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Reimplemented from Underlying.

Definition at line 293 of file underlying.cpp.

293 {
294 XMLNode* node;
295 if (isBasic_) {
296 node = doc.allocNode(basicUnderlyingNodeName_, name_);
297 } else {
298 node = Underlying::toXML(doc);
299 if (!identifierType_.empty())
300 XMLUtils::addChild(doc, node, "IdentifierType", identifierType_);
301 }
302 return node;
303}
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
Definition: underlying.cpp:42
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:

Member Data Documentation

◆ bondName_

std::string bondName_
private

Definition at line 254 of file underlying.hpp.

◆ identifierType_

std::string identifierType_
private

Definition at line 254 of file underlying.hpp.

◆ bidAskAdjustment_

double bidAskAdjustment_ = 0.0
private

Definition at line 255 of file underlying.hpp.