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

Serializable CMS Leg Data. More...

#include <ored/portfolio/legdata.hpp>

+ Inheritance diagram for CMSLegData:
+ Collaboration diagram for CMSLegData:

Public Member Functions

 CMSLegData ()
 Default constructor. More...
 
 CMSLegData (const string &swapIndex, Size fixingDays, bool isInArrears, const vector< double > &spreads, const vector< string > &spreadDates=vector< string >(), const vector< double > &caps=vector< double >(), const vector< string > &capDates=vector< string >(), const vector< double > &floors=vector< double >(), const vector< string > &floorDates=vector< string >(), const vector< double > &gearings=vector< double >(), const vector< string > &gearingDates=vector< string >(), bool nakedOption=false)
 Constructor. More...
 
Inspectors
const string & swapIndex () const
 
Size fixingDays () const
 
bool isInArrears () const
 
const vector< double > & spreads () const
 
const vector< string > & spreadDates () const
 
const vector< double > & caps () const
 
const vector< string > & capDates () const
 
const vector< double > & floors () const
 
const vector< string > & floorDates () const
 
const vector< double > & gearings () const
 
const vector< 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

string swapIndex_
 
Size fixingDays_
 
bool isInArrears_
 
vector< double > spreads_
 
vector< string > spreadDates_
 
vector< double > caps_
 
vector< string > capDates_
 
vector< double > floors_
 
vector< string > floorDates_
 
vector< double > gearings_
 
vector< 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

Serializable CMS Leg Data.

Definition at line 414 of file legdata.hpp.

Constructor & Destructor Documentation

◆ CMSLegData() [1/2]

Default constructor.

Definition at line 417 of file legdata.hpp.

417: LegAdditionalData("CMS"), fixingDays_(Null<Size>()), isInArrears_(true), nakedOption_(false) {}
LegAdditionalData(const string &legType, const string &legNodeName)
Definition: legdata.hpp:65

◆ CMSLegData() [2/2]

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

Constructor.

Definition at line 419 of file legdata.hpp.

427 indices_.insert(swapIndex_);
428 }
const vector< double > & floors() const
Definition: legdata.hpp:439
vector< string > gearingDates_
Definition: legdata.hpp:471
bool nakedOption() const
Definition: legdata.hpp:443
const vector< double > & spreads() const
Definition: legdata.hpp:435
vector< double > gearings_
Definition: legdata.hpp:470
const vector< string > & gearingDates() const
Definition: legdata.hpp:442
vector< double > floors_
Definition: legdata.hpp:468
vector< string > floorDates_
Definition: legdata.hpp:469
Size fixingDays() const
Definition: legdata.hpp:433
vector< double > spreads_
Definition: legdata.hpp:464
const vector< double > & caps() const
Definition: legdata.hpp:437
const vector< string > & spreadDates() const
Definition: legdata.hpp:436
const vector< string > & floorDates() const
Definition: legdata.hpp:440
const vector< double > & gearings() const
Definition: legdata.hpp:441
const vector< string > & capDates() const
Definition: legdata.hpp:438
vector< string > capDates_
Definition: legdata.hpp:467
vector< double > caps_
Definition: legdata.hpp:466
const string & swapIndex() const
Definition: legdata.hpp:432
vector< string > spreadDates_
Definition: legdata.hpp:465
bool isInArrears() const
Definition: legdata.hpp:434
std::set< std::string > indices_
Definition: legdata.hpp:77

Member Function Documentation

◆ swapIndex()

const string & swapIndex ( ) const

Definition at line 432 of file legdata.hpp.

432{ return swapIndex_; }

◆ fixingDays()

Size fixingDays ( ) const

Definition at line 433 of file legdata.hpp.

433{ return fixingDays_; }

◆ isInArrears()

bool isInArrears ( ) const

Definition at line 434 of file legdata.hpp.

434{ return isInArrears_; }

◆ spreads()

const vector< double > & spreads ( ) const

Definition at line 435 of file legdata.hpp.

435{ return spreads_; }

◆ spreadDates()

const vector< string > & spreadDates ( ) const

Definition at line 436 of file legdata.hpp.

436{ return spreadDates_; }

◆ caps() [1/2]

const vector< double > & caps ( ) const

Definition at line 437 of file legdata.hpp.

437{ return caps_; }

◆ capDates() [1/2]

const vector< string > & capDates ( ) const

Definition at line 438 of file legdata.hpp.

438{ return capDates_; }

◆ floors() [1/2]

const vector< double > & floors ( ) const

Definition at line 439 of file legdata.hpp.

