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

FX volatility structure configuration. More...

#include <ored/configuration/fxvolcurveconfig.hpp>

+ Inheritance diagram for FXVolatilityCurveConfig:
+ Collaboration diagram for FXVolatilityCurveConfig:

Public Types

enum class  Dimension {
  ATM , SmileVannaVolga , SmileDelta , SmileBFRR ,
  SmileAbsolute , ATMTriangulated
}
 supported volatility structure types More...
 
enum class  SmileInterpolation { VannaVolga1 , VannaVolga2 , Linear , Cubic }
 

Public Member Functions

Constructors/Destructors
 FXVolatilityCurveConfig ()
 Default constructor. More...
 
 FXVolatilityCurveConfig (const string &curveID, const string &curveDescription, const Dimension &dimension, const vector< string > &expiries, const vector< string > &deltas=vector< string >(), const string &fxSpotID="", const string &fxForeignCurveID="", const string &fxDomesticCurveID="", const DayCounter &dayCounter=QuantLib::Actual365Fixed(), const Calendar &calendar=QuantLib::TARGET(), const SmileInterpolation &interp=SmileInterpolation::VannaVolga2, const string &conventionsID="", const std::vector< Size > &smileDelta={25}, const string &smileExtrapolation="Flat")
 Detailed constructor. More...
 
 FXVolatilityCurveConfig (const string &curveID, const string &curveDescription, const Dimension &dimension, const string &baseVolatility1, const string &baseVolatility2, const string &fxIndexTag="GENERIC")
 
Serialisation
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
Inspectors
const Dimensiondimension () const
 
const vector< string > & expiries () const
 
const vector< string > & deltas () const
 
const DayCounter & dayCounter () const
 
const Calendar & calendar () const
 
const string & fxSpotID () const
 
const string & fxForeignYieldCurveID () const
 
const string & fxDomesticYieldCurveID () const
 
const SmileInterpolationsmileInterpolation () const
 
const std::string & smileExtrapolation () const
 
const string & conventionsID () const
 
const std::vector< Size > & smileDelta () const
 
const vector< string > & quotes () override
 Return all the market quotes required for this config. More...
 
const string & baseVolatility1 () const
 
const string & baseVolatility2 () const
 
const string & fxIndexTag () const
 
const ReportConfigreportConfig () const
 
- Public Member Functions inherited from CurveConfig
 CurveConfig (const string &curveID, const string &curveDescription, const vector< string > &quotes=vector< string >())
 Detailed constructor. More...
 
 CurveConfig ()
 Default constructor. More...
 
const string & curveID () const
 
const string & curveDescription () const
 
const set< string > & requiredCurveIds (const CurveSpec::CurveType &curveType) const
 
const map< CurveSpec::CurveType, set< string > > & requiredCurveIds () const
 
string & curveID ()
 
string & curveDescription ()
 
set< string > & requiredCurveIds (const CurveSpec::CurveType &curveType)
 
map< CurveSpec::CurveType, set< string > > & requiredCurveIds ()
 
- 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...
 

Setters

Dimension dimension_
 
vector< string > expiries_
 
vector< string > deltas_
 
DayCounter dayCounter_
 
Calendar calendar_
 
string fxSpotID_
 
string fxForeignYieldCurveID_
 
string fxDomesticYieldCurveID_
 
string conventionsID_
 
std::vector< Size > smileDelta_
 
std::set< string > requiredYieldCurveIDs_
 
SmileInterpolation smileInterpolation_
 
string smileExtrapolation_
 
string baseVolatility1_
 
string baseVolatility2_
 
string fxIndexTag_
 
ReportConfig reportConfig_
 
Dimensiondimension ()
 
SmileInterpolationsmileInterpolation ()
 
string & smileExtrapolation ()
 
vector< string > & deltas ()
 
DayCounter & dayCounter ()
 
Calendar & calendar ()
 
string & fxSpotID ()
 
string & fxForeignYieldCurveID ()
 
string & fxDomesticYieldCurveID ()
 
string conventionsID ()
 
std::vector< Size > & smileDelta ()
 
const std::set< string > & requiredYieldCurveIDs () const
 
string & baseVolatility1 ()
 
string & baseVolatility2 ()
 
string & fxIndexTag ()
 
void populateRequiredCurveIds ()
 

Additional Inherited Members

- Protected Attributes inherited from CurveConfig
string curveID_
 
string curveDescription_
 
