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

CR LGM Model Parameters. More...

#include <ored/model/crlgmdata.hpp>

+ Inheritance diagram for CrLgmData:
+ Collaboration diagram for CrLgmData:

Public Member Functions

 CrLgmData ()
 Default constructor. More...
 
 CrLgmData (std::string name, CalibrationType calibrationType, ReversionType revType, VolatilityType volType, bool calibrateH, ParamType hType, std::vector< Time > hTimes, std::vector< Real > hValues, bool calibrateA, ParamType aType, std::vector< Time > aTimes, std::vector< Real > aValues, Real shiftHorizon=0.0, Real scaling=1.0, std::vector< std::string > optionExpiries=std::vector< std::string >(), std::vector< std::string > optionTerms=std::vector< std::string >(), std::vector< std::string > optionStrikes=std::vector< std::string >())
 Detailed constructor. More...
 
Setters/Getters
std::string & name ()
 
- Public Member Functions inherited from LgmData
 LgmData ()
 Default constructor. More...
 
 LgmData (std::string qualifier, CalibrationType calibrationType, ReversionType revType, VolatilityType volType, bool calibrateH, ParamType hType, std::vector< Time > hTimes, std::vector< Real > hValues, bool calibrateA, ParamType aType, std::vector< Time > aTimes, std::vector< Real > aValues, Real shiftHorizon=0.0, Real scaling=1.0, std::vector< std::string > optionExpiries=std::vector< std::string >(), std::vector< std::string > optionTerms=std::vector< std::string >(), std::vector< std::string > optionStrikes=std::vector< std::string >(), const QuantExt::AnalyticLgmSwaptionEngine::FloatSpreadMapping inputFloatSpreadMapping=QuantExt::AnalyticLgmSwaptionEngine::proRata)
 Detailed constructor. More...
 
void clear () override
 Clear list of calibration instruments. More...
 
void reset () override
 Reset member variables to defaults. More...
 
ReversionTypereversionType ()
 
VolatilityTypevolatilityType ()
 
boolcalibrateH ()
 
ParamTypehParamType ()
 
std::vector< Time > & hTimes ()
 
std::vector< Real > & hValues ()
 
boolcalibrateA ()
 
ParamTypeaParamType ()
 
std::vector< Time > & aTimes ()
 
std::vector< Real > & aValues ()
 
Real & shiftHorizon ()
 
Real & scaling ()
 
QuantExt::AnalyticLgmSwaptionEngine::FloatSpreadMappingfloatSpreadMapping ()
 
std::vector< std::string > & optionExpiries () const
 
std::vector< std::string > & optionTerms () const
 
std::vector< std::string > & optionStrikes () const
 
ReversionParameter reversionParameter () const
 
VolatilityParameter volatilityParameter () const
 
bool operator== (const LgmData &rhs)
 
bool operator!= (const LgmData &rhs)
 
- Public Member Functions inherited from IrModelData
 IrModelData (const std::string &name)
 minimal constructor More...
 
 IrModelData (const std::string &name, const std::string &qualifier, CalibrationType calibrationType)
 Detailed constructor. More...
 
virtual void clear ()
 Clear list of calibration instruments. More...
 
virtual void reset ()
 Reset member variables to defaults. More...
 
const std::string & name ()
 
std::string & qualifier ()
 
CalibrationTypecalibrationType ()
 
virtual std::string ccy () 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 name_
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
void clear () override
 Clear list of calibration instruments. More...
 
void reset () override
 Reset member variables to defaults. More...
 

Additional Inherited Members

- Public Types inherited from LgmData
enum class  ReversionType { HullWhite , Hagan }
 Supported mean reversion types. More...
 
enum class  VolatilityType { HullWhite , Hagan }
 Supported volatility types. More...
 
- Protected Attributes inherited from IrModelData
std::string name_
 
std::string qualifier_
 
CalibrationType calibrationType_
 

Detailed Description

CR LGM Model Parameters.

Definition at line 48 of file crlgmdata.hpp.

Constructor & Destructor Documentation

◆ CrLgmData() [1/2]

CrLgmData ( )

Default constructor.

Definition at line 51 of file crlgmdata.hpp.

51{}

◆ CrLgmData() [2/2]

CrLgmData ( std::string  name,
CalibrationType  calibrationType,
ReversionType  revType,
VolatilityType  volType,
bool  calibrateH,
ParamType  hType,
std::vector< Time >  hTimes,
std::vector< Real >  hValues,
bool  calibrateA,
ParamType  aType,
std::vector< Time >  aTimes,
std::vector< Real >  aValues,
Real  shiftHorizon = 0.0,
Real  scaling = 1.0,
std::vector< std::string >  optionExpiries = std::vector<std::string>(),
std::vector< std::string >  optionTerms = std::vector<std::string>(),
std::vector< std::string >  optionStrikes = std::vector<std::string>() 
)

Detailed constructor.

Definition at line 54 of file crlgmdata.hpp.

