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

EQ Model Parameters. More...

#include <ored/model/eqbsdata.hpp>

+ Collaboration diagram for EqBsData:

Public Member Functions

 EqBsData ()
 Default constructor. More...
 
 EqBsData (std::string name, std::string currency, CalibrationType calibrationType, bool calibrateSigma, ParamType sigmaType, const std::vector< Time > &sigmaTimes, const std::vector< Real > &sigmaValues, std::vector< std::string > optionExpiries=std::vector< std::string >(), std::vector< std::string > optionStrikes=std::vector< std::string >())
 Detailed constructor. More...
 
Setters/Getters
std::string & eqName ()
 
std::string & currency ()
 
CalibrationTypecalibrationType ()
 
boolcalibrateSigma ()
 
ParamTypesigmaParamType ()
 
std::vector< Time > & sigmaTimes ()
 
std::vector< Real > & sigmaValues ()
 
std::vector< std::string > & optionExpiries ()
 
std::vector< std::string > & optionStrikes ()
 
Serialisation
void fromXML (XMLNode *node)
 
XMLNodetoXML (XMLDocument &doc)
 

Operators

std::string name_
 
std::string ccy_
 
CalibrationType calibrationType_
 
bool calibrateSigma_
 
ParamType sigmaType_
 
std::vector< Time > sigmaTimes_
 
std::vector< Real > sigmaValues_
 
std::vector< std::string > optionExpiries_
 
std::vector< std::string > optionStrikes_
 
bool operator== (const EqBsData &rhs)
 
bool operator!= (const EqBsData &rhs)
 

Detailed Description

EQ Model Parameters.

Specification for a EQ model component in the Cross Asset LGM (i.e. lognormal Equity with stochastic IR/FX differential). The specification applies to the volatility component (sigma) of the EQ model only.

Definition at line 50 of file eqbsdata.hpp.

Constructor & Destructor Documentation

◆ EqBsData() [1/2]

EqBsData ( )

Default constructor.

Definition at line 53 of file eqbsdata.hpp.

53{}

◆ EqBsData() [2/2]

EqBsData ( std::string  name,
std::string  currency,
CalibrationType  calibrationType,
bool  calibrateSigma,
ParamType  sigmaType,
const std::vector< Time > &  sigmaTimes,
const std::vector< Real > &  sigmaValues,
std::vector< std::string >  optionExpiries = std::vector<std::string>(),
std::vector< std::string >  optionStrikes = std::vector<std::string>() 
)

Detailed constructor.

Definition at line 56 of file eqbsdata.hpp.

std::string ccy_
Definition: eqbsdata.hpp:91
CalibrationType & calibrationType()
Definition: eqbsdata.hpp:68
std::vector< std::string > & optionStrikes()
Definition: eqbsdata.hpp:74
CalibrationType calibrationType_
Definition: eqbsdata.hpp:92
ParamType sigmaType_
Definition: eqbsdata.hpp:94
std::string name_
Definition: eqbsdata.hpp:90
std::vector< Real > & sigmaValues()
Definition: eqbsdata.hpp:72
std::string & currency()
Definition: eqbsdata.hpp:67
std::vector< std::string > optionExpiries_
Definition: eqbsdata.hpp:97
std::vector< Time > sigmaTimes_
Definition: eqbsdata.hpp:95
std::vector< std::string > & optionExpiries()
Definition: eqbsdata.hpp:73
std::vector< Time > & sigmaTimes()
Definition: eqbsdata.hpp:71
std::vector< Real > sigmaValues_
Definition: eqbsdata.hpp:96
bool & calibrateSigma()
Definition: eqbsdata.hpp:69
std::vector< std::string > optionStrikes_
Definition: eqbsdata.hpp:98
string name

Member Function Documentation

◆ eqName()

std::string & eqName ( )

Definition at line 66 of file eqbsdata.hpp.

66{ return name_; }

◆ currency()

std::string & currency ( )

Definition at line 67 of file eqbsdata.hpp.