vector< string > quotes_
 
map< CurveSpec::CurveType, set< string > > requiredCurveIds_
 

Detailed Description

FX volatility structure configuration.

Definition at line 48 of file fxvolcurveconfig.hpp.

Member Enumeration Documentation

◆ Dimension

enum class Dimension
strong

supported volatility structure types

For ATM we will only load ATM quotes, for Smile we load ATM, RR, BF or Deltas SmileInterpolation - currently supports which of the 2 Vanna Volga approximations, as per Castagna& Mercurio(2006), to use. The second approximation is more accurate but can ask for the square root of a negative number under unusual circumstances.

Enumerator
ATM 
SmileVannaVolga 
SmileDelta 
SmileBFRR 
SmileAbsolute 
ATMTriangulated 

Definition at line 56 of file fxvolcurveconfig.hpp.

◆ SmileInterpolation

enum class SmileInterpolation
strong
Enumerator
VannaVolga1 
VannaVolga2 
Linear 
Cubic 

Definition at line 57 of file fxvolcurveconfig.hpp.

Constructor & Destructor Documentation

◆ FXVolatilityCurveConfig() [1/3]

Default constructor.

Definition at line 67 of file fxvolcurveconfig.hpp.

67{}

◆ FXVolatilityCurveConfig() [2/3]

FXVolatilityCurveConfig ( const string &  curveID,
const string &  curveDescription,
const Dimension dimension,
const vector< string > &  expiries,
const vector< string > &  deltas = vector<string>(),
const string &  fxSpotID = "",
const string &  fxForeignCurveID = "",
const string &  fxDomesticCurveID = "",
const DayCounter &  dayCounter = QuantLib::Actual365Fixed(),
const Calendar &  calendar = QuantLib::TARGET(),
const SmileInterpolation interp = SmileInterpolation::VannaVolga2,
const string &  conventionsID = "",
const std::vector< Size > &  smileDelta = {25},
const string &  smileExtrapolation = "Flat" 
)

Detailed constructor.

Definition at line 31 of file fxvolcurveconfig.cpp.

43}
const string & curveDescription() const
Definition: curveconfig.hpp:55
const string & curveID() const
Definition: curveconfig.hpp:54
CurveConfig()
Default constructor.
Definition: curveconfig.hpp:49
const DayCounter & dayCounter() const
const Calendar & calendar() const
const vector< string > & expiries() const
const std::string & smileExtrapolation() const
const Dimension & dimension() const
const std::vector< Size > & smileDelta() const
+ Here is the call graph for this function:

◆ FXVolatilityCurveConfig() [3/3]

FXVolatilityCurveConfig ( const string &  curveID,
const string &  curveDescription,
const Dimension dimension,
const string &  baseVolatility1,
const string &  baseVolatility2,
const string &  fxIndexTag = "GENERIC" 
)

Definition at line 45 of file fxvolcurveconfig.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 77 of file fxvolcurveconfig.cpp.

