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

#include <ored/portfolio/trs.hpp>

+ Inheritance diagram for TRS::ReturnData:
+ Collaboration diagram for TRS::ReturnData:

Public Member Functions

 ReturnData ()
 
 ReturnData (const bool payer, const std::string &currency, const ScheduleData &scheduleData, const std::string &observationLag, const std::string &observationConvention, const std::string &observationCalendar, const std::string &paymentLag, const std::string &paymentConvention, const std::string &paymentCalendar, const std::vector< std::string > &paymentDates, const Real initialPrice, const std::string &initialPriceCurrency, const std::vector< std::string > &fxTerms, const boost::optional< bool > payUnderlyingCashFlowsImmediately)
 
bool payer () const
 
const std::string & currency () const
 
const ScheduleDatascheduleData () const
 
const std::string & observationLag () const
 
const std::string & observationConvention () const
 
const std::string & observationCalendar () const
 
const std::string & paymentLag () const
 
const std::string & paymentConvention () const
 
const std::string & paymentCalendar () const
 
const std::vector< std::string > & paymentDates () const
 
Real initialPrice () const
 
const std::string & initialPriceCurrency () const
 
const std::vector< std::string > & fxTerms () const
 
boost::optional< boolpayUnderlyingCashFlowsImmediately () 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

bool payer_
 
std::string currency_
 
ScheduleData scheduleData_
 
std::string observationLag_
 
std::string observationConvention_
 
std::string observationCalendar_
 
std::string paymentLag_
 
std::string paymentConvention_
 
std::string paymentCalendar_
 
std::vector< std::string > paymentDates_
 
Real initialPrice_
 
std::string initialPriceCurrency_
 
std::vector< std::string > fxTerms_
 
boost::optional< boolpayUnderlyingCashFlowsImmediately_
 

Detailed Description

Definition at line 38 of file trs.hpp.

Constructor & Destructor Documentation

◆ ReturnData() [1/2]

Definition at line 40 of file trs.hpp.

40: payer_(false), initialPrice_(Null<Real>()), payUnderlyingCashFlowsImmediately_(false) {}
boost::optional< bool > payUnderlyingCashFlowsImmediately_
Definition: trs.hpp:82

◆ ReturnData() [2/2]

ReturnData ( const bool  payer,
const std::string &  currency,
const ScheduleData scheduleData,
const std::string &  observationLag,
const std::string &  observationConvention,
const std::string &  observationCalendar,
const std::string &  paymentLag,
const std::string &  paymentConvention,
const std::string &  paymentCalendar,
const std::vector< std::string > &  paymentDates,
const Real  initialPrice,
const std::string &  initialPriceCurrency,
const std::vector< std::string > &  fxTerms,
const boost::optional< bool payUnderlyingCashFlowsImmediately 
)

Definition at line 41 of file trs.hpp.

std::vector< std::string > fxTerms_
Definition: trs.hpp:81
std::string paymentLag_
Definition: trs.hpp:76
const std::vector< std::string > & paymentDates() const
Definition: trs.hpp:63
const std::string & currency() const
Definition: trs.hpp:55
const std::vector< std::string > & fxTerms() const
Definition: trs.hpp:66
std::string currency_
Definition: trs.hpp:74
const ScheduleData & scheduleData() const
Definition: trs.hpp:56
const std::string & initialPriceCurrency() const
Definition: trs.hpp:65
std::vector< std::string > paymentDates_
Definition: trs.hpp:78
boost::optional< bool > payUnderlyingCashFlowsImmediately() const
Definition: trs.hpp:67
const std::string & observationCalendar() const
Definition: trs.hpp:59
const std::string & paymentCalendar() const
Definition: trs.hpp:62
std::string initialPriceCurrency_
Definition: trs.hpp:80
const std::string & observationLag() const
Definition: trs.hpp:57
std::string observationLag_
Definition: trs.hpp:76
ScheduleData scheduleData_
Definition: trs.hpp:75
std::string paymentCalendar_
Definition: trs.hpp:77
const std::string & paymentLag() const
Definition: trs.hpp:60
std::string observationCalendar_
Definition: trs.hpp:76
const std::string & paymentConvention() const
Definition: trs.hpp:61
Real initialPrice() const
Definition: trs.hpp:64
std::string paymentConvention_
Definition: trs.hpp:76
bool payer() const
Definition: trs.hpp:54

