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

Equity curve configuration. More...

#include <ored/configuration/equitycurveconfig.hpp>

+ Inheritance diagram for EquityCurveConfig:
+ Collaboration diagram for EquityCurveConfig:

Public Types

enum class  Type {
  DividendYield , ForwardPrice , OptionPremium , NoDividends ,
  ForwardDividendPrice
}
 Supported equity curve types. More...
 

Public Member Functions

Constructors/Destructors
 EquityCurveConfig (const string &curveID, const string &curveDescription, const string &forecastingCurve, const string &currency, const string &calendar, const Type &type, const string &equitySpotQuote, const vector< string > &quotes, const string &dayCountID="", const string &dividendInterpVariable="Zero", const string &dividendInterpMethod="Linear", const bool dividendExtrapolation=false, const bool extrapolation=false, const QuantLib::Exercise::Type &exerciseStyle=QuantLib::Exercise::Type::European)
 Detailed constructor. More...
 
 EquityCurveConfig ()
 Default constructor. More...
 
Serialisation
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
Inspectors
const string & forecastingCurve () const
 
const string & currency () const
 
const string & calendar () const
 
const Typetype () const
 
const string & equitySpotQuoteID () const
 
const string & dayCountID () const
 
const string & dividendInterpolationVariable () const
 
const string & dividendInterpolationMethod () const
 
bool dividendExtrapolation () const
 
bool extrapolation () const
 
const QuantLib::Exercise::Type exerciseStyle () const
 
const vector< string > & fwdQuotes ()
 
- Public Member Functions inherited from CurveConfig
 CurveConfig (const string &curveID, const string &curveDescription, const vector< string > &quotes=vector< string >())
 Detailed constructor. More...
 
 CurveConfig ()
 Default constructor. More...
 
const string & curveID () const
 
const string & curveDescription () const
 
const set< string > & requiredCurveIds (const CurveSpec::CurveType &curveType) const
 
const map< CurveSpec::CurveType, set< string > > & requiredCurveIds () const
 
string & curveID ()
 
string & curveDescription ()
 
set< string > & requiredCurveIds (const CurveSpec::CurveType &curveType)
 
map< CurveSpec::CurveType, set< string > > & requiredCurveIds ()
 
virtual const vector< string > & quotes ()
 Return all the market quotes required for this config. More...
 
- 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...
 

Setters

vector< string > fwdQuotes_
 
string forecastingCurve_
 
string currency_
 
string calendar_
 
Type type_
 
string equitySpotQuoteID_
 
string dayCountID_
 
string divInterpVariable_
 
string divInterpMethod_
 
bool dividendExtrapolation_
 
bool extrapolation_
 
QuantLib::Exercise::Type exerciseStyle_
 
string & forecastingCurve ()
 
Typetype ()
 
string & equitySpotQuoteID ()
 
string & dayCountID ()
 
string & dividendInterpolationVariable ()
 
string & dividendInterpolationMethod ()
 
booldividendExtrapolation ()
 
boolextrapolation ()
 
QuantLib::Exercise::Type & exerciseStyle ()
 
void setCurrency (const string &currency)
 
void setCalendar (const string &calendar)
 
void populateRequiredCurveIds ()
 

Additional Inherited Members

- Protected Attributes inherited from CurveConfig
string curveID_
 
string curveDescription_
 
vector< string > quotes_
 
map< CurveSpec::CurveType, set< string > > requiredCurveIds_
 

Detailed Description

Equity curve configuration.

Definition at line 48 of file equitycurveconfig.hpp.

Member Enumeration Documentation

◆ Type

enum class Type
strong

Supported equity curve types.

Enumerator
DividendYield 
ForwardPrice 
OptionPremium 
NoDividends 
ForwardDividendPrice 

Definition at line 51 of file equitycurveconfig.hpp.

Constructor & Destructor Documentation

◆ EquityCurveConfig() [1/2]