77 {
78 XMLUtils::checkNode(node, "FXVolatility");
79
80 curveID_ = XMLUtils::getChildValue(node, "CurveId", true);
81 curveDescription_ = XMLUtils::getChildValue(node, "CurveDescription", true);
82 string dim = XMLUtils::getChildValue(node, "Dimension", true);
83 string cal = XMLUtils::getChildValue(node, "Calendar");
84 string smileInterp = XMLUtils::getChildValue(node, "SmileInterpolation");
85
86 fxSpotID_ = XMLUtils::getChildValue(node, "FXSpotID", true);
87
88 vector<string> tokens;
89 boost::split(tokens, fxSpotID_, boost::is_any_of("/"));
90 QL_REQUIRE(tokens.size() == 3, "Expected 3 tokens FX/CCY1/CCY2 in fxSpotID (" << fxSpotID_ << ")");
91 if (cal == "") {
92 cal = tokens[1] + "," + tokens[2];
93 }
95
96 string dc = XMLUtils::getChildValue(node, "DayCounter");
97 if (dc == "")
98 dc = "A365";
100
101 if (dim == "ATMTriangulated") {
103 baseVolatility1_ = XMLUtils::getChildValue(node, "BaseVolatility1", true);
104 baseVolatility2_ = XMLUtils::getChildValue(node, "BaseVolatility2", true);
105
106 string fxIndexTag = XMLUtils::getChildValue(node, "FXIndexTag");
107 if (fxIndexTag == "")
108 fxIndexTag = "GENERIC";
110 } else {
111 if (dim == "ATM") {
113 } else if (dim == "Smile") {
114
115 conventionsID_ = XMLUtils::getChildValue(node, "Conventions", false);
116 string smileType = XMLUtils::getChildValue(node, "SmileType");
117 if (smileType == "" || smileType == "VannaVolga") {
119
120 // only read smile interpolation method if dimension is smile.
121 if (smileInterp == "") {
122 smileInterpolation_ = SmileInterpolation::VannaVolga2; // default to VannaVolga 2nd approximation
123 } else if (smileInterp == "VannaVolga1") {
125 } else if (smileInterp == "VannaVolga2") {
127 } else {
128 QL_FAIL("SmileInterpolation " << smileInterp << " not supported");
129 }
130
131 string sDelta = XMLUtils::getChildValue(node, "SmileDelta");
132 if (sDelta == "")
133 smileDelta_ = {25};
134 else
135 smileDelta_ = parseListOfValues<Size>(sDelta, &parseInteger);
136 } else if (smileType == "Delta") {
138 // only read smile interpolation and extrapolation method if dimension is smile.
139 if (smileInterp == "" || smileInterp == "Linear") {
141 } else if (smileInterp == "Cubic") {
143 } else {
144 QL_FAIL("SmileInterpolation " << smileInterp << " not supported");
145 }
146
147 smileExtrapolation_ = XMLUtils::getChildValue(node, "SmileExtrapolation", false, "Flat");
148
149 deltas_ = XMLUtils::getChildrenValuesAsStrings(node, "Deltas", true);
150
151 // check that these are valid deltas
152 for (auto d : deltas_) {
153 QL_REQUIRE(d == "ATM" || d.back() == 'P' || d.back() == 'C',
154 "this is not a valid value for delta, " << d);
155 if (d != "ATM") {
156 parseReal(d.substr(0, d.size() - 1));
157 }
158 }
159 } else if (smileType == "BFRR") {
161 if (smileInterp == "" || smileInterp == "Cubic") {
163 } else if (smileInterp == "Linear") {
165 } else {
166 QL_FAIL("SmileInterpolation " << smileInterp << " not supported");
167 }
168 string sDelta = XMLUtils::getChildValue(node, "SmileDelta");
169 if (sDelta == "")
170 smileDelta_ = {10, 25};
171 else
172 smileDelta_ = parseListOfValues<Size>(sDelta, &parseInteger);
173 } else if (smileType == "Absolute") {
175 if (smileInterp == "" || smileInterp == "Cubic") {
177 } else if (smileInterp == "Linear") {
179 } else {
180 QL_FAIL("SmileInterpolation " << smileInterp << " not supported");
181 }
182 } else {
183 QL_FAIL("SmileType '" << smileType << "' not supported, expected VannaVolga, Delta, BFRR");
184 }
185 } else {
186 QL_FAIL("Dimension " << dim << " not supported yet");
187 }
188 expiries_ = XMLUtils::getChildrenValuesAsStrings(node, "Expiries", true);
189
192 fxForeignYieldCurveID_ = XMLUtils::getChildValue(node, "FXForeignCurveID", curvesRequired);
193 fxDomesticYieldCurveID_ = XMLUtils::getChildValue(node, "FXDomesticCurveID", curvesRequired);
194 }
195
196 if (auto tmp = XMLUtils::getChildNode(node, "Report")) {
198 }
199
201}
void fromXML(XMLNode *node) override
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 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
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Definition: parsers.cpp:157
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
DayCounter parseDayCounter(const string &s)
Convert text to QuantLib::DayCounter.
Definition: parsers.cpp:209
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 203 of file fxvolcurveconfig.cpp.

