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

Serializable Equity Position Data. More...

#include <ored/portfolio/equityposition.hpp>

+ Inheritance diagram for EquityPositionData:
+ Collaboration diagram for EquityPositionData:

Public Member Functions

 EquityPositionData ()
 
 EquityPositionData (const Real quantity, const std::vector< EquityUnderlying > &underlyings)
 
Real quantity () const
 
const std::vector< EquityUnderlying > & underlyings () const
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
- 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

Real quantity_ = QuantLib::Null<Real>()
 
std::vector< EquityUnderlyingunderlyings_
 

Detailed Description

Serializable Equity Position Data.

Definition at line 34 of file equityposition.hpp.

Constructor & Destructor Documentation

◆ EquityPositionData() [1/2]

Definition at line 36 of file equityposition.hpp.

36{}

◆ EquityPositionData() [2/2]

EquityPositionData ( const Real  quantity,
const std::vector< EquityUnderlying > &  underlyings 
)

Definition at line 37 of file equityposition.hpp.

const std::vector< EquityUnderlying > & underlyings() const
std::vector< EquityUnderlying > underlyings_

Member Function Documentation

◆ quantity()

Real quantity ( ) const

Definition at line 40 of file equityposition.hpp.

40{ return quantity_; }
+ Here is the caller graph for this function:

◆ underlyings()

const std::vector< EquityUnderlying > & underlyings ( ) const

Definition at line 41 of file equityposition.hpp.

41{ return underlyings_; }
+ Here is the caller graph for this function:

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 28 of file equityposition.cpp.

28 {
29 XMLUtils::checkNode(node, "EquityPositionData");
30 quantity_ = XMLUtils::getChildValueAsDouble(node, "Quantity", true);
31 auto c = XMLUtils::getChildrenNodes(node, "Underlying");
32 underlyings_.clear();
33 for (auto const n : c) {
34 underlyings_.push_back(EquityUnderlying());
35 underlyings_.back().fromXML(n);
36 }
37}
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 Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
Definition: xmlutils.cpp:286
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 39 of file equityposition.cpp.

39 {
40 XMLNode* n = doc.allocNode("EquityPositionData");
41 XMLUtils::addChild(doc, n, "Quantity", quantity_);
42 for (auto& u : underlyings_) {
43 XMLUtils::appendNode(n, u.toXML(doc));
44 }
45 return n;
46}
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:

Member Data Documentation

◆ quantity_

Real quantity_ = QuantLib::Null<Real>()
private

Definition at line 47 of file equityposition.hpp.

◆ underlyings_

std::vector<EquityUnderlying> underlyings_
private

Definition at line 48 of file equityposition.hpp.