67{ return ccy_; }

◆ calibrationType()

CalibrationType & calibrationType ( )

Definition at line 68 of file eqbsdata.hpp.

68{ return calibrationType_; }

◆ calibrateSigma()

bool & calibrateSigma ( )

Definition at line 69 of file eqbsdata.hpp.

69{ return calibrateSigma_; }

◆ sigmaParamType()

ParamType & sigmaParamType ( )

Definition at line 70 of file eqbsdata.hpp.

70{ return sigmaType_; }

◆ sigmaTimes()

std::vector< Time > & sigmaTimes ( )

Definition at line 71 of file eqbsdata.hpp.

71{ return sigmaTimes_; }

◆ sigmaValues()

std::vector< Real > & sigmaValues ( )

Definition at line 72 of file eqbsdata.hpp.

72{ return sigmaValues_; }

◆ optionExpiries()

std::vector< std::string > & optionExpiries ( )

Definition at line 73 of file eqbsdata.hpp.

73{ return optionExpiries_; }

◆ optionStrikes()

std::vector< std::string > & optionStrikes ( )

Definition at line 74 of file eqbsdata.hpp.

74{ return optionStrikes_; }

◆ fromXML()

void fromXML ( XMLNode node)

Definition at line 39 of file eqbsdata.cpp.