203 {
204 XMLNode* node = doc.allocNode("FXVolatility");
205
206 XMLUtils::addChild(doc, node, "CurveId", curveID_);
207 XMLUtils::addChild(doc, node, "CurveDescription", curveDescription_);
208 if (dimension_ == Dimension::ATM) {
209 XMLUtils::addChild(doc, node, "Dimension", "ATM");
211 XMLUtils::addChild(doc, node, "Dimension", "ATMTriangulated");
212 XMLUtils::addChild(doc, node, "FXSpotID", fxSpotID_);
213 XMLUtils::addChild(doc, node, "FXIndexTag", fxIndexTag_);
214 XMLUtils::addChild(doc, node, "BaseVolatility1", baseVolatility1_);
215 XMLUtils::addChild(doc, node, "BaseVolatility2", baseVolatility2_);
216
217 return node;
219 XMLUtils::addChild(doc, node, "Dimension", "Smile");
220 XMLUtils::addChild(doc, node, "SmileType", "VannaVolga");
221 // only write smile interpolation if dimension is smile
223 XMLUtils::addChild(doc, node, "SmileInterpolation", "VannaVolga1");
225 XMLUtils::addChild(doc, node, "SmileInterpolation", "VannaVolga2");
226 } else {
227 QL_FAIL("Unknown SmileInterpolation in FXVolatilityCurveConfig::toXML()");
228 }
229 XMLUtils::addGenericChildAsList(doc, node, "SmileDelta", deltas_);
230 XMLUtils::addChild(doc, node, "Conventions", to_string(conventionsID_));
231 } else if (dimension_ == Dimension::SmileDelta) {
232 XMLUtils::addChild(doc, node, "Dimension", "Smile");
233 XMLUtils::addChild(doc, node, "SmileType", "Delta");
234 // only write smile interpolation if dimension is smile
236 XMLUtils::addChild(doc, node, "SmileInterpolation", "Linear");
238 XMLUtils::addChild(doc, node, "SmileInterpolation", "Cubic");
239 } else {
240 QL_FAIL("Unknown SmileInterpolation in FXVolatilityCurveConfig::toXML()");
241 }
242 if (!smileExtrapolation_.empty())
243 XMLUtils::addChild(doc, node, "SmileExtrapolation", smileExtrapolation_);
244 XMLUtils::addChild(doc, node, "Conventions", to_string(conventionsID_));
245 XMLUtils::addGenericChildAsList(doc, node, "Deltas", deltas_);
246 } else if (dimension_ == Dimension::SmileBFRR) {
247 XMLUtils::addChild(doc, node, "Dimension", "Smile");
248 XMLUtils::addChild(doc, node, "SmileType", "BFRR");
250 XMLUtils::addChild(doc, node, "SmileInterpolation", "Linear");
252 XMLUtils::addChild(doc, node, "SmileInterpolation", "Cubic");
253 } else {
254 QL_FAIL("Unknown SmileInterpolation in FXVolatilityCurveConfig::toXML()");
255 }
256 XMLUtils::addGenericChildAsList(doc, node, "SmileDelta", smileDelta_);
257 XMLUtils::addChild(doc, node, "Conventions", to_string(conventionsID_));
258 } else if (dimension_ == Dimension::SmileAbsolute) {
259 XMLUtils::addChild(doc, node, "Dimension", "Smile");
260 XMLUtils::addChild(doc, node, "SmileType", "Absolute");
262 XMLUtils::addChild(doc, node, "SmileInterpolation", "Linear");
264 XMLUtils::addChild(doc, node, "SmileInterpolation", "Cubic");
265 } else {
266 QL_FAIL("Unknown SmileInterpolation in FXVolatilityCurveConfig::toXML()");
267 }
268 XMLUtils::addChild(doc, node, "Conventions", to_string(conventionsID_));
269 } else {
270 QL_FAIL("Unknown Dimension in FXVolatilityCurveConfig::toXML()");
271 }
272 XMLUtils::addGenericChildAsList(doc, node, "Expiries", expiries_);
273 XMLUtils::addChild(doc, node, "FXSpotID", fxSpotID_);
274 if (!fxForeignYieldCurveID_.empty())
275 XMLUtils::addChild(doc, node, "FXForeignCurveID", fxForeignYieldCurveID_);
276 if (!fxDomesticYieldCurveID_.empty())
277 XMLUtils::addChild(doc, node, "FXDomesticCurveID", fxDomesticYieldCurveID_);
278 XMLUtils::addChild(doc, node, "Calendar", to_string(calendar_));
279 XMLUtils::addChild(doc, node, "DayCounter", to_string(dayCounter_));
281
282 return node;
283}
XMLNode * toXML(XMLDocument &doc) const override
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
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
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:

◆ dimension() [1/2]

const Dimension & dimension ( ) const

Definition at line 93 of file fxvolcurveconfig.hpp.

93{ return dimension_; }

◆ expiries()

const vector< string > & expiries ( ) const

Definition at line 94 of file fxvolcurveconfig.hpp.

94{ return expiries_; }

◆ deltas() [1/2]

const vector< string > & deltas ( ) const

