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

#include <ored/portfolio/durationadjustedcmslegdata.hpp>

+ Inheritance diagram for DurationAdjustedCmsLegData:
+ Collaboration diagram for DurationAdjustedCmsLegData:

Public Member Functions

 DurationAdjustedCmsLegData ()
 
 DurationAdjustedCmsLegData (const std::string &swapIndex, Size duration, Size fixingDays, bool isInArrears, const std::vector< double > &spreads, const std::vector< std::string > &spreadDates=std::vector< std::string >(), const std::vector< double > &caps=std::vector< double >(), const std::vector< std::string > &capDates=std::vector< std::string >(), const std::vector< double > &floors=std::vector< double >(), const std::vector< std::string > &floorDates=std::vector< std::string >(), const std::vector< double > &gearings=std::vector< double >(), const std::vector< std::string > &gearingDates=std::vector< std::string >(), bool nakedOption=false)
 Detailed constructor. More...
 
Inspectors
const std::string & swapIndex () const
 
Size duration () const
 
Size fixingDays () const
 
bool isInArrears () const
 
const std::vector< double > & spreads () const
 
const std::vector< std::string > & spreadDates () const
 
const std::vector< double > & caps () const
 
const std::vector< std::string > & capDates () const
 
const std::vector< double > & floors () const
 
const std::vector< std::string > & floorDates () const
 
const std::vector< double > & gearings () const
 
const std::vector< std::string > & gearingDates () const
 
bool nakedOption () const
 
Modifiers
vector< double > & caps ()
 
vector< string > & capDates ()
 
vector< double > & floors ()
 
vector< string > & floorDates ()
 
boolnakedOption ()
 
- 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

std::string swapIndex_
 
Size duration_
 
Size fixingDays_
 
bool isInArrears_
 
std::vector< double > spreads_
 
std::vector< std::string > spreadDates_
 
std::vector< double > caps_
 
std::vector< std::string > capDates_
 
std::vector< double > floors_
 
std::vector< std::string > floorDates_
 
std::vector< double > gearings_
 
std::vector< std::string > gearingDates_
 
bool nakedOption_
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 

Additional Inherited Members

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

Detailed Description

Definition at line 32 of file durationadjustedcmslegdata.hpp.

Constructor & Destructor Documentation

◆ DurationAdjustedCmsLegData() [1/2]

◆ DurationAdjustedCmsLegData() [2/2]

DurationAdjustedCmsLegData ( const std::string &  swapIndex,
Size  duration,
Size  fixingDays,
bool  isInArrears,
const std::vector< double > &  spreads,
const std::vector< std::string > &  spreadDates = std::vector<std::string>(),
const std::vector< double > &  caps = std::vector<double>(),
const std::vector< std::string > &  capDates = std::vector<std::string>(),
const std::vector< double > &  floors = std::vector<double>(),
const std::vector< std::string > &  floorDates = std::vector<std::string>(),
const std::vector< double > &  gearings = std::vector<double>(),
const std::vector< std::string > &  gearingDates = std::vector<std::string>(),
bool  nakedOption = false 
)

Detailed constructor.

Definition at line 40 of file durationadjustedcmslegdata.hpp.

54 indices_.insert(swapIndex_);
55 }
const std::vector< std::string > & capDates() const
const std::vector< double > & gearings() const
const std::vector< double > & spreads() const
const std::vector< double > & floors() const
const std::vector< std::string > & gearingDates() const
const std::vector< double > & caps() const
const std::vector< std::string > & floorDates() const
const std::vector< std::string > & spreadDates() const
std::set< std::string > indices_
Definition: legdata.hpp:77
LegAdditionalData(const string &legType, const string &legNodeName)
Definition: legdata.hpp:65

Member Function Documentation

◆ swapIndex()

const std::string & swapIndex ( ) const

Definition at line 59 of file durationadjustedcmslegdata.hpp.

59{ return swapIndex_; }

◆ duration()

Size duration ( ) const

Definition at line 60 of file durationadjustedcmslegdata.hpp.

60{ return duration_; }

◆ fixingDays()

Size fixingDays ( ) const

Definition at line 61 of file durationadjustedcmslegdata.hpp.

61{ return fixingDays_; }

◆ isInArrears()

bool isInArrears ( ) const

Definition at line 62 of file durationadjustedcmslegdata.hpp.

62{ return isInArrears_; }

◆ spreads()

const std::vector< double > & spreads ( ) const

Definition at line 63 of file durationadjustedcmslegdata.hpp.

63{ return spreads_; }

◆ spreadDates()

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

Definition at line 64 of file durationadjustedcmslegdata.hpp.

64{ return spreadDates_; }

◆ caps() [1/2]

const std::vector< double > & caps ( ) const

Definition at line 65 of file durationadjustedcmslegdata.hpp.

65{ return caps_; }

◆ capDates() [1/2]

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

Definition at line 66 of file durationadjustedcmslegdata.hpp.

66{ return capDates_; }

◆ floors() [1/2]

const std::vector< double > & floors ( ) const

Definition at line 67 of file durationadjustedcmslegdata.hpp.

67{ return floors_; }

◆ floorDates() [1/2]

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

Definition at line 68 of file durationadjustedcmslegdata.hpp.

68{ return floorDates_; }

◆ gearings()

const std::vector< double > & gearings ( ) const

Definition at line 69 of file durationadjustedcmslegdata.hpp.

