Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
IndexCreditDefaultSwapData Class Reference

#include <ored/portfolio/indexcreditdefaultswapdata.hpp>

+ Inheritance diagram for IndexCreditDefaultSwapData:
+ Collaboration diagram for IndexCreditDefaultSwapData:

Public Types

using PPT = QuantExt::CreditDefaultSwap::ProtectionPaymentTime
 
- Public Types inherited from CreditDefaultSwapData
using PPT = QuantLib::CreditDefaultSwap::ProtectionPaymentTime
 

Public Member Functions

 IndexCreditDefaultSwapData ()
 Default constructor. More...
 
 IndexCreditDefaultSwapData (const std::string &creditCurveId, const BasketData &basket, const ore::data::LegData &leg, const bool settlesAccrual=true, const PPT protectionPaymentTime=PPT::atDefault, const QuantLib::Date &protectionStart=QuantLib::Date(), const QuantLib::Date &upfrontDate=QuantLib::Date(), const QuantLib::Real upfrontFee=QuantLib::Null< QuantLib::Real >(), const QuantLib::Date &tradeDate=QuantLib::Date(), const std::string &cashSettlementDays="", const bool rebatesAccrual=true)
 Detailed constructor. More...
 
XMLSerializable interface
void fromXML (ore::data::XMLNode *node) override
 
ore::data::XMLNodetoXML (ore::data::XMLDocument &doc) const override
 
Inspectors
const BasketDatabasket () const
 
std::string creditCurveIdWithTerm () const
 
void setIndexStartDateHint (const QuantLib::Date &d) const
 
const QuantLib::Date & indexStartDateHint () const
 
- Public Member Functions inherited from CreditDefaultSwapData
 CreditDefaultSwapData ()
 Default constructor. More...
 
 CreditDefaultSwapData (const string &issuerId, const string &creditCurveId, const LegData &leg, const bool settlesAccrual=true, const PPT protectionPaymentTime=PPT::atDefault, const Date &protectionStart=Date(), const Date &upfrontDate=Date(), const Real upfrontFee=Null< Real >(), QuantLib::Real recoveryRate=QuantLib::Null< QuantLib::Real >(), const std::string &referenceObligation="", const Date &tradeDate=Date(), const std::string &cashSettlementDays="", const bool rebatesAccrual=true)
 Constructor that takes an explicit creditCurveId. More...
 
 CreditDefaultSwapData (const std::string &issuerId, const CdsReferenceInformation &referenceInformation, const LegData &leg, bool settlesAccrual=true, const PPT protectionPaymentTime=PPT::atDefault, const QuantLib::Date &protectionStart=QuantLib::Date(), const QuantLib::Date &upfrontDate=QuantLib::Date(), QuantLib::Real upfrontFee=QuantLib::Null< QuantLib::Real >(), QuantLib::Real recoveryRate=QuantLib::Null< QuantLib::Real >(), const std::string &referenceObligation="", const Date &tradeDate=Date(), const std::string &cashSettlementDays="", const bool rebatesAccrual=true)
 Constructor that takes a referenceInformation object. More...
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
const string & issuerId () const
 
const string & creditCurveId () const
 
const LegDataleg () const
 
bool settlesAccrual () const
 
PPT protectionPaymentTime () const
 
const Date & protectionStart () const
 
const Date & upfrontDate () const
 
Real upfrontFee () const
 
bool rebatesAccrual () const
 
QuantLib::Real recoveryRate () const
 
const std::string & referenceObligation () const
 CDS Reference Obligation. More...
 
const QuantLib::Date & tradeDate () const
 
QuantLib::Natural cashSettlementDays () const
 
const boost::optional< CdsReferenceInformation > & referenceInformation () const
 
- Public Member Functions inherited from XMLSerializable
virtual ~XMLSerializable ()
 
virtual void fromXML (XMLNode *node)=0
 
virtual XMLNodetoXML (XMLDocument &doc) const =0
 
void fromFile (const std::string &filename)
 
void toFile (const std::string &filename) const
 
void fromXMLString (const std::string &xml)
 Parse from XML string. More...
 
std::string toXMLString () const
 Parse from XML string. More...
 

CreditDefaultSwapData interface

BasketData basket_
 
QuantLib::Date indexStartDateHint_
 
void check (ore::data::XMLNode *node) const override
 
ore::data::XMLNodealloc (ore::data::XMLDocument &doc) const override
 

Additional Inherited Members

virtual void check (XMLNode *node) const
 
virtual XMLNodealloc (XMLDocument &doc) const
 

Detailed Description

Definition at line 30 of file indexcreditdefaultswapdata.hpp.

Member Typedef Documentation

◆ PPT

using PPT = QuantExt::CreditDefaultSwap::ProtectionPaymentTime

Definition at line 35 of file indexcreditdefaultswapdata.hpp.

Constructor & Destructor Documentation

◆ IndexCreditDefaultSwapData() [1/2]

Default constructor.

