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

Serializable Constant Maturity Bond Yield Leg Data. More...

#include <ored/portfolio/legdata.hpp>

+ Inheritance diagram for CMBLegData:
+ Collaboration diagram for CMBLegData:

Public Member Functions

 CMBLegData ()
 Default constructor. More...
 
 CMBLegData (const string &genericBond, bool hasCreditRisk, 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 & genericBond () const
 
bool hasCreditRisk () 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 genericBond_
 
bool hasCreditRisk_
 
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 Constant Maturity Bond Yield Leg Data.

Definition at line 687 of file legdata.hpp.

Constructor & Destructor Documentation

◆ CMBLegData() [1/2]

Default constructor.

Definition at line 690 of file legdata.hpp.

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

◆ CMBLegData() [2/2]

CMBLegData ( const string &  genericBond,
bool  hasCreditRisk,
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 692 of file legdata.hpp.

700 //indices_.insert(swapIndex_);
701 }
const vector< double > & floors() const
Definition: legdata.hpp:713
bool hasCreditRisk() const
Definition: legdata.hpp:706
vector< string > gearingDates_
Definition: legdata.hpp:746
bool nakedOption() const
Definition: legdata.hpp:717
const vector< double > & spreads() const
Definition: legdata.hpp:709
vector< double > gearings_
Definition: legdata.hpp:745
const vector< string > & gearingDates() const
Definition: legdata.hpp:716
const string & genericBond() const
Definition: legdata.hpp:705
vector< double > floors_
Definition: legdata.hpp:743
vector< string > floorDates_
Definition: legdata.hpp:744
Size fixingDays() const
Definition: legdata.hpp:707
vector< double > spreads_
Definition: legdata.hpp:739
const vector< double > & caps() const
Definition: legdata.hpp:711
const vector< string > & spreadDates() const
Definition: legdata.hpp:710
const vector< string > & floorDates() const
Definition: legdata.hpp:714
const vector< double > & gearings() const
Definition: legdata.hpp:715
const vector< string > & capDates() const
Definition: legdata.hpp:712
vector< string > capDates_
Definition: legdata.hpp:742
vector< double > caps_
Definition: legdata.hpp:741
vector< string > spreadDates_
Definition: legdata.hpp:740
bool isInArrears() const
Definition: legdata.hpp:708

Member Function Documentation

◆ genericBond()

const string & genericBond ( ) const

Definition at line 705 of file legdata.hpp.

705{ return genericBond_; }
+ Here is the caller graph for this function:

◆ hasCreditRisk()

bool hasCreditRisk ( ) const

Definition at line 706 of file legdata.hpp.

706{ return hasCreditRisk_; }

◆ fixingDays()

Size fixingDays ( ) const

Definition at line 707 of file legdata.hpp.

707{ return fixingDays_; }

◆ isInArrears()

bool isInArrears ( ) const

Definition at line 708 of file legdata.hpp.

708{ return isInArrears_; }

◆ spreads()

const vector< double > & spreads ( ) const

Definition at line 709 of file legdata.hpp.

709{ return spreads_; }

◆ spreadDates()

const vector< string > & spreadDates ( ) const

Definition at line 710 of file legdata.hpp.

710{ return spreadDates_; }

◆ caps() [1/2]

const vector< double > & caps ( ) const

Definition at line 711 of file legdata.hpp.

711{ return caps_; }

◆ capDates() [1/2]

const vector< string > & capDates ( ) const

Definition at line 712 of file legdata.hpp.

712{ return capDates_; }

◆ floors() [1/2]

const vector< double > & floors ( ) const

Definition at line 713 of file legdata.hpp.

713{ return floors_; }

◆ floorDates() [1/2]

const vector< string > & floorDates ( ) const

Definition at line 714 of file legdata.hpp.

714{ return floorDates_; }

◆ gearings()

const vector< double > & gearings ( ) const

Definition at line 715 of file legdata.hpp.

715{ return gearings_; }

◆ gearingDates()

const vector< string > & gearingDates ( ) const

Definition at line 716 of file legdata.hpp.

716{ return gearingDates_; }

◆ nakedOption() [1/2]

bool nakedOption ( ) const

Definition at line 717 of file legdata.hpp.

717{ return nakedOption_; }

◆ caps() [2/2]

vector< double > & caps ( )

Definition at line 722 of file legdata.hpp.

722{ return caps_; }

◆ capDates() [2/2]

vector< string > & capDates ( )

Definition at line 723 of file legdata.hpp.

723{ return capDates_; }

◆ floors() [2/2]

vector< double > & floors ( )

Definition at line 724 of file legdata.hpp.

724{ return floors_; }

◆ floorDates() [2/2]

vector< string > & floorDates ( )

Definition at line 725 of file legdata.hpp.

725{ return floorDates_; }

◆ nakedOption() [2/2]

bool & nakedOption ( )

Definition at line 726 of file legdata.hpp.

726{ return nakedOption_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 444 of file legdata.cpp.

444 {
446 genericBond_ = XMLUtils::getChildValue(node, "Index", true);
447 //indices_.insert(swapIndex_);
448 // These are all optional
449 spreads_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Spreads", "Spread", "startDate", spreadDates_,
450 &parseReal);
451 XMLNode* arrNode = XMLUtils::getChildNode(node, "IsInArrears");
452 if (arrNode)
453 isInArrears_ = XMLUtils::getChildValueAsBool(node, "IsInArrears", true);
454 else
455 isInArrears_ = false; // default to fixing-in-advance
456 fixingDays_ = XMLUtils::getChildValueAsInt(node, "FixingDays", true);
457 caps_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Caps", "Cap", "startDate", capDates_, &parseReal);
458 floors_ =
459 XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Floors", "Floor", "startDate", floorDates_, &parseReal);
460 gearings_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Gearings", "Gearing", "startDate", gearingDates_,
461 &parseReal);
462 if (XMLUtils::getChildNode(node, "NakedOption"))
463 nakedOption_ = XMLUtils::getChildValueAsBool(node, "NakedOption", false);
464 else
465 nakedOption_ = false;
466
467 if (XMLUtils::getChildNode(node, "CreditRisk"))
468 hasCreditRisk_ = XMLUtils::getChildValueAsBool(node, "CreditRisk", false);
469 else
470 hasCreditRisk_ = true;
471}
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 int getChildValueAsInt(XMLNode *node, const string &name, bool mandatory=false, int defaultValue=0)
Definition: xmlutils.cpp:291
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 429 of file legdata.cpp.

