Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
List of all members
WeightedAverageYieldCurveSegment Class Reference

Weighted average yield curve segment. More...

#include <ored/configuration/yieldcurveconfig.hpp>

+ Inheritance diagram for WeightedAverageYieldCurveSegment:
+ Collaboration diagram for WeightedAverageYieldCurveSegment:

Public Member Functions

Constructors/Destructors
 WeightedAverageYieldCurveSegment ()
 Default constructor. More...
 
 WeightedAverageYieldCurveSegment (const string &typeID, const string &referenceCurveID1, const string &referenceCurveID2, const Real weight1, const Real weight2)
 Detailed constructor. More...
 
virtual ~WeightedAverageYieldCurveSegment ()
 Default destructor. More...
 
Serialisation
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
Inspectors
const string & referenceCurveID1 () const
 
const string & referenceCurveID2 () const
 
Real weight1 () const
 
Real weight2 () const
 
- Public Member Functions inherited from YieldCurveSegment
virtual ~YieldCurveSegment ()
 Default destructor. More...
 
Type type () const
 
const string & typeID () const
 
const string & conventionsID () const
 
const QuantLib::Pillar::Choice pillarChoice () const
 
Size priority () const
 
Size minDistance () const
 
const vector< pair< string, bool > > & quotes () 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...
 

Visitability

string referenceCurveID1_
 
string referenceCurveID2_
 
double weight1_
 
double weight2_
 
virtual void accept (AcyclicVisitor &) override
 

Additional Inherited Members

- Public Types inherited from YieldCurveSegment
enum class  Type {
  Zero , ZeroSpread , Discount , Deposit ,
  FRA , Future , OIS , Swap ,
  AverageOIS , TenorBasis , TenorBasisTwo , BMABasis ,
  FXForward , CrossCcyBasis , CrossCcyFixFloat , DiscountRatio ,
  FittedBond , WeightedAverage , YieldPlusDefault , IborFallback ,
  BondYieldShifted
}
 supported segment types More...
 
- Protected Member Functions inherited from YieldCurveSegment
 YieldCurveSegment ()
 Default constructor. More...
 
 YieldCurveSegment (const string &typeID, const string &conventionsID, const vector< string > &quotes)
 Detailed constructor - assumes all quotes are mandatory. More...
 
pair< string, boolquote (const string &name, bool opt=false)
 Utility to build a quote, optional flag defaults to false. More...
 
- Protected Attributes inherited from YieldCurveSegment
vector< pair< string, bool > > quotes_
 Quote and optional flag pair. More...
 

Detailed Description

Weighted average yield curve segment.

A weighted average segment is used to build a yield curve from two source curves and weights. The resulting discount factor is the weighted sum of the source curves' discount factors.

Definition at line 389 of file yieldcurveconfig.hpp.

Constructor & Destructor Documentation

◆ WeightedAverageYieldCurveSegment() [1/2]

Default constructor.

Definition at line 394 of file yieldcurveconfig.hpp.

394{}

◆ WeightedAverageYieldCurveSegment() [2/2]

WeightedAverageYieldCurveSegment ( const string &  typeID,
const string &  referenceCurveID1,
const string &  referenceCurveID2,
const Real  weight1,
const Real  weight2 
)

◆ ~WeightedAverageYieldCurveSegment()

virtual ~WeightedAverageYieldCurveSegment ( )
virtual

Default destructor.

Definition at line 399 of file yieldcurveconfig.hpp.

399{}

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Reimplemented from YieldCurveSegment.

Definition at line 779 of file yieldcurveconfig.cpp.

779 {
780 XMLUtils::checkNode(node, "WeightedAverage");
782 referenceCurveID1_ = XMLUtils::getChildValue(node, "ReferenceCurve1", true);
783 referenceCurveID2_ = XMLUtils::getChildValue(node, "ReferenceCurve2", true);
784 weight1_ = XMLUtils::getChildValueAsDouble(node, "Weight1", true);
785 weight2_ = XMLUtils::getChildValueAsDouble(node, "Weight2", true);
786}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
Definition: xmlutils.cpp:286
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
virtual void fromXML(XMLNode *node) override
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Reimplemented from YieldCurveSegment.

Definition at line 788 of file yieldcurveconfig.cpp.

788 {
790 XMLUtils::setNodeName(doc, node, "WeightedAverage");
791 XMLUtils::addChild(doc, node, "ReferenceCurve1", referenceCurveID1_);
792 XMLUtils::addChild(doc, node, "ReferenceCurve2", referenceCurveID2_);
793 XMLUtils::addChild(doc, node, "Weight1", weight1_);
794 XMLUtils::addChild(doc, node, "Weight2", weight2_);
795 return node;
796}
static void setNodeName(XMLDocument &doc, XMLNode *node, const string &name)
Definition: xmlutils.cpp:478
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
virtual XMLNode * toXML(XMLDocument &doc) const override
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ referenceCurveID1()

const string & referenceCurveID1 ( ) const

Definition at line 408 of file yieldcurveconfig.hpp.

408{ return referenceCurveID1_; }

◆ referenceCurveID2()

const string & referenceCurveID2 ( ) const

Definition at line 409 of file yieldcurveconfig.hpp.

409{ return referenceCurveID2_; }

◆ weight1()

Real weight1 ( ) const

Definition at line 410 of file yieldcurveconfig.hpp.

410{ return weight1_; }

◆ weight2()

Real weight2 ( ) const

Definition at line 411 of file yieldcurveconfig.hpp.

411{ return weight2_; }

◆ accept()

void accept ( AcyclicVisitor &  v)
overridevirtual

Reimplemented from YieldCurveSegment.

Definition at line 798 of file yieldcurveconfig.cpp.

798 {
799 Visitor<WeightedAverageYieldCurveSegment>* v1 = dynamic_cast<Visitor<WeightedAverageYieldCurveSegment>*>(&v);
800 if (v1 != 0)
801 v1->visit(*this);
802 else
804}
virtual void accept(AcyclicVisitor &)
+ Here is the call graph for this function:

Member Data Documentation

◆ referenceCurveID1_

string referenceCurveID1_
private

Definition at line 420 of file yieldcurveconfig.hpp.

◆ referenceCurveID2_

string referenceCurveID2_
private

Definition at line 420 of file yieldcurveconfig.hpp.

◆ weight1_

double weight1_
private

Definition at line 421 of file yieldcurveconfig.hpp.

◆ weight2_

double weight2_
private

Definition at line 421 of file yieldcurveconfig.hpp.