Member Function Documentation

◆ payer()

bool payer ( ) const

Definition at line 54 of file trs.hpp.

54{ return payer_; }
+ Here is the caller graph for this function:

◆ currency()

const std::string & currency ( ) const

Definition at line 55 of file trs.hpp.

55{ return currency_; }
+ Here is the caller graph for this function:

◆ scheduleData()

const ScheduleData & scheduleData ( ) const

Definition at line 56 of file trs.hpp.

56{ return scheduleData_; }
+ Here is the caller graph for this function:

◆ observationLag()

const std::string & observationLag ( ) const

Definition at line 57 of file trs.hpp.

57{ return observationLag_; }
+ Here is the caller graph for this function:

◆ observationConvention()

const std::string & observationConvention ( ) const

Definition at line 58 of file trs.hpp.

58{ return observationConvention_; }
std::string observationConvention_
Definition: trs.hpp:76
+ Here is the caller graph for this function:

◆ observationCalendar()

const std::string & observationCalendar ( ) const

Definition at line 59 of file trs.hpp.

59{ return observationCalendar_; }
+ Here is the caller graph for this function:

◆ paymentLag()

const std::string & paymentLag ( ) const

Definition at line 60 of file trs.hpp.

60{ return paymentLag_; }
+ Here is the caller graph for this function:

◆ paymentConvention()

const std::string & paymentConvention ( ) const

Definition at line 61 of file trs.hpp.

61{ return paymentConvention_; }
+ Here is the caller graph for this function:

◆ paymentCalendar()

const std::string & paymentCalendar ( ) const

Definition at line 62 of file trs.hpp.

62{ return paymentCalendar_; }
+ Here is the caller graph for this function:

◆ paymentDates()

const std::vector< std::string > & paymentDates ( ) const

Definition at line 63 of file trs.hpp.

63{ return paymentDates_; }
+ Here is the caller graph for this function:

◆ initialPrice()

Real initialPrice ( ) const

Definition at line 64 of file trs.hpp.

64{ return initialPrice_; }
+ Here is the caller graph for this function:

◆ initialPriceCurrency()

const std::string & initialPriceCurrency ( ) const

Definition at line 65 of file trs.hpp.

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

◆ fxTerms()

const std::vector< std::string > & fxTerms ( ) const

Definition at line 66 of file trs.hpp.

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

◆ payUnderlyingCashFlowsImmediately()

boost::optional< bool > payUnderlyingCashFlowsImmediately ( ) const

Definition at line 67 of file trs.hpp.

+ Here is the caller graph for this function:

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 51 of file trs.cpp.

