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

Serializable Equity Option Position Data. More...

#include <ored/portfolio/equityoptionposition.hpp>

+ Inheritance diagram for EquityOptionPositionData:
+ Collaboration diagram for EquityOptionPositionData:

Public Member Functions

 EquityOptionPositionData ()
 
 EquityOptionPositionData (const Real quantity, const std::vector< EquityOptionUnderlyingData > &underlyings)
 
Real quantity () const
 
const std::vector< EquityOptionUnderlyingData > & 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< EquityOptionUnderlyingDataunderlyings_
 

Detailed Description

Serializable Equity Option Position Data.

Definition at line 59 of file equityoptionposition.hpp.

Constructor & Destructor Documentation

◆ EquityOptionPositionData() [1/2]

Definition at line 61 of file equityoptionposition.hpp.

61{}

◆ EquityOptionPositionData() [2/2]

EquityOptionPositionData ( const Real  quantity,
const std::vector< EquityOptionUnderlyingData > &  underlyings 
)

Definition at line 62 of file equityoptionposition.hpp.

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

Member Function Documentation

◆ quantity()

Real quantity ( ) const

Definition at line 65 of file equityoptionposition.hpp.

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

◆ underlyings()

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

Definition at line 66 of file equityoptionposition.hpp.

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

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 47 of file equityoptionposition.cpp.

47 {
48 XMLUtils::checkNode(node, "EquityOptionPositionData");
49 quantity_ = XMLUtils::getChildValueAsDouble(node, "Quantity", true);
50 auto c = XMLUtils::getChildrenNodes(node, "Underlying");
51 underlyings_.clear();
52 for (auto const n : c) {
53 underlyings_.push_back(EquityOptionUnderlyingData());
54 underlyings_.back().fromXML(n);
55 }
56}
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 58 of file equityoptionposition.cpp.

58 {
59 XMLNode* n = doc.allocNode("EquityOptionPositionData");
60 XMLUtils::addChild(doc, n, "Quantity", quantity_);
61 for (auto& u : underlyings_) {
62 XMLUtils::appendNode(n, u.toXML(doc));
63 }
64 return n;
65}
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 72 of file equityoptionposition.hpp.

◆ underlyings_

std::vector<EquityOptionUnderlyingData> underlyings_
private

Definition at line 73 of file equityoptionposition.hpp.