Definition at line 95 of file fxvolcurveconfig.hpp.

95{ return deltas_; }

◆ dayCounter() [1/2]

const DayCounter & dayCounter ( ) const

Definition at line 96 of file fxvolcurveconfig.hpp.

96{ return dayCounter_; }

◆ calendar() [1/2]

const Calendar & calendar ( ) const

Definition at line 97 of file fxvolcurveconfig.hpp.

97{ return calendar_; }

◆ fxSpotID() [1/2]

const string & fxSpotID ( ) const

Definition at line 99 of file fxvolcurveconfig.hpp.

99{ return fxSpotID_; }
+ Here is the caller graph for this function:

◆ fxForeignYieldCurveID() [1/2]

const string & fxForeignYieldCurveID ( ) const

Definition at line 100 of file fxvolcurveconfig.hpp.

100{ return fxForeignYieldCurveID_; }

◆ fxDomesticYieldCurveID() [1/2]

const string & fxDomesticYieldCurveID ( ) const

Definition at line 101 of file fxvolcurveconfig.hpp.

101{ return fxDomesticYieldCurveID_; }

◆ smileInterpolation() [1/2]

const SmileInterpolation & smileInterpolation ( ) const

Definition at line 102 of file fxvolcurveconfig.hpp.

102{ return smileInterpolation_; }

◆ smileExtrapolation() [1/2]

const std::string & smileExtrapolation ( ) const

Definition at line 103 of file fxvolcurveconfig.hpp.

103{ return smileExtrapolation_; }

◆ conventionsID() [1/2]

const string & conventionsID ( ) const

Definition at line 104 of file fxvolcurveconfig.hpp.

104{ return conventionsID_; }

◆ smileDelta() [1/2]

const std::vector< Size > & smileDelta ( ) const

Definition at line 105 of file fxvolcurveconfig.hpp.

105{ return smileDelta_; }

◆ quotes()

const vector< string > & quotes ( )
overridevirtual

Return all the market quotes required for this config.

Reimplemented from CurveConfig.

Definition at line 53 of file fxvolcurveconfig.cpp.

53 {
54 if (quotes_.size() == 0) {
55 vector<string> tokens;
56 boost::split(tokens, fxSpotID(), boost::is_any_of("/"));
57 QL_REQUIRE(tokens.size() == 3, "Expected 3 tokens FX/CCY1/CCY2 in fxSpotID (" << fxSpotID() << ")");
58 quotes_.push_back("FX/RATE/" + tokens[1] + "/" + tokens[2]);
59 string base = "FX_OPTION/RATE_LNVOL/" + tokens[1] + "/" + tokens[2] + "/";
60 for (auto e : expiries_) {
61 quotes_.push_back(base + e + "/ATM");
63 for (auto const& d : smileDelta_) {
64 quotes_.push_back(base + e + "/" + to_string(d) + "RR");
65 quotes_.push_back(base + e + "/" + to_string(d) + "BF");
66 }
68 for (auto d : deltas_) {
69 quotes_.push_back(base + e + "/" + d);
70 }
71 }
72 }
73 }
74 return quotes_;
75}
vector< string > quotes_
Definition: curveconfig.hpp:74
+ Here is the call graph for this function:

◆ baseVolatility1() [1/2]

const string & baseVolatility1 ( ) const

Definition at line 107 of file fxvolcurveconfig.hpp.

107{ return baseVolatility1_; }

◆ baseVolatility2() [1/2]

const string & baseVolatility2 ( ) const

Definition at line 108 of file fxvolcurveconfig.hpp.

108{ return baseVolatility2_; }

◆ fxIndexTag() [1/2]

const string & fxIndexTag ( ) const

Definition at line 109 of file fxvolcurveconfig.hpp.

109{ return fxIndexTag_; }
+ Here is the caller graph for this function:

◆ reportConfig()

const ReportConfig & reportConfig ( ) const

Definition at line 110 of file fxvolcurveconfig.hpp.

110{ return reportConfig_; }

◆ dimension() [2/2]

Dimension & dimension ( )

Definition at line 115 of file fxvolcurveconfig.hpp.

115{ return dimension_; }

◆ smileInterpolation() [2/2]

SmileInterpolation & smileInterpolation ( )

Definition at line 116 of file fxvolcurveconfig.hpp.

116{ return smileInterpolation_; }

◆ smileExtrapolation() [2/2]

string & smileExtrapolation ( )