51 {
52 XMLUtils::checkNode(node, "ReturnData");
53 payer_ = XMLUtils::getChildValueAsBool(node, "Payer", true);
54 currency_ = XMLUtils::getChildValue(node, "Currency", true);
55 scheduleData_.fromXML(XMLUtils::getChildNode(node, "ScheduleData"));
56 observationLag_ = XMLUtils::getChildValue(node, "ObservationLag", false);
57 observationConvention_ = XMLUtils::getChildValue(node, "ObservationConvention", false);
58 observationCalendar_ = XMLUtils::getChildValue(node, "ObservationCalendar", false);
59 paymentLag_ = XMLUtils::getChildValue(node, "PaymentLag", false);
60 paymentConvention_ = XMLUtils::getChildValue(node, "PaymentConvention", false);
61 paymentCalendar_ = XMLUtils::getChildValue(node, "PaymentCalendar", false);
62 paymentDates_ = XMLUtils::getChildrenValues(node, "PaymentDates", "PaymentDate", false);
63 initialPrice_ = Null<Real>();
64 if (auto n = XMLUtils::getChildNode(node, "InitialPrice")) {
66 }
67 initialPriceCurrency_ = XMLUtils::getChildValue(node, "InitialPriceCurrency");
69 if (auto n = XMLUtils::getChildNode(node, "PayUnderlyingCashFlowsImmediately")) {
71 }
72 fxTerms_ = XMLUtils::getChildrenValues(node, "FXTerms", "FXIndex", false);
73}
virtual void fromXML(XMLNode *node) override
Definition: schedule.cpp:179
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
Definition: xmlutils.cpp:296
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static string getNodeValue(XMLNode *node)
Get a node's value.
Definition: xmlutils.cpp:489
static vector< string > getChildrenValues(XMLNode *node, const string &names, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:306
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
+ 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 75 of file trs.cpp.

75 {
76 XMLNode* n = doc.allocNode("ReturnData");
77 XMLUtils::addChild(doc, n, "Payer", payer_);
78 XMLUtils::addChild(doc, n, "Currency", currency_);
80 if (!observationLag_.empty())
81 XMLUtils::addChild(doc, n, "ObservationLag", observationLag_);
82 if (!observationConvention_.empty())
83 XMLUtils::addChild(doc, n, "ObservationConvention", observationConvention_);
84 if (!observationCalendar_.empty())
85 XMLUtils::addChild(doc, n, "ObservationCalendar", observationCalendar_);
86 if (!paymentLag_.empty())
87 XMLUtils::addChild(doc, n, "PaymentLag", paymentLag_);
88 if (!paymentConvention_.empty())
89 XMLUtils::addChild(doc, n, "PaymentConvention", paymentConvention_);
90 if (!paymentCalendar_.empty())
91 XMLUtils::addChild(doc, n, "PaymentCalendar", paymentCalendar_);
92 if (!paymentDates_.empty())
93 XMLUtils::addChildren(doc, n, "PaymentDates", "PaymentDate", paymentDates_);
94 if (initialPrice_ != Null<Real>())
95 XMLUtils::addChild(doc, n, "InitialPrice", initialPrice_);
96 if (!initialPriceCurrency_.empty())
97 XMLUtils::addChild(doc, n, "InitialPriceCurrency", initialPriceCurrency_);
99 XMLUtils::addChild(doc, n, "PayUnderlyingCashFlowsImmediately", *payUnderlyingCashFlowsImmediately_);
100 if (!fxTerms_.empty())
101 XMLUtils::addChildren(doc, n, "FXTerms", "FXIndex", fxTerms_);
102 return n;
103}
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: schedule.cpp:198
static void addChildren(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values)
Definition: xmlutils.cpp:502
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

◆ payer_

bool payer_
private

Definition at line 73 of file trs.hpp.

◆ currency_

std::string currency_
private

Definition at line 74 of file trs.hpp.

◆ scheduleData_

ScheduleData scheduleData_
private

Definition at line 75 of file trs.hpp.

◆ observationLag_

std::string observationLag_
private

Definition at line 76 of file trs.hpp.

◆ observationConvention_

std::string observationConvention_
private

Definition at line 76 of file trs.hpp.

◆ observationCalendar_

std::string observationCalendar_
private

Definition at line 76 of file trs.hpp.

◆ paymentLag_

std::string paymentLag_
private

Definition at line 76 of file trs.hpp.

◆ paymentConvention_

std::string paymentConvention_
private

Definition at line 76 of file trs.hpp.

◆ paymentCalendar_

std::string paymentCalendar_
private

Definition at line 77 of file trs.hpp.

◆ paymentDates_

std::vector<std::string> paymentDates_
private

Definition at line 78 of file trs.hpp.

◆ initialPrice_

Real initialPrice_
private

Definition at line 79 of file trs.hpp.

◆ initialPriceCurrency_

std::string initialPriceCurrency_
private

Definition at line 80 of file trs.hpp.

◆ fxTerms_

std::vector<std::string> fxTerms_
private

Definition at line 81 of file trs.hpp.

◆ payUnderlyingCashFlowsImmediately_

boost::optional<bool> payUnderlyingCashFlowsImmediately_
private

Definition at line 82 of file trs.hpp.