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

#include <ored/portfolio/convertiblebonddata.hpp>

+ Inheritance diagram for ConvertibleBondData:
+ Collaboration diagram for ConvertibleBondData:

Classes

class  CallabilityData
 
class  ConversionData
 
class  DividendProtectionData
 

Public Member Functions

 ConvertibleBondData ()
 
 ConvertibleBondData (const ore::data::BondData &bondData)
 
const ore::data::BondDatabondData () const
 
const CallabilityDatacallData () const
 
const CallabilityDataputData () const
 
const ConversionDataconversionData () const
 
ConversionDatamodifyConversionData ()
 
const DividendProtectionDatadividendProtectionData () const
 
std::string detachable () const
 
void fromXML (ore::data::XMLNode *node) override
 
ore::data::XMLNodetoXML (ore::data::XMLDocument &doc) const override
 
void populateFromBondReferenceData (const QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > &referenceData)
 
- 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

ore::data::BondData bondData_
 
CallabilityData callData_ = CallabilityData("CallData")
 
CallabilityData putData_ = CallabilityData("PutData")
 
ConversionData conversionData_
 
DividendProtectionData dividendProtectionData_
 
std::string detachable_
 

Detailed Description

Definition at line 36 of file convertiblebonddata.hpp.

Constructor & Destructor Documentation

◆ ConvertibleBondData() [1/2]

Definition at line 373 of file convertiblebonddata.hpp.

373{}

◆ ConvertibleBondData() [2/2]

ConvertibleBondData ( const ore::data::BondData bondData)
explicit

Definition at line 374 of file convertiblebonddata.hpp.

const ore::data::BondData & bondData() const

Member Function Documentation

◆ bondData()

const ore::data::BondData & bondData ( ) const

Definition at line 376 of file convertiblebonddata.hpp.

376{ return bondData_; }
+ Here is the caller graph for this function:

◆ callData()

const CallabilityData & callData ( ) const

Definition at line 378 of file convertiblebonddata.hpp.

378{ return callData_; }

◆ putData()

const CallabilityData & putData ( ) const

Definition at line 379 of file convertiblebonddata.hpp.

379{ return putData_; }

◆ conversionData()

const ConversionData & conversionData ( ) const

Definition at line 380 of file convertiblebonddata.hpp.

380{ return conversionData_; }

◆ modifyConversionData()

ConversionData & modifyConversionData ( )

Definition at line 381 of file convertiblebonddata.hpp.

381{ return conversionData_; }

◆ dividendProtectionData()

const DividendProtectionData & dividendProtectionData ( ) const

Definition at line 382 of file convertiblebonddata.hpp.

382{ return dividendProtectionData_; }
DividendProtectionData dividendProtectionData_

◆ detachable()

std::string detachable ( ) const

Definition at line 383 of file convertiblebonddata.hpp.

◆ fromXML()

