23#include <ql/errors.hpp>
37 : notional_(Null<Real>()), priorNotional_(Null<Real>()), weight_(Null<Real>()), priorWeight_(Null<Real>()),
38 recovery_(Null<Real>()), weightInsteadOfNotional_(false) {}
41 const string& currency,
const string& qualifier, Real priorNotional, Real recovery,
42 const Date& auctionDate,
const Date& auctionSettlementDate,
43 const Date& defaultDate,
const Date& eventDeterminationDate)
44 : issuerName_(issuerName), creditCurveId_(creditCurveId), notional_(notional), currency_(currency),
45 qualifier_(qualifier), priorNotional_(priorNotional), weight_(Null<Real>()), priorWeight_(Null<Real>()),
46 recovery_(recovery), auctionDate_(auctionDate), auctionSettlementDate_(auctionSettlementDate),
47 defaultDate_(defaultDate), eventDeterminationDate_(eventDeterminationDate), weightInsteadOfNotional_(false) {}
50 const string& qualifier, Real priorWeight, Real recovery,
const Date& auctionDate,
51 const Date& auctionSettlementDate,
const Date& defaultDate,
52 const Date& eventDeterminationDate)
53 : issuerName_(issuerName), creditCurveId_(creditCurveId), notional_(Null<Real>()), currency_(
""),
54 qualifier_(qualifier), priorNotional_(), weight_(weight), priorWeight_(priorWeight), recovery_(recovery),
55 auctionDate_(auctionDate), auctionSettlementDate_(auctionSettlementDate), defaultDate_(defaultDate),
56 eventDeterminationDate_(eventDeterminationDate), weightInsteadOfNotional_(true) {}
60 Real notional,
const string& currency,
const string& qualifier, Real priorNotional,
61 Real recovery,
const Date& auctionDate,
const Date& auctionSettlementDate,
62 const Date& defaultDate,
const Date& eventDeterminationDate)
63 : issuerName_(issuerName), cdsReferenceInfo_(cdsReferenceInfo), creditCurveId_(cdsReferenceInfo_->id()),
64 notional_(notional), currency_(currency), qualifier_(qualifier), priorNotional_(priorNotional),
65 weight_(Null<Real>()), priorWeight_(Null<Real>()), recovery_(recovery), auctionDate_(auctionDate),
66 auctionSettlementDate_(auctionSettlementDate), defaultDate_(defaultDate),
67 eventDeterminationDate_(eventDeterminationDate), weightInsteadOfNotional_(false) {}
81 QL_REQUIRE(tmp,
"Need either a CreditCurveId or ReferenceInformation node in each BasketConstituent.");
87 bool zeroWeightOrZeroNotional =
false;
93 zeroWeightOrZeroNotional =
true;
96 QL_REQUIRE(weightNode,
"a 'Notional' or 'Weight' node is mandatory.");
100 zeroWeightOrZeroNotional =
true;
103 if (zeroWeightOrZeroNotional) {
218 <<
issuerName_ <<
", but weight instead of notional given");
282 auto cNode = c.toXML(doc);
credit basket data model and serialization
const std::string & currency() const
QuantLib::Date eventDeterminationDate_
QuantLib::Real weight() const
QuantLib::Date auctionDate_
QuantLib::Real priorNotional_
bool weightInsteadOfNotional() const
const QuantLib::Date & defaultDate() const
boost::optional< ore::data::CdsReferenceInformation > cdsReferenceInfo_
BasketConstituent()
Default constructor.
void fromXML(ore::data::XMLNode *node) override
QuantLib::Real notional() const
std::string creditCurveId_
QuantLib::Real priorNotional() const
const QuantLib::Date & eventDeterminationDate() const
QuantLib::Date defaultDate_
QuantLib::Real recovery() const
const QuantLib::Date & auctionDate() const
QuantLib::Real priorWeight() const
bool weightInsteadOfNotional_
const boost::optional< ore::data::CdsReferenceInformation > & cdsReferenceInfo() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
QuantLib::Real priorWeight_
const std::string & issuerName() const
const QuantLib::Date & auctionSettlementDate() const
QuantLib::Date auctionSettlementDate_
const std::string & creditCurveId() const
void fromXML(ore::data::XMLNode *node) override
const std::vector< BasketConstituent > & constituents() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
BasketData()
Default constructor.
std::vector< BasketConstituent > constituents_
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 * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
static void appendNode(XMLNode *parent, XMLNode *child)
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Real parseReal(const string &s)
Convert text to Real.
Classes and functions for log message handling.
bool operator<(const Dividend &d1, const Dividend &d2)
std::string to_string(const LocationInfo &l)
Serializable Credit Default Swap.
string conversion utilities