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

FX Model Parameters. More...

#include <ored/model/fxbsdata.hpp>

+ Collaboration diagram for FxBsData:

Public Member Functions

 FxBsData ()
 Default constructor. More...
 
 FxBsData (std::string foreignCcy, std::string domesticCcy, 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 & foreignCcy ()
 
std::string & domesticCcy ()
 
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 foreignCcy_
 
std::string domesticCcy_
 
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 FxBsData &rhs)
 
bool operator!= (const FxBsData &rhs)
 

Detailed Description

FX Model Parameters.

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

Definition at line 50 of file fxbsdata.hpp.

Constructor & Destructor Documentation

◆ FxBsData() [1/2]

FxBsData ( )

Default constructor.

Definition at line 53 of file fxbsdata.hpp.

53{}

◆ FxBsData() [2/2]

FxBsData ( std::string  foreignCcy,
std::string  domesticCcy,
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 fxbsdata.hpp.

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

Member Function Documentation

◆ foreignCcy()

std::string & foreignCcy ( )

Definition at line 66 of file fxbsdata.hpp.

66{ return foreignCcy_; }

◆ domesticCcy()

std::string & domesticCcy ( )

Definition at line 67 of file fxbsdata.hpp.

67{ return domesticCcy_; }

◆ calibrationType()

CalibrationType & calibrationType ( )

Definition at line 68 of file fxbsdata.hpp.

68{ return calibrationType_; }

◆ calibrateSigma()

bool & calibrateSigma ( )

Definition at line 69 of file fxbsdata.hpp.

69{ return calibrateSigma_; }

◆ sigmaParamType()

ParamType & sigmaParamType ( )

Definition at line 70 of file fxbsdata.hpp.

70{ return sigmaType_; }

◆ sigmaTimes()

std::vector< Time > & sigmaTimes ( )

Definition at line 71 of file fxbsdata.hpp.

71{ return sigmaTimes_; }

◆ sigmaValues()

std::vector< Real > & sigmaValues ( )

Definition at line 72 of file fxbsdata.hpp.

72{ return sigmaValues_; }

◆ optionExpiries()

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

Definition at line 73 of file fxbsdata.hpp.

73{ return optionExpiries_; }

◆ optionStrikes()

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

Definition at line 74 of file fxbsdata.hpp.

74{ return optionStrikes_; }

◆ fromXML()

void fromXML ( XMLNode node)

Definition at line 39 of file fxbsdata.cpp.

39 {
40 foreignCcy_ = XMLUtils::getAttribute(node, "foreignCcy");
41 LOG("CC-LGM foreignCcy = " << foreignCcy_);
42
43 domesticCcy_ = XMLUtils::getChildValue(node, "DomesticCcy", true);
44 LOG("CC-LGM domesticCcy = " << domesticCcy_);
45
46 std::string calibTypeString = XMLUtils::getChildValue(node, "CalibrationType", true);
47 calibrationType_ = parseCalibrationType(calibTypeString);
48 LOG("CC-LGM calibration type = " << calibTypeString);
49
50 XMLNode* sigmaNode = XMLUtils::getChildNode(node, "Sigma");
51 calibrateSigma_ = XMLUtils::getChildValueAsBool(sigmaNode, "Calibrate", true);
52 LOG("CC-LGM Sigma calibrate = " << calibrateSigma_);
53
54 std::string sigmaTypeString = XMLUtils::getChildValue(sigmaNode, "ParamType", true);
55 sigmaType_ = parseParamType(sigmaTypeString);
56 LOG("CC-LGM Sigma parameter type = " << sigmaTypeString);
57
58 sigmaTimes_ = XMLUtils::getChildrenValuesAsDoublesCompact(sigmaNode, "TimeGrid", true);
59 LOG("CC-LGM Sigma time grid size = " << sigmaTimes_.size());
60
61 sigmaValues_ = XMLUtils::getChildrenValuesAsDoublesCompact(sigmaNode, "InitialValue", true);
62 LOG("CC-LGM Sigma initial values size = " << sigmaValues_.size());
63
64 // Add FX Option calibration instruments
65 if (XMLNode* optionsNode = XMLUtils::getChildNode(node, "CalibrationOptions")) {
66 optionExpiries_ = XMLUtils::getChildrenValuesAsStrings(optionsNode, "Expiries", false);
67 optionStrikes_ = XMLUtils::getChildrenValuesAsStrings(optionsNode, "Strikes", false);
68 if (optionStrikes_.size() > 0) {
69 QL_REQUIRE(optionExpiries_.size() == optionStrikes_.size(),
70 "size mismatch in FX option expiries/strike for foreign ccy " << foreignCcy_);
71 } else {
72 optionStrikes_.resize(optionExpiries_.size(), "ATMF");
73 }
74 }
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 fxbsdata.cpp.

77 {
78
79 XMLNode* crossCcyLGMNode = doc.allocNode("CrossCcyLGM");
80 XMLUtils::addAttribute(doc, crossCcyLGMNode, "foreignCcy", foreignCcy_);
81
82 XMLUtils::addChild(doc, crossCcyLGMNode, "DomesticCcy", domesticCcy_);
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 FxBsData rhs)

Definition at line 26 of file fxbsdata.cpp.

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

◆ operator!=()

bool operator!= ( const FxBsData rhs)

Definition at line 37 of file fxbsdata.cpp.

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

Member Data Documentation

◆ foreignCcy_

std::string foreignCcy_
private

Definition at line 90 of file fxbsdata.hpp.

◆ domesticCcy_

std::string domesticCcy_
private

Definition at line 91 of file fxbsdata.hpp.

◆ calibrationType_

CalibrationType calibrationType_
private

Definition at line 92 of file fxbsdata.hpp.

◆ calibrateSigma_

bool calibrateSigma_
private

Definition at line 93 of file fxbsdata.hpp.

◆ sigmaType_

ParamType sigmaType_
private

Definition at line 94 of file fxbsdata.hpp.

◆ sigmaTimes_

std::vector<Time> sigmaTimes_
private

Definition at line 95 of file fxbsdata.hpp.

◆ sigmaValues_

std::vector<Real> sigmaValues_
private

Definition at line 96 of file fxbsdata.hpp.

◆ optionExpiries_

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

Definition at line 97 of file fxbsdata.hpp.

◆ optionStrikes_

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

Definition at line 98 of file fxbsdata.hpp.