60 : LgmData(name, calibrationType, revType, volType, calibrateH, hType, hTimes, hValues, calibrateA, aType,
std::string name_
Definition: crlgmdata.hpp:80
std::string & name()
Definition: crlgmdata.hpp:65
CalibrationType & calibrationType()
std::vector< Time > & hTimes()
Definition: lgmdata.hpp:112
std::vector< std::string > & optionExpiries() const
Definition: lgmdata.hpp:121
std::vector< Time > & aTimes()
Definition: lgmdata.hpp:116
Real & scaling()
Definition: lgmdata.hpp:119
LgmData()
Default constructor.
Definition: lgmdata.hpp:75
std::vector< Real > & hValues()
Definition: lgmdata.hpp:113
std::vector< Real > & aValues()
Definition: lgmdata.hpp:117
std::vector< std::string > & optionTerms() const
Definition: lgmdata.hpp:122
Real & shiftHorizon()
Definition: lgmdata.hpp:118
bool & calibrateH()
Definition: lgmdata.hpp:110
bool & calibrateA()
Definition: lgmdata.hpp:114
std::vector< std::string > & optionStrikes() const
Definition: lgmdata.hpp:123

Member Function Documentation

◆ name()

std::string & name ( )

Definition at line 65 of file crlgmdata.hpp.

65{ return name_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Reimplemented from LgmData.

Definition at line 26 of file crlgmdata.cpp.

26 {
27 name_ = XMLUtils::getAttribute(node, "name");
28 LOG("LGM with attribute (name) = " << name_);
29
30 // Calibration Swaptions
31
32 XMLNode* optionsNode = XMLUtils::getChildNode(node, "CalibrationCdsOptions");
33
34 if (optionsNode) {
35
36 optionExpiries() = XMLUtils::getChildrenValuesAsStrings(optionsNode, "Expiries", false);
37 optionTerms() = XMLUtils::getChildrenValuesAsStrings(optionsNode, "Terms", false);
38 QL_REQUIRE(optionExpiries().size() == optionTerms().size(),
39 "vector size mismatch in cds option expiries/terms for name " << name_);
40 optionStrikes() = XMLUtils::getChildrenValuesAsStrings(optionsNode, "Strikes", false);
41 if (optionStrikes().size() > 0) {
42 QL_REQUIRE(optionStrikes().size() == optionExpiries().size(),
43 "vector size mismatch in cds option expiries/strikes for name " << name_);
44 } else // Default: ATM
45 optionStrikes().resize(optionExpiries().size(), "ATM");
46
47 for (Size i = 0; i < optionExpiries().size(); i++) {
48 LOG("LGM calibration cds option " << optionExpiries()[i] << " x " << optionTerms()[i] << " "
49 << optionStrikes()[i]);
50 }
51 }
52
53 LgmData::fromXML(node);
54}
virtual void fromXML(XMLNode *node) override
Definition: lgmdata.cpp:145
static string getAttribute(XMLNode *node, const string &attrName)
Definition: xmlutils.cpp:419
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static vector< string > getChildrenValuesAsStrings(XMLNode *node, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:342
#define LOG(text)
Logging Macro (Level = Notice)
Definition: log.hpp:552
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
Size size(const ValueType &v)
Definition: value.cpp:145
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Reimplemented from LgmData.

Definition at line 56 of file crlgmdata.cpp.

56 {
57 XMLNode* node = LgmData::toXML(doc);
58 XMLUtils::addAttribute(doc, node, "name", name_);
59
60 // swaption calibration
61 XMLNode* calibrationSwaptionsNode = XMLUtils::addChild(doc, node, "CalibrationCdsOptions");
62 XMLUtils::addGenericChildAsList(doc, calibrationSwaptionsNode, "Expiries", optionExpiries());
63 XMLUtils::addGenericChildAsList(doc, calibrationSwaptionsNode, "Terms", optionTerms());
64 XMLUtils::addGenericChildAsList(doc, calibrationSwaptionsNode, "Strikes", optionStrikes());
65
66 return node;
67}
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: lgmdata.cpp:207
static void addAttribute(XMLDocument &doc, XMLNode *node, const string &attrName, const string &attrValue)
Definition: xmlutils.cpp:412
static void addGenericChildAsList(XMLDocument &doc, XMLNode *n, const string &name, const vector< T > &values, const string &attrName="", const string &attr="")
Definition: xmlutils.hpp:144
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
+ Here is the call graph for this function:

◆ clear()

void clear ( )
overridevirtual

Clear list of calibration instruments.

Reimplemented from IrModelData.

Definition at line 73 of file crlgmdata.hpp.

73{ LgmData::clear(); }
void clear() override
Clear list of calibration instruments.
Definition: lgmdata.cpp:123
+ Here is the call graph for this function:

◆ reset()

void reset ( )
overridevirtual

Reset member variables to defaults.

Reimplemented from IrModelData.

Definition at line 74 of file crlgmdata.hpp.

74 {
76 name_ = "";
77 }
void reset() override
Reset member variables to defaults.
Definition: lgmdata.cpp:129
+ Here is the call graph for this function:

Member Data Documentation

◆ name_

std::string name_
private

Definition at line 80 of file crlgmdata.hpp.