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

Serializable Equity Margin Leg Data. More...

#include <ored/portfolio/equityfxlegdata.hpp>

+ Inheritance diagram for EquityMarginLegData:
+ Collaboration diagram for EquityMarginLegData:

Public Member Functions

 EquityMarginLegData ()
 Default constructor. More...
 
 EquityMarginLegData (QuantLib::ext::shared_ptr< ore::data::EquityLegData > &equityLegData, const vector< double > &rates, const vector< string > &rateDates=vector< string >(), const double &initialMarginFactor=QuantExt::Null< double >(), const double &multiplier=QuantExt::Null< double >())
 Constructor. More...
 
Inspectors
const QuantLib::ext::shared_ptr< ore::data::EquityLegDataequityLegData ()
 
const vector< double > & rates () const
 
const vector< string > & rateDates () const
 
const double & initialMarginFactor () const
 
const double & multiplier () const
 
- Public Member Functions inherited from LegAdditionalData
 LegAdditionalData (const string &legType, const string &legNodeName)
 
 LegAdditionalData (const string &legType)
 
const string & legType () const
 
const string & legNodeName () const
 
const std::set< std::string > & indices () 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

QuantLib::ext::shared_ptr< ore::data::EquityLegDataequityLegData_
 
vector< double > rates_
 
vector< string > rateDates_
 
double initialMarginFactor_
 
double multiplier_
 
virtual void fromXML (ore::data::XMLNode *node) override
 
virtual ore::data::XMLNodetoXML (ore::data::XMLDocument &doc) const override
 

Additional Inherited Members

- Protected Attributes inherited from LegAdditionalData
std::set< std::string > indices_
 

Detailed Description

Serializable Equity Margin Leg Data.

Definition at line 38 of file equityfxlegdata.hpp.

Constructor & Destructor Documentation

◆ EquityMarginLegData() [1/2]

Default constructor.

Definition at line 41 of file equityfxlegdata.hpp.

41: ore::data::LegAdditionalData("EquityMargin") {}
Serializable Additional Leg Data.
Definition: legdata.hpp:63

◆ EquityMarginLegData() [2/2]

EquityMarginLegData ( QuantLib::ext::shared_ptr< ore::data::EquityLegData > &  equityLegData,
const vector< double > &  rates,
const vector< string > &  rateDates = vector<string>(),
const double &  initialMarginFactor = QuantExt::Null<double>(),
const double &  multiplier = QuantExt::Null<double>() 
)

Constructor.

Definition at line 43 of file equityfxlegdata.hpp.

const vector< double > & rates() const
QuantLib::ext::shared_ptr< ore::data::EquityLegData > equityLegData_
const QuantLib::ext::shared_ptr< ore::data::EquityLegData > equityLegData()
const double & initialMarginFactor() const
const double & multiplier() const
const vector< string > & rateDates() const

Member Function Documentation

◆ equityLegData()

const QuantLib::ext::shared_ptr< ore::data::EquityLegData > equityLegData ( )

Definition at line 51 of file equityfxlegdata.hpp.

51{ return equityLegData_; }

◆ rates()

const vector< double > & rates ( ) const

Definition at line 52 of file equityfxlegdata.hpp.

52{ return rates_; }

◆ rateDates()

const vector< string > & rateDates ( ) const

Definition at line 53 of file equityfxlegdata.hpp.

53{ return rateDates_; }

◆ initialMarginFactor()

const double & initialMarginFactor ( ) const

Definition at line 54 of file equityfxlegdata.hpp.

54{ return initialMarginFactor_; }

◆ multiplier()

const double & multiplier ( ) const

Definition at line 55 of file equityfxlegdata.hpp.

55{ return multiplier_; }

◆ fromXML()

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

Implements XMLSerializable.

Definition at line 52 of file equityfxlegdata.cpp.

52 {
54 rates_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Rates", "Rate", "startDate", rateDates_, parseReal,
55 true);
56 initialMarginFactor_ = XMLUtils::getChildValueAsDouble(node, "InitialMarginFactor", true);
57 multiplier_ = 1;
58 if (XMLUtils::getChildNode(node, "Multiplier"))
59 multiplier_ = XMLUtils::getChildValueAsDouble(node, "Multiplier");
60 XMLNode* equityNode = XMLUtils::getChildNode(node, "EquityLegData");
61 QL_REQUIRE(equityNode, "no equityLegData provided");
62
63 QuantLib::ext::shared_ptr<ore::data::EquityLegData> ld = QuantLib::ext::make_shared<EquityLegData>();
64 ld->fromXML(equityNode);
65 equityLegData_ = ld;
66
67}
const string & legNodeName() const
Definition: legdata.hpp:70
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
Definition: xmlutils.cpp:286
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
+ Here is the call graph for this function:

◆ toXML()

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

Implements XMLSerializable.

Definition at line 69 of file equityfxlegdata.cpp.

69 {
70 XMLNode* node = doc.allocNode(legNodeName());
71 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Rates", "Rate", rates_, "startDate", rateDates_);
72 XMLUtils::addChild(doc, node, "InitialMarginFactor", initialMarginFactor_);
73 XMLUtils::addChild(doc, node, "Multiplier", multiplier_);
74
75 XMLUtils::appendNode(node, equityLegData_->toXML(doc));
76 return node;
77}
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
static void addChildrenWithOptionalAttributes(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values, const string &attrName, const vector< string > &attrs)
Definition: xmlutils.cpp:542
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
+ Here is the call graph for this function:

Member Data Documentation

◆ equityLegData_

QuantLib::ext::shared_ptr<ore::data::EquityLegData> equityLegData_
private

Definition at line 65 of file equityfxlegdata.hpp.

◆ rates_

vector<double> rates_
private

Definition at line 66 of file equityfxlegdata.hpp.

◆ rateDates_

vector<string> rateDates_
private

Definition at line 67 of file equityfxlegdata.hpp.

◆ initialMarginFactor_

double initialMarginFactor_
private

Definition at line 68 of file equityfxlegdata.hpp.

◆ multiplier_

double multiplier_
private

Definition at line 69 of file equityfxlegdata.hpp.