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

Serializable YoY Leg Data. More...

#include <ored/portfolio/legdata.hpp>

+ Inheritance diagram for YoYLegData:
+ Collaboration diagram for YoYLegData:

Public Member Functions

 YoYLegData ()
 Default constructor. More...
 
 YoYLegData (string index, string observationLag, Size fixingDays, const vector< double > &gearings=std::vector< double >(), const vector< string > &gearingDates=std::vector< string >(), const vector< double > &spreads=std::vector< double >(), const vector< string > &spreadDates=std::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 >(), bool nakedOption=false, bool addInflationNotional=false, bool irregularYoY=false)
 Constructor. More...
 
Inspectors
const string index () const
 
const string observationLag () const
 
Size fixingDays () const
 
const std::vector< double > & gearings () const
 
const std::vector< string > & gearingDates () const
 
const std::vector< double > & spreads () const
 
const std::vector< string > & spreadDates () const
 
const vector< double > & caps () const
 
const vector< string > & capDates () const
 
const vector< double > & floors () const
 
const vector< string > & floorDates () const
 
bool nakedOption () const
 
bool addInflationNotional () const
 
bool irregularYoY () const
 
- 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 index_
 
string observationLag_
 
Size fixingDays_
 
vector< double > gearings_
 
vector< string > gearingDates_
 
vector< double > spreads_
 
vector< string > spreadDates_
 
vector< double > caps_
 
vector< string > capDates_
 
vector< double > floors_
 
vector< string > floorDates_
 
bool nakedOption_
 
bool addInflationNotional_
 
bool irregularYoY_
 
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 YoY Leg Data.

Definition at line 349 of file legdata.hpp.

Constructor & Destructor Documentation

◆ YoYLegData() [1/2]

Default constructor.

Definition at line 352 of file legdata.hpp.

352: LegAdditionalData("YY") {}
LegAdditionalData(const string &legType, const string &legNodeName)
Definition: legdata.hpp:65

◆ YoYLegData() [2/2]

YoYLegData ( string  index,
string  observationLag,
Size  fixingDays,
const vector< double > &  gearings = std::vector<double>(),
const vector< string > &  gearingDates = std::vector<string>(),
const vector< double > &  spreads = std::vector<double>(),
const vector< string > &  spreadDates = std::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>(),
bool  nakedOption = false,
bool  addInflationNotional = false,
bool  irregularYoY = false 
)

Constructor.

Definition at line 354 of file legdata.hpp.

366 indices_.insert(index_);
367 }
std::set< std::string > indices_
Definition: legdata.hpp:77
const vector< double > & floors() const
Definition: legdata.hpp:380
const std::vector< double > & gearings() const
Definition: legdata.hpp:374
vector< string > gearingDates_
Definition: legdata.hpp:398
const std::vector< string > & spreadDates() const
Definition: legdata.hpp:377
bool nakedOption() const
Definition: legdata.hpp:382
const std::vector< double > & spreads() const
Definition: legdata.hpp:376
vector< double > gearings_
Definition: legdata.hpp:397
const string index() const
Definition: legdata.hpp:371
vector< double > floors_
Definition: legdata.hpp:403
vector< string > floorDates_
Definition: legdata.hpp:404
Size fixingDays() const
Definition: legdata.hpp:373
const std::vector< string > & gearingDates() const
Definition: legdata.hpp:375
vector< double > spreads_
Definition: legdata.hpp:399
const vector< double > & caps() const
Definition: legdata.hpp:378
const vector< string > & floorDates() const
Definition: legdata.hpp:381
bool irregularYoY() const
Definition: legdata.hpp:384
const string observationLag() const
Definition: legdata.hpp:372
const vector< string > & capDates() const
Definition: legdata.hpp:379
vector< string > capDates_
Definition: legdata.hpp:402
vector< double > caps_
Definition: legdata.hpp:401
bool addInflationNotional() const
Definition: legdata.hpp:383
vector< string > spreadDates_
Definition: legdata.hpp:400

Member Function Documentation

◆ index()

const string index ( ) const

Definition at line 371 of file legdata.hpp.

371{ return index_; }

◆ observationLag()

const string observationLag ( ) const

Definition at line 372 of file legdata.hpp.

372{ return observationLag_; }

◆ fixingDays()

Size fixingDays ( ) const

Definition at line 373 of file legdata.hpp.

373{ return fixingDays_; }

◆ gearings()

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

Definition at line 374 of file legdata.hpp.

374{ return gearings_; }

◆ gearingDates()

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

Definition at line 375 of file legdata.hpp.

375{ return gearingDates_; }

◆ spreads()

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

Definition at line 376 of file legdata.hpp.

376{ return spreads_; }

◆ spreadDates()

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

Definition at line 377 of file legdata.hpp.

377{ return spreadDates_; }

◆ caps()

const vector< double > & caps ( ) const