Definition at line 44 of file indexcreditdefaultswapdata.cpp.

44{}

◆ IndexCreditDefaultSwapData() [2/2]

IndexCreditDefaultSwapData ( const std::string &  creditCurveId,
const BasketData basket,
const ore::data::LegData leg,
const bool  settlesAccrual = true,
const PPT  protectionPaymentTime = PPT::atDefault,
const QuantLib::Date &  protectionStart = QuantLib::Date(),
const QuantLib::Date &  upfrontDate = QuantLib::Date(),
const QuantLib::Real  upfrontFee = QuantLib::Null< QuantLib::Real >(),
const QuantLib::Date &  tradeDate = QuantLib::Date(),
const std::string &  cashSettlementDays = "",
const bool  rebatesAccrual = true 
)

Detailed constructor.

Member Function Documentation

◆ fromXML()

void fromXML ( ore::data::XMLNode node)
overridevirtual

Reimplemented from CreditDefaultSwapData.

Definition at line 61 of file indexcreditdefaultswapdata.cpp.

61 {
62
64
65 if (auto basketNode = XMLUtils::getChildNode(node, "BasketData"))
66 basket_.fromXML(basketNode);
67
68 indexStartDateHint_ = parseDate(XMLUtils::getChildValue(node, "IndexStartDateHint", false));
69}
void fromXML(ore::data::XMLNode *node) override
Definition: basketdata.cpp:265
void fromXML(XMLNode *node) override
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

XMLNode * toXML ( ore::data::XMLDocument doc) const
overridevirtual

Reimplemented from CreditDefaultSwapData.

Definition at line 71 of file indexcreditdefaultswapdata.cpp.

71 {
72
75 if(indexStartDateHint_ != Date()) {
76 XMLUtils::addChild(doc, node, "IndexStartDateHint", ore::data::to_string(indexStartDateHint_));
77 }
78
79 return node;
80}
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
Definition: basketdata.cpp:277
XMLNode * toXML(XMLDocument &doc) const override
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ basket()

const BasketData & basket ( ) const

Definition at line 58 of file indexcreditdefaultswapdata.hpp.

58{ return basket_; }
+ Here is the caller graph for this function:

◆ creditCurveIdWithTerm()

std::string creditCurveIdWithTerm ( ) const

Get credit curve id with term suffix "_5Y". If the creditCurveId contains such a suffix already this is used. Otherwise we try to imply it from the schedule. If that is not possible, the creditCurveId without tenor is returned.

Definition at line 90 of file indexcreditdefaultswapdata.cpp.

90 {
92 if (p.second != 0 * Days)
93 return creditCurveId();
94 QuantLib::Schedule s = makeSchedule(leg().schedule());
95 if (s.dates().empty())
96 return p.first;
97 QuantLib::Period t = QuantExt::implyIndexTerm(
98 indexStartDateHint_ == Date() ? s.dates().front() : indexStartDateHint_, s.dates().back());
99 if (t != 0 * Days)
100 return p.first + "_" + ore::data::to_string(t);
101 return p.first;
102}
QuantLib::Period implyIndexTerm(const Date &startDate, const Date &endDate)
std::pair< std::string, QuantLib::Period > splitCurveIdWithTenor(const std::string &creditCurveId)
Definition: marketdata.cpp:231
Schedule makeSchedule(const ScheduleDates &data)
Definition: schedule.cpp:263
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIndexStartDateHint()

void setIndexStartDateHint ( const QuantLib::Date &  d) const

If set this is used to derive the term instead of the schedule start date. A concession to bad trade setups really, where the start date is not set to the index effective date

Definition at line 68 of file indexcreditdefaultswapdata.hpp.

◆ indexStartDateHint()

const QuantLib::Date & indexStartDateHint ( ) const

Get the index start date hint, or null if it was never set

Definition at line 71 of file indexcreditdefaultswapdata.hpp.

71{ return indexStartDateHint_; }
+ Here is the caller graph for this function:

◆ check()

void check ( ore::data::XMLNode node) const
overrideprotectedvirtual

Reimplemented from CreditDefaultSwapData.

Definition at line 82 of file indexcreditdefaultswapdata.cpp.

82 {
83 XMLUtils::checkNode(node, "IndexCreditDefaultSwapData");
84}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
+ Here is the call graph for this function:

◆ alloc()

XMLNode * alloc ( ore::data::XMLDocument doc) const
overrideprotectedvirtual

Reimplemented from CreditDefaultSwapData.

Definition at line 86 of file indexcreditdefaultswapdata.cpp.

86 {
87 return doc.allocNode("IndexCreditDefaultSwapData");
88}
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
+ Here is the call graph for this function:

Member Data Documentation

◆ basket_

BasketData basket_
private

Definition at line 81 of file indexcreditdefaultswapdata.hpp.

◆ indexStartDateHint_

QuantLib::Date indexStartDateHint_
mutableprivate

Definition at line 82 of file indexcreditdefaultswapdata.hpp.