22#include <ql/errors.hpp>
30 const string& forecastingCurve,
const string& currency,
const string&
calendar,
32 const vector<string>& fwdQuotes,
const string& dayCountID,
33 const string& dividendInterpVariable,
const string& dividendInterpMethod,
34 const bool dividendExtrapolation,
const bool extrapolation,
35 const QuantLib::Exercise::Type& exerciseStyle)
36 :
CurveConfig(curveID, curveDescription), fwdQuotes_(fwdQuotes), forecastingCurve_(forecastingCurve),
37 currency_(currency), calendar_(
calendar), type_(type), equitySpotQuoteID_(equitySpotQuote), dayCountID_(dayCountID),
38 divInterpVariable_(dividendInterpVariable), divInterpMethod_(dividendInterpMethod), dividendExtrapolation_(dividendExtrapolation),
39 extrapolation_(extrapolation), exerciseStyle_(exerciseStyle) {
81 "Invalid EquityCurveConfig, no Quotes should be present when type=NoDividends");
82 QL_REQUIRE(divInterpNode ==
nullptr,
83 "Invalid EquityCurveConfig, no DividendInterpolation should be present when type=NoDividends");
85 QL_REQUIRE(
fwdQuotes_.size() > 0,
"Invalid EquityCurveConfig, Quotes should be present when type!=NoDividends");
118 return out <<
"DividendYield";
120 return out <<
"ForwardPrice";
122 return out <<
"ForwardDividendPrice";
124 return out <<
"OptionPremium";
126 return out <<
"NoDividends";
128 QL_FAIL(
"unknown EquityCurveConfig::Type(" <<
int(t) <<
")");
133 if (str ==
"DividendYield")
135 else if (str ==
"ForwardPrice")
137 else if (str ==
"ForwardDividendPrice")
139 else if (str ==
"OptionPremium")
141 else if (str ==
"NoDividends")
143 QL_FAIL(
"Invalid EquityCurveConfig::Type " << str);
Base curve configuration.
map< CurveSpec::CurveType, set< string > > requiredCurveIds_
void populateRequiredCurveIds()
string divInterpVariable_
const string & forecastingCurve() const
Type
Supported equity curve types.
EquityCurveConfig()
Default constructor.
QuantLib::Exercise::Type exerciseStyle_
const vector< string > & fwdQuotes()
bool dividendExtrapolation_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
vector< string > fwdQuotes_
string equitySpotQuoteID_
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void addChildren(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values)
static void checkNode(XMLNode *n, const string &expectedName)
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
static XMLNode * getChildNode(XMLNode *n, const string &name="")
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)
Equity curve configuration classes.
Exercise::Type parseExerciseType(const std::string &s)
Convert text to QuantLib::Exercise::Type.
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
EquityCurveConfig::Type parseEquityCurveConfigType(const std::string &str)
std::string to_string(const LocationInfo &l)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.
string conversion utilities