30template <
typename T> std::string toCommaSeparatedList(
const std::vector<T>& d) {
32 for (Size i = 0; i < d.size(); ++i)
33 o << d[i] << (i < d.size() - 1 ?
"," :
"");
44 for (
auto const& t : tmp) {
56 std::vector<std::string> tmp;
57 for (
auto const& d : crIncrease_) {
58 tmp.push_back(toCommaSeparatedList(d));
84 prices_ = XMLUtils::getChildrenValuesWithAttributes<double>(node,
"Prices",
"Price",
"startDate",
priceDates_,
90 isSoft_ = XMLUtils::getChildrenValuesWithAttributes<bool>(node,
"Soft",
"Soft",
"startDate",
isSoftDates_,
92 triggerRatios_ = XMLUtils::getChildrenValuesWithAttributes<double>(
125 observationDates_,
true);
126 barriers_ = XMLUtils::getChildrenValuesWithAttributes<Real>(node,
"Barriers",
"Barrier",
"startDate", barrierDates_,
164 pepsData_.fromXML(tmp);
173 if (pepsData_.initialised())
183 thresholds_ = XMLUtils::getChildrenValuesWithAttributes<double>(node,
"Thresholds",
"Threshold",
"startDate",
185 gearings_ = XMLUtils::getChildrenValuesWithAttributes<double>(node,
"Gearings",
"Gearing",
"startDate",
187 floors_ = XMLUtils::getChildrenValuesWithAttributes<double>(node,
"Floors",
"Floor",
"startDate", floorDates_,
189 globalFloors_ = XMLUtils::getChildrenValuesWithAttributes<double>(node,
"GlobalFloors",
"GlobalFloor",
"startDate",
233 amounts_ = XMLUtils::getChildrenValuesWithAttributes<double>(node,
"Amounts",
"Amount",
"startDate", amountDates_,
250 conversionRatios_ = XMLUtils::getChildrenValuesWithAttributes<double>(
251 node,
"ConversionRatios",
"ConversionRatio",
"startDate", conversionRatioDates_, &
parseReal,
false);
254 contingentConversionData_.fromXML(tmp);
258 mandatoryConversionData_.fromXML(tmp);
262 conversionResetData_.fromXML(tmp);
265 equityUnderlying_.fromXML(tmp);
269 WLOG(
"ConvertibleBondData::fromXML, node FXIndexFixingDays has been deprecated, fixing days are "
270 "taken from conventions.");
273 WLOG(
"ConvertibleBondData::fromXML, node FXIndexCalendar has been deprecated, fixing calendar is "
274 "taken from conventions.");
278 exchangeableData_.fromXML(tmp);
282 fixedAmountConversionData_.fromXML(tmp);
292 "startDate", conversionRatioDates_);
293 if (contingentConversionData_.initialised())
295 if (mandatoryConversionData_.initialised())
297 if (conversionResetData_.initialised())
300 if (!fxIndex_.empty())
302 if (exchangeableData_.initialised())
304 if (fixedAmountConversionData_.initialised())
313 "startDate", adjustmentStyleDates_,
true);
315 dividendTypeDates_,
true);
316 thresholds_ = XMLUtils::getChildrenValuesWithAttributes<double>(node,
"Thresholds",
"Threshold",
"startDate",
325 "startDate", adjustmentStyleDates_);
373 const QuantLib::ext::shared_ptr<ore::data::ReferenceDataManager>& referenceData) {
376 "ConvertibleBondData::populateFromBondReferenceData(): no security id given");
379 <<
" leave data in trade unchanged");
381 auto bondRefData = QuantLib::ext::dynamic_pointer_cast<ConvertibleBondReferenceDatum>(
383 QL_REQUIRE(bondRefData,
"could not cast to ConvertibleBondReferenceDatum, this is unexpected");
385 <<
" overwrite empty elements in trade");
387 QuantLib::ext::make_shared<BondReferenceDatum>(
bondData_.
securityId(), bondRefData->bondData()));
389 DLOG(
"overwrite CallData from reference data")
393 DLOG(
"overwrite PutData from reference data")
397 DLOG(
"overwrite ConversionData from reference data")
401 DLOG(
"overwrite DividendProtectionData from reference data")
405 DLOG(
"overwrite detachable from reference data");
const string & securityId() const
void populateFromBondReferenceData(const QuantLib::ext::shared_ptr< BondReferenceDatum > &referenceDatum, const std::string &startDate="", const std::string &endDate="")
populate data from reference datum and check data for completeness
virtual void fromXML(XMLNode *node) override
XMLSerializable interface.
virtual XMLNode * toXML(XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::vector< double > stockPrices_
std::vector< std::vector< double > > crIncrease_
std::vector< std::string > crIncreaseDates_
ConversionRatioIncreaseData conversionRatioIncreaseData_
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::vector< std::string > nOfMTriggers_
std::vector< double > triggerRatios_
std::vector< std::string > includeAccrualDates_
std::vector< std::string > isSoftDates_
MakeWholeData makeWholeData_
std::vector< std::string > styleDates_
std::vector< std::string > priceTypes_
std::vector< std::string > priceDates_
void fromXML(ore::data::XMLNode *node) override
std::vector< std::string > triggerRatioDates_
std::vector< double > prices_
std::vector< bool > includeAccrual_
std::vector< std::string > priceTypeDates_
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::vector< std::string > nOfMTriggerDates_
std::vector< bool > isSoft_
std::vector< std::string > styles_
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
CallabilityData callData_
void fromXML(ore::data::XMLNode *node) override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ConversionData conversionData_
DividendProtectionData dividendProtectionData_
void populateFromBondReferenceData(const QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > &referenceData)
ore::data::BondData bondData_
static constexpr const char * TYPE
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static void addChildrenWithAttributes(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values, const string &attrName, const vector< string > &attrs)
static void checkNode(XMLNode *n, const string &expectedName)
static vector< XMLNode * > getChildrenNodes(XMLNode *node, const string &name)
Returns all the children with a given name.
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 bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static void addChildrenWithOptionalAttributes(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values, const string &attrName, const vector< string > &attrs)
static string getNodeValue(XMLNode *node)
Get a node's value.
static vector< string > getChildrenValuesWithAttributes(XMLNode *node, const string &names, const string &name, const string &attrName, vector< string > &attrs, bool mandatory=false)
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
static void appendNode(XMLNode *parent, XMLNode *child)
convertible bond data model and serialization
bool parseBool(const string &s)
Convert text to bool.
Real parseReal(const string &s)
Convert text to Real.
#define DLOG(text)
Logging Macro (Level = Debug)
#define WLOG(text)
Logging Macro (Level = Warning)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.