87 QL_REQUIRE(
type_ ==
"Equity",
"Underlying must be of type 'Equity'.");
124 QL_REQUIRE(
type_ ==
"Commodity",
"Underlying must be of type 'Commodity'.");
139 "Only futureExpiryDate or futureContractMonth are allowed not both");
141 QL_FAIL(
"Need either a Name or Underlying node for CommodityUnderlying.");
176 QL_FAIL(
"Need either a Name or Underlying node for FXUnderlying.");
199 QL_FAIL(
"Need either a Name or Underlying node for InterestRateUnderlying.");
222 QL_FAIL(
"Need either a Name or Underlying node for CreditUnderlying.");
245 if (interpolationString !=
"")
251 QL_FAIL(
"Need either a Name or Underlying node for InflationUnderlying.");
282 QL_REQUIRE(
type_ ==
"Bond",
"Underlying must be of type 'Bond'.");
307 underlying_ = QuantLib::ext::make_shared<BasicUnderlying>();
310 if (type ==
"Equity")
311 underlying_ = QuantLib::ext::make_shared<EquityUnderlying>();
312 else if (type ==
"Commodity")
313 underlying_ = QuantLib::ext::make_shared<CommodityUnderlying>();
314 else if (type ==
"FX")
315 underlying_ = QuantLib::ext::make_shared<FXUnderlying>();
316 else if (type ==
"InterestRate")
317 underlying_ = QuantLib::ext::make_shared<InterestRateUnderlying>();
318 else if (type ==
"Inflation")
319 underlying_ = QuantLib::ext::make_shared<InflationUnderlying>();
320 else if (type ==
"Credit")
321 underlying_ = QuantLib::ext::make_shared<CreditUnderlying>();
322 else if (type ==
"Bond")
323 underlying_ = QuantLib::ext::make_shared<BondUnderlying>();
325 QL_FAIL(
"Unknown Underlying type " << type);
330 QL_REQUIRE(
underlying_ !=
nullptr,
"UnderlyingBuilder: underlying_ is null, this is unexpected");
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
void setBondName()
set name of bond
std::string identifierType_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
QuantLib::Size deliveryRollDays_
std::string futureExpiryDate_
QuantLib::Size futureMonthOffset_
std::string futureContractMonth_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
std::string deliveryRollCalendar_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
void setEquityName()
set name of equity
std::string identifierType_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
const std::string & name() const override
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
QuantLib::CPI::InterpolationType interpolation_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
void fromXML(XMLNode *node) override
QuantLib::ext::shared_ptr< Underlying > underlying_
XMLNode * toXML(ore::data::XMLDocument &doc) const override
const std::string nodeName_
const std::string basicUnderlyingNodeName_
Class to hold Underlyings.
std::string basicUnderlyingNodeName_
const std::string & type() const
virtual void fromXML(ore::data::XMLNode *node) override
virtual const std::string & name() const
Underlying()
Default Constructor.
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void setType(const string &type)
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
static string getNodeName(XMLNode *n)
Get and set a node's name.
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)
QuantLib::CPI::InterpolationType parseObservationInterpolation(const std::string &s)
Convert string to observation interpolation.
Real parseReal(const string &s)
Convert text to Real.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.