Definition at line 378 of file legdata.hpp.

378{ return caps_; }

◆ capDates()

const vector< string > & capDates ( ) const

Definition at line 379 of file legdata.hpp.

379{ return capDates_; }

◆ floors()

const vector< double > & floors ( ) const

Definition at line 380 of file legdata.hpp.

380{ return floors_; }

◆ floorDates()

const vector< string > & floorDates ( ) const

Definition at line 381 of file legdata.hpp.

381{ return floorDates_; }

◆ nakedOption()

bool nakedOption ( ) const

Definition at line 382 of file legdata.hpp.

382{ return nakedOption_; }

◆ addInflationNotional()

bool addInflationNotional ( ) const

Definition at line 383 of file legdata.hpp.

383{ return addInflationNotional_; };

◆ irregularYoY()

bool irregularYoY ( ) const

Definition at line 384 of file legdata.hpp.

384{ return irregularYoY_; };

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 342 of file legdata.cpp.

342 {
344 index_ = XMLUtils::getChildValue(node, "Index", true);
345 indices_.insert(index_);
346 fixingDays_ = XMLUtils::getChildValueAsInt(node, "FixingDays", true);
347 observationLag_ = XMLUtils::getChildValue(node, "ObservationLag", false, "");
348 gearings_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Gearings", "Gearing", "startDate", gearingDates_,
349 &parseReal);
350 spreads_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Spreads", "Spread", "startDate", spreadDates_,
351 &parseReal);
352 caps_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Caps", "Cap", "startDate", capDates_, &parseReal);
353 floors_ =
354 XMLUtils::getChildrenValuesWithAttributes<Real>(node, "Floors", "Floor", "startDate", floorDates_, &parseReal);
355 if (XMLUtils::getChildNode(node, "NakedOption"))
356 nakedOption_ = XMLUtils::getChildValueAsBool(node, "NakedOption", false);
357 else
358 nakedOption_ = false;
359 if (XMLUtils::getChildNode(node, "AddInflationNotional"))
360 addInflationNotional_ = XMLUtils::getChildValueAsBool(node, "AddInflationNotional", false);
361 else
362 addInflationNotional_ = false;
363 if (XMLUtils::getChildNode(node, "IrregularYoY"))
364 irregularYoY_ = XMLUtils::getChildValueAsBool(node, "IrregularYoY", false);
365 else
366 irregularYoY_ = false;
367}
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
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 369 of file legdata.cpp.

369 {
370 XMLNode* node = doc.allocNode(legNodeName());
371 XMLUtils::addChild(doc, node, "Index", index_);
372 if (!observationLag_.empty()) {
373 XMLUtils::addChild(doc, node, "ObservationLag", observationLag_);
374 }
375 XMLUtils::addChild(doc, node, "FixingDays", static_cast<int>(fixingDays_));
376 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Gearings", "Gearing", gearings_, "startDate",
378 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Spreads", "Spread", spreads_, "startDate", spreadDates_);
379 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Caps", "Cap", caps_, "startDate", capDates_);
380 XMLUtils::addChildrenWithOptionalAttributes(doc, node, "Floors", "Floor", floors_, "startDate", floorDates_);
381 XMLUtils::addChild(doc, node, "NakedOption", nakedOption_);
382 XMLUtils::addChild(doc, node, "AddInflationNotional", addInflationNotional_);
383 XMLUtils::addChild(doc, node, "IrregularYoY", irregularYoY_);
384 return node;
385}
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
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

Member Data Documentation

◆ index_

string index_
private

Definition at line 394 of file legdata.hpp.

◆ observationLag_

string observationLag_
private

Definition at line 395 of file legdata.hpp.

◆ fixingDays_

Size fixingDays_
private

Definition at line 396 of file legdata.hpp.

◆ gearings_

vector<double> gearings_
private

Definition at line 397 of file legdata.hpp.

◆ gearingDates_

vector<string> gearingDates_
private

Definition at line 398 of file legdata.hpp.

◆ spreads_

vector<double> spreads_
private

Definition at line 399 of file legdata.hpp.

◆ spreadDates_

vector<string> spreadDates_
private

Definition at line 400 of file legdata.hpp.

◆ caps_

vector<double> caps_
private

Definition at line 401 of file legdata.hpp.

◆ capDates_

vector<string> capDates_
private

Definition at line 402 of file legdata.hpp.

◆ floors_

vector<double> floors_
private

Definition at line 403 of file legdata.hpp.

◆ floorDates_

vector<string> floorDates_
private

Definition at line 404 of file legdata.hpp.

◆ nakedOption_

bool nakedOption_
private

Definition at line 405 of file legdata.hpp.

◆ addInflationNotional_

bool addInflationNotional_
private

Definition at line 406 of file legdata.hpp.

◆ irregularYoY_

bool irregularYoY_
private

Definition at line 407 of file legdata.hpp.