36 : calendarStr_(calendarStr), priority_(priority) {
103 if (qType ==
"ImpliedVolatility" || qType ==
"") {
105 if (volType ==
"Lognormal" || qType ==
"") {
107 }
else if (volType ==
"ShiftedLognormal") {
109 }
else if (volType ==
"Normal") {
112 QL_FAIL(
"Volatility type " << volType <<
" is not supported;");
114 }
else if (qType ==
"Premium") {
119 QL_FAIL(
"Invalid quote type for volatility curve , quote type must be ImpliedVolatility or Premium");
142 QL_FAIL(
"Invalid quote type");
147 Exercise::Type exerciseType,
string calendarStr, Natural priority)
151 Exercise::Type exerciseType,
string calendarStr, Natural priority)
170 bool enforceMontoneVariance,
string calendarStr, Natural priority)
172 enforceMontoneVariance_(enforceMontoneVariance) {}
176 bool enforceMontoneVariance,
string calendarStr, Natural priority)
178 interpolation_(interpolation),
179 extrapolation_(extrapolation), enforceMontoneVariance_(enforceMontoneVariance) {}
212 Exercise::Type exerciseType,
string calendarStr, Natural priority)
216 bool extrapolation,
const string& timeExtrapolation,
218 Exercise::Type exerciseType,
string calendarStr, Natural priority)
220 strikeInterpolation_(strikeInterpolation), extrapolation_(extrapolation), timeExtrapolation_(timeExtrapolation),
221 strikeExtrapolation_(strikeExtrapolation) {}
250 Exercise::Type exerciseType,
string calendarStr, Natural priority)
254 const vector<string>& strikes,
const vector<string>& expiries,
const string& timeInterpolation,
255 const string& strikeInterpolation,
bool extrapolation,
const string& timeExtrapolation,
257 string calendarStr, Natural priority)
259 strikeExtrapolation, quoteType, exerciseType, calendarStr, priority),
260 strikes_(
strikes), expiries_(expiries) {}
268 vector<pair<string, string>> result;
270 for (
const string& e :
expiries()) {
272 result.push_back(make_pair(e, s));
297 Exercise::Type exerciseType,
string calendarStr, Natural priority)
301 const string& deltaType,
const string& atmType,
const vector<string>& putDeltas,
const vector<string>& callDeltas,
302 const vector<string>& expiries,
const string& timeInterpolation,
const string& strikeInterpolation,
303 bool extrapolation,
const string& timeExtrapolation,
const string& strikeExtrapolation,
305 Exercise::Type exerciseType,
string calendarStr, Natural priority)
307 strikeExtrapolation, quoteType, exerciseType, calendarStr, priority),
308 deltaType_(deltaType), atmType_(atmType), putDeltas_(putDeltas), callDeltas_(callDeltas), expiries_(expiries),
309 atmDeltaType_(atmDeltaType), futurePriceCorrection_(futurePriceCorrection) {}
327 vector<pair<string, string>> result;
330 string atmString =
"ATM/" +
atmType_;
337 for (
const string& e :
expiries()) {
338 result.push_back(make_pair(e, atmString));
340 result.push_back(make_pair(e, stem +
"Put/" + d));
343 result.push_back(make_pair(e, stem +
"Call/" + d));
382 Exercise::Type exerciseType,
string calendarStr, Natural priority)
386 const string& moneynessType,
const vector<string>& moneynessLevels,
const vector<string>& expiries,
387 const string& timeInterpolation,
const string& strikeInterpolation,
bool extrapolation,
388 const string& timeExtrapolation,
const string& strikeExtrapolation,
bool futurePriceCorrection,
391 strikeExtrapolation, quoteType, exerciseType, calendarStr, priority),
392 moneynessType_(moneynessType), moneynessLevels_(moneynessLevels), expiries_(expiries),
393 futurePriceCorrection_(futurePriceCorrection) {}
405 vector<pair<string, string>> result;
410 for (
const string& e :
expiries()) {
412 result.push_back(make_pair(e, stem + m));
444 Exercise::Type exerciseType,
string calendarStr, Natural priority)
448 const std::vector<std::string>& moneynessLevels,
const std::string& baseVolatilityId,
449 const std::string& basePriceCurveId,
const std::string& baseConventionsId,
const std::string& timeInterpolation,
450 const std::string& strikeInterpolation,
bool extrapolation,
const std::string& timeExtrapolation,
451 const std::string& strikeExtrapolation, Real beta,
const std::string& maxTenor,
MarketDatum::QuoteType quoteType,
452 Exercise::Type exerciseType,
string calendarStr, Natural priority)
454 strikeExtrapolation, quoteType, exerciseType, calendarStr, priority),
455 moneynessLevels_(moneynessLevels), baseVolatilityId_(baseVolatilityId), basePriceCurveId_(basePriceCurveId),
456 baseConventionsId_(baseConventionsId), beta_(beta), maxTenor_(maxTenor) {}
501 auto vc = QuantLib::ext::make_shared<ConstantVolatilityConfig>();
507 auto vc = QuantLib::ext::make_shared<VolatilityCurveConfig>();
514 auto vc = QuantLib::ext::make_shared<VolatilityDeltaSurfaceConfig>();
521 auto vc = QuantLib::ext::make_shared<VolatilityStrikeSurfaceConfig>();
528 auto vc = QuantLib::ext::make_shared<VolatilityMoneynessSurfaceConfig>();
535 auto vc = QuantLib::ext::make_shared<VolatilityApoFutureSurfaceConfig>();
542 auto vc = QuantLib::ext::make_shared<ProxyVolatilityConfig>();
548 "VolatilityConfigBuilder expects at least one child node of type: "
549 "Constant, Curve, StrikeSurface, DeltaSurface, MoneynessSurface, ApoFutureSurface, ProxySurface.");
554 [](
const QuantLib::ext::shared_ptr<VolatilityConfig>& a,
const QuantLib::ext::shared_ptr<VolatilityConfig>& b) {
556 "VolatilityConfigBuilder fails to sort the configs, can not compare a nullptr");
void fromXML(ore::data::XMLNode *node) override
std::string cdsVolatilityCurve_
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const std::string & cdsVolatilityCurve() const
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ConstantVolatilityConfig(MarketDatum::QuoteType quoteType=MarketDatum::QuoteType::RATE_LNVOL, QuantLib::Exercise::Type exerciseType=QuantLib::Exercise::Type::European, std::string calendarStr=std::string(), QuantLib::Natural priority=0)
Default constructor.
const std::string & quote() const
QuoteType
Supported market quote types.
const std::string & correlationCurve() const
std::string proxyVolatilityCurve_
const std::string & fxVolatilityCurve() const
std::string correlationCurve_
void fromXML(ore::data::XMLNode *node) override
const std::string & proxyVolatilityCurve() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::string fxVolatilityCurve_
MarketDatum::QuoteType quoteType_
void fromBaseNode(ore::data::XMLNode *node)
void toBaseNode(ore::data::XMLDocument &doc, ore::data::XMLNode *node) const
QuantLib::Exercise::Type exerciseType_
std::vector< std::pair< std::string, std::string > > quotes() const override
const std::string & basePriceCurveId() const
void fromXML(ore::data::XMLNode *node) override
const std::string & baseVolatilityId() const
std::string basePriceCurveId_
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const std::string & baseConventionsId() const
VolatilityApoFutureSurfaceConfig(MarketDatum::QuoteType quoteType=MarketDatum::QuoteType::RATE_LNVOL, QuantLib::Exercise::Type exerciseType=QuantLib::Exercise::Type::European, std::string calendarStr=std::string(), QuantLib::Natural priority=0)
Default constructor.
std::string baseConventionsId_
const std::string & maxTenor() const
std::string baseVolatilityId_
QuantLib::Real beta() const
const std::vector< std::string > & moneynessLevels() const
std::vector< std::string > moneynessLevels_
void fromXML(XMLNode *node) override
std::vector< QuantLib::ext::shared_ptr< VolatilityConfig > > volatilityConfig_
XMLNode * toXML(ore::data::XMLDocument &doc) const override
void loadVolatiltyConfigs(XMLNode *node)
QuantLib::Natural priority() const
QuantLib::Natural priority_
void fromXMLNode(ore::data::XMLNode *node)
VolatilityConfig(std::string calendarStr=std::string(), QuantLib::Natural priority=0)
void toXMLNode(XMLDocument &doc, XMLNode *node) const
const std::string & interpolation() const
bool enforceMontoneVariance_
void fromXML(ore::data::XMLNode *node) override
std::vector< std::string > quotes_
const std::string & extrapolation() const
VolatilityCurveConfig(MarketDatum::QuoteType quoteType=MarketDatum::QuoteType::RATE_LNVOL, QuantLib::Exercise::Type exerciseType=QuantLib::Exercise::Type::European, bool enforceMontoneVariance=true, std::string calendarStr=std::string(), QuantLib::Natural priority=0)
Default constructor.
std::string interpolation_
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const std::vector< std::string > & quotes() const
std::string extrapolation_
bool enforceMontoneVariance() const
const std::string & deltaType() const
std::vector< std::pair< std::string, std::string > > quotes() const override
bool futurePriceCorrection() const
const std::vector< std::string > & putDeltas() const
std::string atmDeltaType_
const std::vector< std::string > & callDeltas() const
void fromXML(ore::data::XMLNode *node) override
bool futurePriceCorrection_
const std::vector< std::string > & expiries() const
const std::string & atmDeltaType() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::vector< std::string > expiries_
VolatilityDeltaSurfaceConfig(MarketDatum::QuoteType quoteType=MarketDatum::QuoteType::RATE_LNVOL, QuantLib::Exercise::Type exerciseType=QuantLib::Exercise::Type::European, std::string calendarStr=std::string(), QuantLib::Natural priority=0)
Default constructor.
std::vector< std::string > putDeltas_
const std::string & atmType() const
std::vector< std::string > callDeltas_
std::string moneynessType_
std::vector< std::pair< std::string, std::string > > quotes() const override
bool futurePriceCorrection() const
VolatilityMoneynessSurfaceConfig(MarketDatum::QuoteType quoteType=MarketDatum::QuoteType::RATE_LNVOL, QuantLib::Exercise::Type exerciseType=QuantLib::Exercise::Type::European, std::string calendarStr=std::string(), QuantLib::Natural priority=0)
Default constructor.
const std::string & moneynessType() const
void fromXML(ore::data::XMLNode *node) override
bool futurePriceCorrection_
const std::vector< std::string > & expiries() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::vector< std::string > expiries_
const std::vector< std::string > & moneynessLevels() const
std::vector< std::string > moneynessLevels_
std::vector< std::pair< std::string, std::string > > quotes() const override
std::vector< std::string > strikes_
void fromXML(ore::data::XMLNode *node) override
const std::vector< std::string > & expiries() const
const std::vector< std::string > & strikes() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::vector< std::string > expiries_
VolatilityStrikeSurfaceConfig(MarketDatum::QuoteType quoteType=MarketDatum::QuoteType::RATE_LNVOL, QuantLib::Exercise::Type exerciseType=QuantLib::Exercise::Type::European, std::string calendarStr=std::string(), QuantLib::Natural priority=0)
Default constructor.
const std::string & timeInterpolation() const
void addNodes(ore::data::XMLDocument &doc, ore::data::XMLNode *node) const
bool extrapolation() const
VolatilitySurfaceConfig(MarketDatum::QuoteType quoteType=MarketDatum::QuoteType::RATE_LNVOL, QuantLib::Exercise::Type exerciseType=QuantLib::Exercise::Type::European, std::string calendarStr=std::string(), QuantLib::Natural priority=0)
Default constructor.
std::string timeExtrapolation_
std::string timeInterpolation_
const std::string & strikeInterpolation() const
const std::string & strikeExtrapolation() const
void fromNode(ore::data::XMLNode *node)
std::string strikeInterpolation_
const std::string & timeExtrapolation() const
std::string strikeExtrapolation_
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void addAttribute(XMLDocument &doc, XMLNode *node, const string &attrName, const string &attrValue)
static void addChildren(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values)
static string getAttribute(XMLNode *node, const string &attrName)
static void addGenericChildAsList(XMLDocument &doc, XMLNode *n, const string &name, const vector< T > &values, const string &attrName="", const string &attr="")
static void checkNode(XMLNode *n, const string &expectedName)
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static string getNodeValue(XMLNode *node)
Get a node's value.
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
static vector< string > getChildrenValuesAsStrings(XMLNode *node, const string &name, bool mandatory=false)
static vector< string > getChildrenValues(XMLNode *node, const string &names, const string &name, bool mandatory=false)
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Exercise::Type parseExerciseType(const std::string &s)
Convert text to QuantLib::Exercise::Type.
bool parseBool(const string &s)
Convert text to bool.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
bool operator<(const Dividend &d1, const Dividend &d2)
std::string to_string(const LocationInfo &l)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
string conversion utilities