EquityCurveConfig ( const string &  curveID,
const string &  curveDescription,
const string &  forecastingCurve,
const string &  currency,
const string &  calendar,
const Type type,
const string &  equitySpotQuote,
const vector< string > &  quotes,
const string &  dayCountID = "",
const string &  dividendInterpVariable = "Zero",
const string &  dividendInterpMethod = "Linear",
const bool  dividendExtrapolation = false,
const bool  extrapolation = false,
const QuantLib::Exercise::Type &  exerciseStyle = QuantLib::Exercise::Type::European 
)

Detailed constructor.

Definition at line 29 of file equitycurveconfig.cpp.

38 divInterpVariable_(dividendInterpVariable), divInterpMethod_(dividendInterpMethod), dividendExtrapolation_(dividendExtrapolation),
41 quotes_.insert(quotes_.begin(), equitySpotQuote);
43}
vector< string > quotes_
Definition: curveconfig.hpp:74
const string & curveDescription() const
Definition: curveconfig.hpp:55
const string & curveID() const
Definition: curveconfig.hpp:54
CurveConfig()
Default constructor.
Definition: curveconfig.hpp:49
const string & forecastingCurve() const
const string & currency() const
QuantLib::Exercise::Type exerciseStyle_
const vector< string > & fwdQuotes()
const string & dayCountID() const
const string & calendar() const
const QuantLib::Exercise::Type exerciseStyle() const
+ Here is the call graph for this function:

◆ EquityCurveConfig() [2/2]

Default constructor.

Definition at line 62 of file equitycurveconfig.hpp.

62{}

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 50 of file equitycurveconfig.cpp.