69{ return gearings_; }

◆ gearingDates()

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

Definition at line 70 of file durationadjustedcmslegdata.hpp.

70{ return gearingDates_; }

◆ nakedOption() [1/2]

bool nakedOption ( ) const

Definition at line 71 of file durationadjustedcmslegdata.hpp.

71{ return nakedOption_; }

◆ caps() [2/2]

vector< double > & caps ( )

Definition at line 76 of file durationadjustedcmslegdata.hpp.

76{ return caps_; }

◆ capDates() [2/2]

vector< string > & capDates ( )

Definition at line 77 of file durationadjustedcmslegdata.hpp.

77{ return capDates_; }

◆ floors() [2/2]

vector< double > & floors ( )

Definition at line 78 of file durationadjustedcmslegdata.hpp.

78{ return floors_; }

◆ floorDates() [2/2]

vector< string > & floorDates ( )

Definition at line 79 of file durationadjustedcmslegdata.hpp.

79{ return floorDates_; }

◆ nakedOption() [2/2]

bool & nakedOption ( )

Definition at line 80 of file durationadjustedcmslegdata.hpp.

80{ return nakedOption_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 42 of file durationadjustedcmslegdata.cpp.

42 {
44 swapIndex_ = XMLUtils::getChildValue(node, "Index", true);
45 duration_ = XMLUtils::getChildValueAsInt(node, "Duration", false);
46 indices_.insert(swapIndex_);
47 // These are all optional
48 spreads_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Spreads", "Spread", "startDate", spreadDates_,
49 &parseReal);
50 XMLNode* arrNode = XMLUtils::getChildNode(node, "IsInArrears");
51 if (arrNode)
52 isInArrears_ = XMLUtils::getChildValueAsBool(node, "IsInArrears", true);
53 else
54 isInArrears_ = false; // default to fixing-in-advance
55 if (auto n = XMLUtils::getChildNode(node, "FixingDays"))
57 else
58 fixingDays_ = Null<Size>();
59 caps_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Caps", "Cap", "startDate", capDates_, &parseReal);
60 floors_ =
61 XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Floors", "Floor", "startDate", floorDates_, &parseReal);
62 gearings_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Gearings", "Gearing", "startDate", gearingDates_,
63 &parseReal);
64 if (XMLUtils::getChildNode(node, "NakedOption"))
65 nakedOption_ = XMLUtils::getChildValueAsBool(node, "NakedOption", false);
66 else
67 nakedOption_ = false;
68}
const string & legNodeName() const
Definition: legdata.hpp:70
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 int getChildValueAsInt(XMLNode *node, const string &name, bool mandatory=false, int defaultValue=0)
Definition: xmlutils.cpp:291
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Definition: parsers.cpp:136
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 26 of file durationadjustedcmslegdata.cpp.

26 {
27 XMLNode* node = doc.allocNode(legNodeName());
28 XMLUtils::addChild(doc, node, "Index", swapIndex_);
29 XMLUtils::addChild(doc, node, "Duration", static_cast<int>(duration_));
30 XMLUtils::addChild(doc, node, "IsInArrears", isInArrears_);
31 if (fixingDays_ != Null<Size>())
32 XMLUtils::addChild(doc, node, "FixingDays", static_cast<int>(fixingDays_));
33 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Caps", "Cap", caps_, "startDate", capDates_);
34 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Floors", "Floor", floors_, "startDate", floorDates_);
35 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Gearings", "Gearing", gearings_, "startDate",
37 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Spreads", "Spread", spreads_, "startDate", spreadDates_);
38 XMLUtils::addChild(doc, node, "NakedOption", nakedOption_);
39 return node;
40}
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
+ Here is the call graph for this function:

Member Data Documentation

◆ swapIndex_

std::string swapIndex_
private

Definition at line 89 of file durationadjustedcmslegdata.hpp.

◆ duration_

Size duration_
private

Definition at line 90 of file durationadjustedcmslegdata.hpp.

◆ fixingDays_

Size fixingDays_
private

Definition at line 91 of file durationadjustedcmslegdata.hpp.

◆ isInArrears_

bool isInArrears_
private

Definition at line 92 of file durationadjustedcmslegdata.hpp.

◆ spreads_

std::vector<double> spreads_
private

Definition at line 93 of file durationadjustedcmslegdata.hpp.

◆ spreadDates_

std::vector<std::string> spreadDates_
private

Definition at line 94 of file durationadjustedcmslegdata.hpp.

◆ caps_

std::vector<double> caps_
private

Definition at line 95 of file durationadjustedcmslegdata.hpp.

◆ capDates_

std::vector<std::string> capDates_
private

Definition at line 96 of file durationadjustedcmslegdata.hpp.

◆ floors_

std::vector<double> floors_
private

Definition at line 97 of file durationadjustedcmslegdata.hpp.

◆ floorDates_

std::vector<std::string> floorDates_
private

Definition at line 98 of file durationadjustedcmslegdata.hpp.

◆ gearings_

std::vector<double> gearings_
private

Definition at line 99 of file durationadjustedcmslegdata.hpp.

◆ gearingDates_

std::vector<std::string> gearingDates_
private

Definition at line 100 of file durationadjustedcmslegdata.hpp.

◆ nakedOption_

bool nakedOption_
private

Definition at line 101 of file durationadjustedcmslegdata.hpp.