39 {
40 name_ = XMLUtils::getAttribute(node, "name");
41 LOG("Cross-Asset Equity Name = " << name_);
42
43 ccy_ = XMLUtils::getChildValue(node, "Currency", true);
44 LOG("Cross-Asset Equity Currency = " << ccy_);
45
46 std::string calibTypeString = XMLUtils::getChildValue(node, "CalibrationType", true);
47 calibrationType_ = parseCalibrationType(calibTypeString);
48 LOG("Cross-Asset Equity calibration type = " << calibTypeString);
49
50 XMLNode* sigmaNode = XMLUtils::getChildNode(node, "Sigma");
51 calibrateSigma_ = XMLUtils::getChildValueAsBool(sigmaNode, "Calibrate", true);
52 LOG("Cross-Asset Equity Sigma calibrate = " << calibrateSigma_);
53
54 std::string sigmaTypeString = XMLUtils::getChildValue(sigmaNode, "ParamType", true);
55 sigmaType_ = parseParamType(sigmaTypeString);
56 LOG("Cross-Asset Equity Sigma parameter type = " << sigmaTypeString);
57
58 sigmaTimes_ = XMLUtils::getChildrenValuesAsDoublesCompact(sigmaNode, "TimeGrid", true);
59 LOG("Cross-Asset Equity Sigma time grid size = " << sigmaTimes_.size());
60
61 sigmaValues_ = XMLUtils::getChildrenValuesAsDoublesCompact(sigmaNode, "InitialValue", true);
62 LOG("Cross-Asset Equity Sigma initial values size = " << sigmaValues_.size());
63
64 // Add FX Option calibration instruments
65 XMLNode* optionsNode = XMLUtils::getChildNode(node, "CalibrationOptions");
66
67 optionExpiries_ = XMLUtils::getChildrenValuesAsStrings(optionsNode, "Expiries", true);
68 optionStrikes_ = XMLUtils::getChildrenValuesAsStrings(optionsNode, "Strikes", false);
69
70 if (optionStrikes_.size() > 0) {
71 QL_REQUIRE(optionExpiries_.size() == optionStrikes_.size(),
72 "size mismatch in equity option expiries/strike for equity name " << name_);
73 } else // default ATMF
74 optionStrikes_.resize(optionExpiries_.size(), "ATMF");
75}
static string getAttribute(XMLNode *node, const string &attrName)
Definition: xmlutils.cpp:419
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 vector< string > getChildrenValuesAsStrings(XMLNode *node, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:342
static vector< Real > getChildrenValuesAsDoublesCompact(XMLNode *node, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:327
#define LOG(text)
Logging Macro (Level = Notice)
Definition: log.hpp:552
CalibrationType parseCalibrationType(const string &s)
Convert calibration type string into enumerated class value.
Definition: irmodeldata.cpp:47
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
ParamType parseParamType(const string &s)
Convert parameter type string into enumerated class value.
Definition: irmodeldata.cpp:38
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc)

Definition at line 77 of file eqbsdata.cpp.

77 {
78
79 XMLNode* crossCcyLGMNode = doc.allocNode("CrossAssetLGM");
80 XMLUtils::addAttribute(doc, crossCcyLGMNode, "name", name_);
81
82 XMLUtils::addChild(doc, crossCcyLGMNode, "Currency", ccy_);
83 XMLUtils::addGenericChild(doc, crossCcyLGMNode, "CalibrationType", calibrationType_);
84
85 XMLNode* sigmaNode = XMLUtils::addChild(doc, crossCcyLGMNode, "Sigma");
86 XMLUtils::addChild(doc, sigmaNode, "Calibrate", calibrateSigma_);
87 XMLUtils::addGenericChild(doc, sigmaNode, "ParamType", sigmaType_);
88 XMLUtils::addGenericChildAsList(doc, sigmaNode, "TimeGrid", sigmaTimes_);
89 XMLUtils::addGenericChildAsList(doc, sigmaNode, "InitialValue", sigmaValues_);
90
91 XMLNode* calibrationOptionsNode = XMLUtils::addChild(doc, crossCcyLGMNode, "CalibrationOptions");
92 XMLUtils::addGenericChildAsList(doc, calibrationOptionsNode, "Expiries", optionExpiries_);
93 XMLUtils::addGenericChildAsList(doc, calibrationOptionsNode, "Strikes", optionStrikes_);
94
95 return crossCcyLGMNode;
96}
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 void addGenericChild(XMLDocument &doc, XMLNode *n, const char *name, const T &value)
Adds <Name>p1,p2,p3</Name>
Definition: xmlutils.hpp:137
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
+ Here is the call graph for this function:

◆ operator==()

bool operator== ( const EqBsData rhs)

Definition at line 26 of file eqbsdata.cpp.

26 {
27
28 if (name_ != rhs.name_ || ccy_ != rhs.ccy_ || calibrationType_ != rhs.calibrationType_ ||
29 calibrateSigma_ != rhs.calibrateSigma_ || sigmaType_ != rhs.sigmaType_ || sigmaTimes_ != rhs.sigmaTimes_ ||
30 sigmaValues_ != rhs.sigmaValues_ || optionExpiries_ != rhs.optionExpiries_ ||
31 optionStrikes_ != rhs.optionStrikes_) {
32 return false;
33 }
34 return true;
35}

◆ operator!=()

bool operator!= ( const EqBsData rhs)

Definition at line 37 of file eqbsdata.cpp.

37{ return !(*this == rhs); }

Member Data Documentation

◆ name_

std::string name_
private

Definition at line 90 of file eqbsdata.hpp.

◆ ccy_

std::string ccy_
private

Definition at line 91 of file eqbsdata.hpp.

◆ calibrationType_

CalibrationType calibrationType_
private

Definition at line 92 of file eqbsdata.hpp.

◆ calibrateSigma_

bool calibrateSigma_
private

Definition at line 93 of file eqbsdata.hpp.

◆ sigmaType_

ParamType sigmaType_
private

Definition at line 94 of file eqbsdata.hpp.

◆ sigmaTimes_

std::vector<Time> sigmaTimes_
private

Definition at line 95 of file eqbsdata.hpp.

◆ sigmaValues_

std::vector<Real> sigmaValues_
private

Definition at line 96 of file eqbsdata.hpp.

◆ optionExpiries_

std::vector<std::string> optionExpiries_
private

Definition at line 97 of file eqbsdata.hpp.

◆ optionStrikes_

std::vector<std::string> optionStrikes_
private

Definition at line 98 of file eqbsdata.hpp.