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

#include <ored/model/calibrationinstruments/yoycapfloor.hpp>

+ Inheritance diagram for YoYCapFloor:
+ Collaboration diagram for YoYCapFloor:

Public Member Functions

 YoYCapFloor ()
 Default constructor. More...
 
 YoYCapFloor (QuantLib::YoYInflationCapFloor::Type type, const QuantLib::Period &tenor, const QuantLib::ext::shared_ptr< BaseStrike > &strike)
 Detailed constructor. More...
 
Inspectors
QuantLib::YoYInflationCapFloor::Type type () const
 
const QuantLib::Period & tenor () const
 
const QuantLib::ext::shared_ptr< BaseStrike > & strike () const
 
- Public Member Functions inherited from CalibrationInstrument
 CalibrationInstrument (const std::string &instrumentType)
 Constructor. More...
 
virtual ~CalibrationInstrument ()
 Destructor. More...
 
const std::string & instrumentType () 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

QuantLib::YoYInflationCapFloor::Type type_
 
QuantLib::Period tenor_
 
QuantLib::ext::shared_ptr< BaseStrikestrike_
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 

Additional Inherited Members

- Protected Attributes inherited from CalibrationInstrument
std::string instrumentType_
 

Detailed Description

Class for holding details of a year on year inflation cap floor calibration instrument.

Definition at line 37 of file yoycapfloor.hpp.

Constructor & Destructor Documentation

◆ YoYCapFloor() [1/2]

Default constructor.

Definition at line 29 of file yoycapfloor.cpp.

30 : CalibrationInstrument("YoYCapFloor"), type_(YoYInflationCapFloor::Floor) {}
CalibrationInstrument(const std::string &instrumentType)
Constructor.
QuantLib::YoYInflationCapFloor::Type type_
Definition: yoycapfloor.hpp:61

◆ YoYCapFloor() [2/2]

YoYCapFloor ( QuantLib::YoYInflationCapFloor::Type  type,
const QuantLib::Period &  tenor,
const QuantLib::ext::shared_ptr< BaseStrike > &  strike 
)

Detailed constructor.

Member Function Documentation

◆ type()

YoYInflationCapFloor::Type type ( ) const

Definition at line 40 of file yoycapfloor.cpp.

40 {
41 return type_;
42}

◆ tenor()

const QuantLib::Period & tenor ( ) const

Definition at line 44 of file yoycapfloor.cpp.

44 {
45 return tenor_;
46}
QuantLib::Period tenor_
Definition: yoycapfloor.hpp:62

◆ strike()

const QuantLib::ext::shared_ptr< BaseStrike > & strike ( ) const

Definition at line 48 of file yoycapfloor.cpp.

48 {
49 return strike_;
50}
QuantLib::ext::shared_ptr< BaseStrike > strike_
Definition: yoycapfloor.hpp:63

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 52 of file yoycapfloor.cpp.

52 {
55 tenor_ = parsePeriod(XMLUtils::getChildValue(node, "Tenor", true));
56 strike_ = parseBaseStrike(XMLUtils::getChildValue(node, "Strike", true));
57}
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
YoYInflationCapFloor::Type parseYoYInflationCapFloorType(const string &s)
Definition: parsers.cpp:827
Period parsePeriod(const string &s)
Convert text to QuantLib::Period.
Definition: parsers.cpp:171
QuantLib::ext::shared_ptr< BaseStrike > parseBaseStrike(const string &strStrike)
Parse a Strike from its string representation, strStrike.
Definition: strike.cpp:262
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 59 of file yoycapfloor.cpp.

59 {
60 XMLNode* node = doc.allocNode(instrumentType_);
61 if (type_ == YoYInflationCapFloor::Cap)
62 XMLUtils::addChild(doc, node, "Type", "Cap");
63 else if (type_ == YoYInflationCapFloor::Floor)
64 XMLUtils::addChild(doc, node, "Type", "Floor");
65 else
66 QL_FAIL("Failure in YoYCapFloor::toXML, unsupported YoY cap floor type.");
67 XMLUtils::addChild(doc, node, "Tenor", to_string(tenor_));
68 XMLUtils::addChild(doc, node, "Strike", strike_->toString());
69 return node;
70}
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

Member Data Documentation

◆ type_

QuantLib::YoYInflationCapFloor::Type type_
private

Definition at line 61 of file yoycapfloor.hpp.

◆ tenor_

QuantLib::Period tenor_
private

Definition at line 62 of file yoycapfloor.hpp.

◆ strike_

QuantLib::ext::shared_ptr<BaseStrike> strike_
private

Definition at line 63 of file yoycapfloor.hpp.