Definition at line 117 of file fxvolcurveconfig.hpp.

117{ return smileExtrapolation_; }

◆ deltas() [2/2]

vector< string > & deltas ( )

Definition at line 118 of file fxvolcurveconfig.hpp.

118{ return deltas_; }

◆ dayCounter() [2/2]

DayCounter & dayCounter ( )

Definition at line 119 of file fxvolcurveconfig.hpp.

119{ return dayCounter_; }

◆ calendar() [2/2]

Calendar & calendar ( )

Definition at line 120 of file fxvolcurveconfig.hpp.

120{ return calendar_; }

◆ fxSpotID() [2/2]

string & fxSpotID ( )

Definition at line 121 of file fxvolcurveconfig.hpp.

121{ return fxSpotID_; }

◆ fxForeignYieldCurveID() [2/2]

string & fxForeignYieldCurveID ( )

Definition at line 122 of file fxvolcurveconfig.hpp.

122{ return fxForeignYieldCurveID_; }

◆ fxDomesticYieldCurveID() [2/2]

string & fxDomesticYieldCurveID ( )

Definition at line 123 of file fxvolcurveconfig.hpp.

123{ return fxDomesticYieldCurveID_; }

◆ conventionsID() [2/2]

string conventionsID ( )

Definition at line 124 of file fxvolcurveconfig.hpp.

124{ return conventionsID_; }

◆ smileDelta() [2/2]

std::vector< Size > & smileDelta ( )

Definition at line 125 of file fxvolcurveconfig.hpp.

125{ return smileDelta_; }

◆ requiredYieldCurveIDs()

const std::set< string > & requiredYieldCurveIDs ( ) const

Definition at line 126 of file fxvolcurveconfig.hpp.

126{ return requiredYieldCurveIDs_; };

◆ baseVolatility1() [2/2]

string & baseVolatility1 ( )

Definition at line 127 of file fxvolcurveconfig.hpp.

127{ return baseVolatility1_; }

◆ baseVolatility2() [2/2]

string & baseVolatility2 ( )

Definition at line 128 of file fxvolcurveconfig.hpp.

128{ return baseVolatility2_; }

◆ fxIndexTag() [2/2]

string & fxIndexTag ( )

Definition at line 129 of file fxvolcurveconfig.hpp.

129{ return fxIndexTag_; }

◆ populateRequiredCurveIds()

void populateRequiredCurveIds ( )
private

Definition at line 285 of file fxvolcurveconfig.cpp.

