23#include <ql/errors.hpp>
32 : optionExpiryRollDays_(0) {}
35 const string& curveId,
const string& curveDescription,
const std::string& currency,
36 const vector<QuantLib::ext::shared_ptr<VolatilityConfig>>& volatilityConfig,
const string& dayCounter,
37 const string&
calendar,
const std::string& futureConventionsId, QuantLib::Natural optionExpiryRollDays,
38 const std::string& priceCurveId,
const std::string& yieldCurveId,
const std::string& quoteSuffix,
39 const OneDimSolverConfig& solverConfig,
const boost::optional<bool>& preferOutOfTheMoney)
40 :
CurveConfig(curveId, curveDescription), currency_(currency), volatilityConfig_(volatilityConfig),
41 dayCounter_(dayCounter), calendar_(
calendar), futureConventionsId_(futureConventionsId),
42 optionExpiryRollDays_(optionExpiryRollDays), priceCurveId_(priceCurveId), yieldCurveId_(yieldCurveId),
43 quoteSuffix_(quoteSuffix), solverConfig_(solverConfig), preferOutOfTheMoney_(preferOutOfTheMoney) {
54 if (
auto vapo = QuantLib::ext::dynamic_pointer_cast<VolatilityApoFutureSurfaceConfig>(vc)) {
58 if (
auto p = QuantLib::ext::dynamic_pointer_cast<ProxyVolatilityConfig>(vc)) {
61 if (!p->fxVolatilityCurve().empty())
63 if (!p->correlationCurve().empty())
192 if (
auto vc = QuantLib::ext::dynamic_pointer_cast<ConstantVolatilityConfig>(config)) {
193 quotes_.push_back(vc->quote());
194 }
else if (
auto vc = QuantLib::ext::dynamic_pointer_cast<VolatilityCurveConfig>(config)) {
195 auto qs = vc->quotes();
197 }
else if (
auto vc = QuantLib::ext::dynamic_pointer_cast<VolatilitySurfaceConfig>(config)) {
198 string quoteType =
to_string(vc->quoteType());
199 string stem =
"COMMODITY_OPTION/" + quoteType +
"/" +
curveID_ +
"/" +
currency_ +
"/";
200 for (
const pair<string, string>& p : vc->quotes()) {
201 string q = stem + p.first +
"/" + p.second;
void populateRequiredCurveIds()
std::string futureConventionsId_
ReportConfig reportConfig_
QuantLib::Natural optionExpiryRollDays_
const std::string & currency() const
void populateQuotes()
Populate CurveConfig::quotes_ with the required quotes.
OneDimSolverConfig solverConfig() const
QuantLib::Natural optionExpiryRollDays() const
const std::string & yieldCurveId() const
const std::string & priceCurveId() const
CommodityVolatilityConfig()
Default constructor.
const std::vector< QuantLib::ext::shared_ptr< VolatilityConfig > > & volatilityConfig() const
const std::string & quoteSuffix() const
std::string priceCurveId_
void fromXML(XMLNode *node) override
const std::string & futureConventionsId() const
std::vector< QuantLib::ext::shared_ptr< VolatilityConfig > > volatilityConfig_
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const boost::optional< bool > & preferOutOfTheMoney() const
static OneDimSolverConfig defaultSolverConfig()
const std::string & dayCounter() const
OneDimSolverConfig solverConfig_
const std::string & calendar() const
boost::optional< bool > preferOutOfTheMoney_
std::string yieldCurveId_
Base curve configuration.
map< CurveSpec::CurveType, set< string > > requiredCurveIds_
void fromXML(ore::data::XMLNode *node) override
bool empty() const
Return true if default constructed and not populated i.e. no useful configuration.
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
const std::vector< QuantLib::ext::shared_ptr< VolatilityConfig > > & volatilityConfig()
void fromXML(XMLNode *node) override
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void checkNode(XMLNode *n, const string &expectedName)
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 * addChild(XMLDocument &doc, XMLNode *n, const string &name)
static void appendNode(XMLNode *parent, XMLNode *child)
Commodity volatility curve configuration.
QuantLib::ext::shared_ptr< CurveSpec > parseCurveSpec(const string &s)
function to convert a string into a curve spec
bool parseBool(const string &s)
Convert text to bool.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
std::string to_string(const LocationInfo &l)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
string conversion utilities