429 {
430 XMLNode* node = doc.allocNode(legNodeName());
431 XMLUtils::addChild(doc, node, "Index", genericBond_);
432 XMLUtils::addChild(doc, node, "IsInArrears", isInArrears_);
433 XMLUtils::addChild(doc, node, "FixingDays", static_cast<int>(fixingDays_));
434 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Caps", "Cap", caps_, "startDate", capDates_);
435 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Floors", "Floor", floors_, "startDate", floorDates_);
436 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Gearings", "Gearing", gearings_, "startDate",
438 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Spreads", "Spread", spreads_, "startDate", spreadDates_);
439 XMLUtils::addChild(doc, node, "NakedOption", nakedOption_);
440 XMLUtils::addChild(doc, node, "CreditRisk", hasCreditRisk_);
441 return node;
442}
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

◆ genericBond_

string genericBond_
private

Definition at line 735 of file legdata.hpp.

◆ hasCreditRisk_

bool hasCreditRisk_
private

Definition at line 736 of file legdata.hpp.

◆ fixingDays_

Size fixingDays_
private

Definition at line 737 of file legdata.hpp.

◆ isInArrears_

bool isInArrears_
private

Definition at line 738 of file legdata.hpp.

◆ spreads_

vector<double> spreads_
private

Definition at line 739 of file legdata.hpp.

◆ spreadDates_

vector<string> spreadDates_
private

Definition at line 740 of file legdata.hpp.

◆ caps_

vector<double> caps_
private

Definition at line 741 of file legdata.hpp.

◆ capDates_

vector<string> capDates_
private

Definition at line 742 of file legdata.hpp.

◆ floors_

vector<double> floors_
private

Definition at line 743 of file legdata.hpp.

◆ floorDates_

vector<string> floorDates_
private

Definition at line 744 of file legdata.hpp.

◆ gearings_

vector<double> gearings_
private

Definition at line 745 of file legdata.hpp.

◆ gearingDates_

vector<string> gearingDates_
private

Definition at line 746 of file legdata.hpp.

◆ nakedOption_

bool nakedOption_
private

Definition at line 747 of file legdata.hpp.