285 {
286 if (!fxDomesticYieldCurveID_.empty() && !fxForeignYieldCurveID_.empty()) {
287 std::vector<string> domTokens, forTokens;
288 split(domTokens, fxDomesticYieldCurveID_, boost::is_any_of("/"));
289 split(forTokens, fxForeignYieldCurveID_, boost::is_any_of("/"));
290
291 if (domTokens.size() == 3 && domTokens[0] == "Yield") {
293 } else if (domTokens.size() == 1) {
295 } else {
296 QL_FAIL("Cannot determine the required domestic yield curve for fx vol curve " << curveID_);
297 }
298
299 if (forTokens.size() == 3 && forTokens[0] == "Yield") {
301 } else if (forTokens.size() == 1) {
303 } else {
304 QL_FAIL("Cannot determine the required foreign yield curve for fx vol curve " << curveID_);
305 }
306 }
307
311
312 vector<string> tokens;
313 boost::split(tokens, fxSpotID_, boost::is_any_of("/"));
314 QL_REQUIRE(tokens.size() == 3, "unexpected fxSpot format: " << fxSpotID_);
315 auto forTarget = tokens[1];
316 auto domTarget = tokens[2];
317
318 // we need to include inverse ccy pairs as well
319 QL_REQUIRE(baseVolatility1_.size() == 6, "invalid ccy pair length");
320 QL_REQUIRE(baseVolatility2_.size() == 6, "invalid ccy pair length");
321 auto forBase1 = baseVolatility1_.substr(0, 3);
322 auto domBase1 = baseVolatility1_.substr(3);
323 auto forBase2 = baseVolatility2_.substr(0, 3);
324 auto domBase2 = baseVolatility2_.substr(3);
325
326 requiredCurveIds_[CurveSpec::CurveType::FXVolatility].insert(domBase1 + forBase1);
327 requiredCurveIds_[CurveSpec::CurveType::FXVolatility].insert(domBase2 + forBase2);
328
329 // we need to establish the common currency between the two pairs to include the correlations
330 std::string baseCcy = "";
331 if (forBase1 == forBase2 || forBase1 == domBase2) {
332 baseCcy = forBase1;
333 } else {
334 QL_REQUIRE(domBase1 == forBase2 || domBase1 == domBase2, "no common currency found for baseVolatilities");
335 baseCcy = domBase1;
336 }
337
338 // straight pair
339 std::string forIndex = "FX-" + fxIndexTag_ + "-" + forTarget + "-" + baseCcy;
340 std::string domIndex = "FX-" + fxIndexTag_ + "-" + domTarget + "-" + baseCcy;
341 requiredCurveIds_[CurveSpec::CurveType::Correlation].insert(forIndex + "&" + domIndex);
342 // inverse pair
343 requiredCurveIds_[CurveSpec::CurveType::Correlation].insert(domIndex + "&" + forIndex);
344 // inverse fx index1
345 std::string forIndexInverse = "FX-" + fxIndexTag_ + "-" + baseCcy + "-" + forTarget;
346 requiredCurveIds_[CurveSpec::CurveType::Correlation].insert(forIndexInverse + "&" + domIndex);
347 requiredCurveIds_[CurveSpec::CurveType::Correlation].insert(domIndex + "&" + forIndexInverse);
348 // inverse fx index2
349 std::string domIndexInverse = "FX-" + fxIndexTag_ + "-" + baseCcy + "-" + domTarget;
350 requiredCurveIds_[CurveSpec::CurveType::Correlation].insert(forIndex + "&" + domIndexInverse);
351 requiredCurveIds_[CurveSpec::CurveType::Correlation].insert(domIndexInverse + "&" + forIndex);
352 // both fx indices inverted
353 requiredCurveIds_[CurveSpec::CurveType::Correlation].insert(forIndexInverse + "&" + domIndexInverse);
354 requiredCurveIds_[CurveSpec::CurveType::Correlation].insert(domIndexInverse + "&" + forIndexInverse);
355 }
356}
map< CurveSpec::CurveType, set< string > > requiredCurveIds_
Definition: curveconfig.hpp:75
+ Here is the caller graph for this function:

Member Data Documentation

◆ dimension_

Dimension dimension_
private

Definition at line 135 of file fxvolcurveconfig.hpp.

◆ expiries_

vector<string> expiries_
private

Definition at line 136 of file fxvolcurveconfig.hpp.

◆ deltas_

vector<string> deltas_
private

Definition at line 137 of file fxvolcurveconfig.hpp.

◆ dayCounter_

DayCounter dayCounter_
private

Definition at line 138 of file fxvolcurveconfig.hpp.

◆ calendar_

Calendar calendar_
private

Definition at line 139 of file fxvolcurveconfig.hpp.

◆ fxSpotID_

string fxSpotID_
private

Definition at line 140 of file fxvolcurveconfig.hpp.

◆ fxForeignYieldCurveID_

string fxForeignYieldCurveID_
private

Definition at line 141 of file fxvolcurveconfig.hpp.

◆ fxDomesticYieldCurveID_

string fxDomesticYieldCurveID_
private

Definition at line 142 of file fxvolcurveconfig.hpp.

◆ conventionsID_

string conventionsID_
private

Definition at line 143 of file fxvolcurveconfig.hpp.

◆ smileDelta_

std::vector<Size> smileDelta_
private

Definition at line 144 of file fxvolcurveconfig.hpp.

◆ requiredYieldCurveIDs_

std::set<string> requiredYieldCurveIDs_
private

Definition at line 145 of file fxvolcurveconfig.hpp.

◆ smileInterpolation_

SmileInterpolation smileInterpolation_
private

Definition at line 146 of file fxvolcurveconfig.hpp.

◆ smileExtrapolation_

string smileExtrapolation_
private

Definition at line 147 of file fxvolcurveconfig.hpp.

◆ baseVolatility1_

string baseVolatility1_
private

Definition at line 148 of file fxvolcurveconfig.hpp.

◆ baseVolatility2_

string baseVolatility2_
private

Definition at line 149 of file fxvolcurveconfig.hpp.

◆ fxIndexTag_

string fxIndexTag_
private

Definition at line 150 of file fxvolcurveconfig.hpp.

◆ reportConfig_

ReportConfig reportConfig_
private

Definition at line 151 of file fxvolcurveconfig.hpp.