void fromXML ( ore::data::XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 333 of file convertiblebonddata.cpp.

333 {
334 XMLUtils::checkNode(node, "ConvertibleBondData");
335 bondData_.fromXML(XMLUtils::getChildNode(node, "BondData"));
336 if (auto tmp = XMLUtils::getChildNode(node, "CallData")) {
337 if (!XMLUtils::getChildrenNodes(tmp, "").empty()) {
338 callData_.fromXML(tmp);
339 }
340 }
341 if (auto tmp = XMLUtils::getChildNode(node, "PutData")) {
342 if (!XMLUtils::getChildrenNodes(tmp, "").empty())
343 putData_.fromXML(tmp);
344 }
345 if (auto tmp = XMLUtils::getChildNode(node, "ConversionData")) {
346 if (!XMLUtils::getChildrenNodes(tmp, "").empty())
348 }
349 if (auto tmp = XMLUtils::getChildNode(node, "DividendProtectionData")) {
350 if (!XMLUtils::getChildrenNodes(tmp, "").empty())
352 }
353 detachable_ = XMLUtils::getChildValue(node, "Detachable");
354}
virtual void fromXML(XMLNode *node) override
XMLSerializable interface.
Definition: bond.cpp:59
void fromXML(ore::data::XMLNode *node) override
void fromXML(ore::data::XMLNode *node) override
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
Definition: xmlutils.cpp:428
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
+ 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 356 of file convertiblebonddata.cpp.

356 {
357 XMLNode* node = doc.allocNode("ConvertibleBondData");
361 if (putData_.initialised())
367 if (!detachable_.empty())
368 XMLUtils::addChild(doc, node, "Detachable", detachable_);
369 return node;
370}
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: bond.cpp:95
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
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
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateFromBondReferenceData()

void populateFromBondReferenceData ( const QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > &  referenceData)

Definition at line 372 of file convertiblebonddata.cpp.

373 {
374
375 QL_REQUIRE(!bondData_.securityId().empty(),
376 "ConvertibleBondData::populateFromBondReferenceData(): no security id given");
377 if (!referenceData || !referenceData->hasData(ConvertibleBondReferenceDatum::TYPE, bondData_.securityId())) {
378 DLOG("could not get ConvertibleBondReferenceDatum for name " << bondData_.securityId()
379 << " leave data in trade unchanged");
380 } else {
381 auto bondRefData = QuantLib::ext::dynamic_pointer_cast<ConvertibleBondReferenceDatum>(
382 referenceData->getData(ConvertibleBondReferenceDatum::TYPE, bondData_.securityId()));
383 QL_REQUIRE(bondRefData, "could not cast to ConvertibleBondReferenceDatum, this is unexpected");
384 DLOG("Got ConvertibleBondReferenceDatum for name " << bondData_.securityId()
385 << " overwrite empty elements in trade");
387 QuantLib::ext::make_shared<BondReferenceDatum>(bondData_.securityId(), bondRefData->bondData()));
388 if (!callData_.initialised()) {
389 DLOG("overwrite CallData from reference data")
390 callData_ = bondRefData->callData();
391 }
392 if (!putData_.initialised()) {
393 DLOG("overwrite PutData from reference data")
394 putData_ = bondRefData->putData();
395 }
396 if (!conversionData_.initialised()) {
397 DLOG("overwrite ConversionData from reference data")
398 conversionData_ = bondRefData->conversionData();
399 }
400 if (!dividendProtectionData_.initialised()) {
401 DLOG("overwrite DividendProtectionData from reference data")
403 }
404 if (detachable_.empty()) {
405 DLOG("overwrite detachable from reference data");
406 detachable_ = bondRefData->detachable();
407 }
408 }
409}
const string & securityId() const
Definition: bond.hpp:84
void populateFromBondReferenceData(const QuantLib::ext::shared_ptr< BondReferenceDatum > &referenceDatum, const std::string &startDate="", const std::string &endDate="")
populate data from reference datum and check data for completeness
Definition: bond.cpp:175
const CallabilityData & putData() const
const CallabilityData & callData() const
const DividendProtectionData & dividendProtectionData() const
const ConversionData & conversionData() const
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
+ Here is the call graph for this function:

Member Data Documentation

◆ bondData_

ore::data::BondData bondData_
private

Definition at line 391 of file convertiblebonddata.hpp.

◆ callData_

CallabilityData callData_ = CallabilityData("CallData")
private

Definition at line 392 of file convertiblebonddata.hpp.

◆ putData_

CallabilityData putData_ = CallabilityData("PutData")
private

Definition at line 393 of file convertiblebonddata.hpp.

◆ conversionData_

ConversionData conversionData_
private

Definition at line 394 of file convertiblebonddata.hpp.

◆ dividendProtectionData_

DividendProtectionData dividendProtectionData_
private

Definition at line 395 of file convertiblebonddata.hpp.

◆ detachable_

std::string detachable_
private

Definition at line 396 of file convertiblebonddata.hpp.