439{ return floors_; }

◆ floorDates() [1/2]

const vector< string > & floorDates ( ) const

Definition at line 440 of file legdata.hpp.

440{ return floorDates_; }

◆ gearings()

const vector< double > & gearings ( ) const

Definition at line 441 of file legdata.hpp.

441{ return gearings_; }

◆ gearingDates()

const vector< string > & gearingDates ( ) const

Definition at line 442 of file legdata.hpp.

442{ return gearingDates_; }

◆ nakedOption() [1/2]

bool nakedOption ( ) const

Definition at line 443 of file legdata.hpp.

443{ return nakedOption_; }

◆ caps() [2/2]

vector< double > & caps ( )

Definition at line 448 of file legdata.hpp.

448{ return caps_; }

◆ capDates() [2/2]

vector< string > & capDates ( )

Definition at line 449 of file legdata.hpp.

449{ return capDates_; }

◆ floors() [2/2]

vector< double > & floors ( )

Definition at line 450 of file legdata.hpp.

450{ return floors_; }

◆ floorDates() [2/2]

vector< string > & floorDates ( )

Definition at line 451 of file legdata.hpp.

451{ return floorDates_; }

◆ nakedOption() [2/2]

bool & nakedOption ( )

Definition at line 452 of file legdata.hpp.

452{ return nakedOption_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 402 of file legdata.cpp.

402 {
404 swapIndex_ = XMLUtils::getChildValue(node, "Index", true);
405 indices_.insert(swapIndex_);
406 // These are all optional
407 spreads_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Spreads", "Spread", "startDate", spreadDates_,
408 &parseReal);
409 XMLNode* arrNode = XMLUtils::getChildNode(node, "IsInArrears");
410 if (arrNode)
411 isInArrears_ = XMLUtils::getChildValueAsBool(node, "IsInArrears", true);
412 else
413 isInArrears_ = false; // default to fixing-in-advance
414 if (auto n = XMLUtils::getChildNode(node, "FixingDays"))
416 else
417 fixingDays_ = Null<Size>();
418 caps_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Caps", "Cap", "startDate", capDates_, &parseReal);
419 floors_ =
420 XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Floors", "Floor", "startDate", floorDates_, &parseReal);
421 gearings_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Gearings", "Gearing", "startDate", gearingDates_,
422 &parseReal);
423 if (XMLUtils::getChildNode(node, "NakedOption"))
424 nakedOption_ = XMLUtils::getChildValueAsBool(node, "NakedOption", false);
425 else
426 nakedOption_ = false;
427}
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
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 387 of file legdata.cpp.

387 {
388 XMLNode* node = doc.allocNode(legNodeName());
389 XMLUtils::addChild(doc, node, "Index", swapIndex_);
390 XMLUtils::addChild(doc, node, "IsInArrears", isInArrears_);
391 if (fixingDays_ != Null<Size>())
392 XMLUtils::addChild(doc, node, "FixingDays", static_cast<int>(fixingDays_));
393 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Caps", "Cap", caps_, "startDate", capDates_);
394 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Floors", "Floor", floors_, "startDate", floorDates_);
395 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Gearings", "Gearing", gearings_, "startDate",
397 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Spreads", "Spread", spreads_, "startDate", spreadDates_);
398 XMLUtils::addChild(doc, node, "NakedOption", nakedOption_);
399 return node;
400}
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_

string swapIndex_
private

Definition at line 461 of file legdata.hpp.

◆ fixingDays_

Size fixingDays_
private

Definition at line 462 of file legdata.hpp.

◆ isInArrears_

bool isInArrears_
private

Definition at line 463 of file legdata.hpp.

◆ spreads_

vector<double> spreads_
private

Definition at line 464 of file legdata.hpp.

◆ spreadDates_

vector<string> spreadDates_
private

Definition at line 465 of file legdata.hpp.

◆ caps_

vector<double> caps_
private

Definition at line 466 of file legdata.hpp.

◆ capDates_

vector<string> capDates_
private

Definition at line 467 of file legdata.hpp.

◆ floors_

vector<double> floors_
private

Definition at line 468 of file legdata.hpp.

◆ floorDates_

vector<string> floorDates_
private

Definition at line 469 of file legdata.hpp.

◆ gearings_

vector<double> gearings_
private

Definition at line 470 of file legdata.hpp.

◆ gearingDates_

vector<string> gearingDates_
private

Definition at line 471 of file legdata.hpp.

◆ nakedOption_

bool nakedOption_
private

Definition at line 472 of file legdata.hpp.