50 {
51 XMLUtils::checkNode(node, "EquityCurve");
52
53 curveID_ = XMLUtils::getChildValue(node, "CurveId", true);
54 curveDescription_ = XMLUtils::getChildValue(node, "CurveDescription", true);
55 forecastingCurve_ = XMLUtils::getChildValue(node, "ForecastingCurve", true);
56 currency_ = XMLUtils::getChildValue(node, "Currency", true);
57 calendar_ = XMLUtils::getChildValue(node, "Calendar", false);
60 exerciseStyle_ = parseExerciseType(XMLUtils::getChildValue(node, "ExerciseStyle", true));
61 equitySpotQuoteID_ = XMLUtils::getChildValue(node, "SpotQuote", true);
62 dayCountID_ = XMLUtils::getChildValue(node, "DayCounter", false);
63 fwdQuotes_ = XMLUtils::getChildrenValues(node, "Quotes", "Quote");
65 if (equitySpotQuoteID_ != "")
66 quotes_.insert(quotes_.begin(), equitySpotQuoteID_);
67
68 XMLNode* divInterpNode = XMLUtils::getChildNode(node, "DividendInterpolation");
69 if (divInterpNode) {
70 divInterpVariable_ = XMLUtils::getChildValue(divInterpNode, "InterpolationVariable", true);
71 divInterpMethod_ = XMLUtils::getChildValue(divInterpNode, "InterpolationMethod", true);
72 } else {
73 divInterpVariable_ = "Zero";
74 divInterpMethod_ = divInterpVariable_ == "Zero" ? "Linear" : "LogLinear";
75 }
76 dividendExtrapolation_ = XMLUtils::getChildValueAsBool(node, "DividendExtrapolation", false, false);
77 extrapolation_ = XMLUtils::getChildValueAsBool(node, "Extrapolation", false, false);
78
79 if (type_ == Type::NoDividends) {
80 QL_REQUIRE(fwdQuotes_.size() == 0,
81 "Invalid EquityCurveConfig, no Quotes should be present when type=NoDividends");
82 QL_REQUIRE(divInterpNode == nullptr,
83 "Invalid EquityCurveConfig, no DividendInterpolation should be present when type=NoDividends");
84 } else {
85 QL_REQUIRE(fwdQuotes_.size() > 0, "Invalid EquityCurveConfig, Quotes should be present when type!=NoDividends");
86 }
88}
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
Definition: xmlutils.cpp:296
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static vector< string > getChildrenValues(XMLNode *node, const string &names, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:306
Exercise::Type parseExerciseType(const std::string &s)
Convert text to QuantLib::Exercise::Type.
Definition: parsers.cpp:466
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
EquityCurveConfig::Type parseEquityCurveConfigType(const std::string &str)
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 90 of file equitycurveconfig.cpp.

90 {
91 XMLNode* node = doc.allocNode("EquityCurve");
92 XMLUtils::addChild(doc, node, "CurveId", curveID_);
93 XMLUtils::addChild(doc, node, "CurveDescription", curveDescription_);
94 XMLUtils::addChild(doc, node, "Currency", currency_);
95 XMLUtils::addChild(doc, node, "Calendar", calendar_);
96 XMLUtils::addChild(doc, node, "ForecastingCurve", forecastingCurve_);
97 XMLUtils::addChild(doc, node, "Type", to_string(type_));
99 XMLUtils::addChild(doc, node, "ExerciseStyle", to_string(exerciseStyle_));
100 XMLUtils::addChild(doc, node, "SpotQuote", equitySpotQuoteID_);
101 XMLUtils::addChildren(doc, node, "Quotes", "Quote", fwdQuotes_);
102 XMLUtils::addChild(doc, node, "DayCounter", dayCountID_);
103
104 if (type_ != Type::NoDividends) {
105 XMLNode* divInterpNode = XMLUtils::addChild(doc, node, "DividendInterpolation");
106 XMLUtils::addChild(doc, divInterpNode, "InterpolationVariable", divInterpVariable_);
107 XMLUtils::addChild(doc, divInterpNode, "InterpolationMethod", divInterpMethod_);
108 }
109 XMLUtils::addChild(doc, node, "DividendExtrapolation", dividendExtrapolation_);
110 XMLUtils::addChild(doc, node, "Extrapolation", extrapolation_);
111
112 return node;
113}
static void addChildren(XMLDocument &doc, XMLNode *n, const string &names, const string &name, const vector< T > &values)
Definition: xmlutils.cpp:502
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ forecastingCurve() [1/2]

const string & forecastingCurve ( ) const

Definition at line 73 of file equitycurveconfig.hpp.

73{ return forecastingCurve_; }
+ Here is the caller graph for this function:

◆ currency()

const string & currency ( ) const

Definition at line 74 of file equitycurveconfig.hpp.

74{ return parseCurrencyWithMinors(currency_).code(); }
Currency parseCurrencyWithMinors(const string &s)
Convert text to QuantLib::Currency.
Definition: parsers.cpp:310
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calendar()

const string & calendar ( ) const

Definition at line 75 of file equitycurveconfig.hpp.

75{ return calendar_; }
+ Here is the caller graph for this function:

◆ type() [1/2]

const Type & type ( ) const

Definition at line 76 of file equitycurveconfig.hpp.

76{ return type_; }

◆ equitySpotQuoteID() [1/2]

const string & equitySpotQuoteID ( ) const

Definition at line 77 of file equitycurveconfig.hpp.

77{ return equitySpotQuoteID_; }

◆ dayCountID() [1/2]

const string & dayCountID ( ) const

Definition at line 78 of file equitycurveconfig.hpp.

78{ return dayCountID_; }

◆ dividendInterpolationVariable() [1/2]

const string & dividendInterpolationVariable ( ) const

Definition at line 79 of file equitycurveconfig.hpp.

79{ return divInterpVariable_; }

◆ dividendInterpolationMethod() [1/2]

const string & dividendInterpolationMethod ( ) const

Definition at line 80 of file equitycurveconfig.hpp.

80{ return divInterpMethod_; }

◆ dividendExtrapolation() [1/2]

bool dividendExtrapolation ( ) const

Definition at line 81 of file equitycurveconfig.hpp.

81{ return dividendExtrapolation_; }

◆ extrapolation() [1/2]

bool extrapolation ( ) const

Definition at line 82 of file equitycurveconfig.hpp.

82{ return extrapolation_; }

◆ exerciseStyle() [1/2]

const QuantLib::Exercise::Type exerciseStyle ( ) const

Definition at line 83 of file equitycurveconfig.hpp.

83{ return exerciseStyle_; }

◆ fwdQuotes()

const vector< string > & fwdQuotes ( )

Definition at line 84 of file equitycurveconfig.hpp.

84{ return fwdQuotes_; }
+ Here is the caller graph for this function:

◆ forecastingCurve() [2/2]

string & forecastingCurve ( )

Definition at line 89 of file equitycurveconfig.hpp.

89{ return forecastingCurve_; }

◆ type() [2/2]

Type & type ( )

Definition at line 90 of file equitycurveconfig.hpp.

90{ return type_; }

◆ equitySpotQuoteID() [2/2]

string & equitySpotQuoteID ( )

Definition at line 91 of file equitycurveconfig.hpp.

91{ return equitySpotQuoteID_; }

◆ dayCountID() [2/2]

string & dayCountID ( )

Definition at line 92 of file equitycurveconfig.hpp.

92{ return dayCountID_; }

◆ dividendInterpolationVariable() [2/2]

string & dividendInterpolationVariable ( )

Definition at line 93 of file equitycurveconfig.hpp.

93{ return divInterpVariable_; }

◆ dividendInterpolationMethod() [2/2]

string & dividendInterpolationMethod ( )

Definition at line 94 of file equitycurveconfig.hpp.

94{ return divInterpMethod_; }

◆ dividendExtrapolation() [2/2]

bool & dividendExtrapolation ( )

Definition at line 95 of file equitycurveconfig.hpp.

95{ return dividendExtrapolation_; }

◆ extrapolation() [2/2]

bool & extrapolation ( )

Definition at line 96 of file equitycurveconfig.hpp.

96{ return extrapolation_; }

◆ exerciseStyle() [2/2]

QuantLib::Exercise::Type & exerciseStyle ( )

Definition at line 97 of file equitycurveconfig.hpp.

97{ return exerciseStyle_; }

◆ setCurrency()

void setCurrency ( const string &  currency)

Definition at line 99 of file equitycurveconfig.hpp.

+ Here is the call graph for this function:

◆ setCalendar()

void setCalendar ( const string &  calendar)

Definition at line 100 of file equitycurveconfig.hpp.

100{ calendar_ = calendar; }
+ Here is the call graph for this function:

◆ populateRequiredCurveIds()

void populateRequiredCurveIds ( )
private

Definition at line 45 of file equitycurveconfig.cpp.

45 {
46 if (!forecastingCurve().empty())
48}
map< CurveSpec::CurveType, set< string > > requiredCurveIds_
Definition: curveconfig.hpp:75
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ fwdQuotes_

vector<string> fwdQuotes_
private

Definition at line 106 of file equitycurveconfig.hpp.

◆ forecastingCurve_

string forecastingCurve_
private

Definition at line 107 of file equitycurveconfig.hpp.

◆ currency_

string currency_
private

Definition at line 108 of file equitycurveconfig.hpp.

◆ calendar_

string calendar_
private

Definition at line 109 of file equitycurveconfig.hpp.

◆ type_

Type type_
private

Definition at line 110 of file equitycurveconfig.hpp.

◆ equitySpotQuoteID_

string equitySpotQuoteID_
private

Definition at line 111 of file equitycurveconfig.hpp.

◆ dayCountID_

string dayCountID_
private

Definition at line 112 of file equitycurveconfig.hpp.

◆ divInterpVariable_

string divInterpVariable_
private

Definition at line 113 of file equitycurveconfig.hpp.

◆ divInterpMethod_

string divInterpMethod_
private

Definition at line 114 of file equitycurveconfig.hpp.

◆ dividendExtrapolation_

bool dividendExtrapolation_
private

Definition at line 115 of file equitycurveconfig.hpp.

◆ extrapolation_

bool extrapolation_
private

Definition at line 116 of file equitycurveconfig.hpp.

◆ exerciseStyle_

QuantLib::Exercise::Type exerciseStyle_
private

Definition at line 117 of file equitycurveconfig.hpp.