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

#include <ored/configuration/commoditycurveconfig.hpp>

+ Inheritance diagram for PriceSegment:
+ Collaboration diagram for PriceSegment:

Classes

class  OffPeakDaily
 Class to store quotes used in building daily off-peak power quotes. More...
 

Public Types

enum class  Type {
  Future , AveragingFuture , AveragingSpot , AveragingOffPeakPower ,
  OffPeakPowerDaily
}
 Type of price segment being represented, i.e. type of instrument in the price segment. More...
 

Public Member Functions

Constructors
 PriceSegment ()
 Default constructor. More...
 
 PriceSegment (const std::string &type, const std::string &conventionsId, const std::vector< std::string > &quotes, const boost::optional< unsigned short > &priority=boost::none, const boost::optional< OffPeakDaily > &offPeakDaily=boost::none, const std::string &peakPriceCurveId="", const std::string &peakPriceCalendar="")
 Detailed constructor. More...
 
Inspectors
Type type () const
 
const std::string & conventionsId () const
 
const std::vector< std::string > & quotes () const
 
const boost::optional< unsigned short > & priority () const
 
const boost::optional< OffPeakDaily > & offPeakDaily () const
 
const std::string & peakPriceCurveId () const
 
const std::string & peakPriceCalendar () const
 
bool empty () 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...
 

Serialisation

std::string strType_
 
std::string conventionsId_
 
std::vector< std::string > quotes_
 
boost::optional< unsigned short > priority_
 
boost::optional< OffPeakDailyoffPeakDaily_
 
std::string peakPriceCurveId_
 
std::string peakPriceCalendar_
 
bool empty_
 
Type type_
 
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
void populateQuotes ()
 Populate quotes. More...
 

Detailed Description

Class for holding information on a set of instruments used in bootstrapping a piecewise price curve.

Definition at line 36 of file commoditycurveconfig.hpp.

Member Enumeration Documentation

◆ Type

enum class Type
strong

Type of price segment being represented, i.e. type of instrument in the price segment.

Enumerator
Future 
AveragingFuture 
AveragingSpot 
AveragingOffPeakPower 
OffPeakPowerDaily 

Definition at line 39 of file commoditycurveconfig.hpp.

Constructor & Destructor Documentation

◆ PriceSegment() [1/2]

Default constructor.

Definition at line 49 of file commoditycurveconfig.cpp.

◆ PriceSegment() [2/2]

PriceSegment ( const std::string &  type,
const std::string &  conventionsId,
const std::vector< std::string > &  quotes,
const boost::optional< unsigned short > &  priority = boost::none,
const boost::optional< OffPeakDaily > &  offPeakDaily = boost::none,
const std::string &  peakPriceCurveId = "",
const std::string &  peakPriceCalendar = "" 
)

Detailed constructor.

Definition at line 51 of file commoditycurveconfig.cpp.

58 QL_REQUIRE(offPeakDaily_, "When price segment type is OffPeakPowerDaily, OffPeakDaily is required.");
60 }
61}
const boost::optional< unsigned short > & priority() const
void populateQuotes()
Populate quotes.
const std::string & peakPriceCalendar() const
const boost::optional< OffPeakDaily > & offPeakDaily() const
boost::optional< OffPeakDaily > offPeakDaily_
const std::string & peakPriceCurveId() const
std::vector< std::string > quotes_
boost::optional< unsigned short > priority_
const std::string & conventionsId() const
const std::vector< std::string > & quotes() const
PriceSegment::Type parsePriceSegmentType(const string &s)
Convert text to PriceSegment::Type.
Definition: parsers.cpp:1158
+ Here is the call graph for this function:

Member Function Documentation

◆ type()

PriceSegment::Type type ( ) const

Definition at line 63 of file commoditycurveconfig.cpp.

63 {
64 return type_;
65}
+ Here is the caller graph for this function:

◆ conventionsId()

const string & conventionsId ( ) const

Definition at line 67 of file commoditycurveconfig.cpp.

67 {
68 return conventionsId_;
69}
+ Here is the caller graph for this function:

◆ quotes()

const vector< string > & quotes ( ) const

Definition at line 71 of file commoditycurveconfig.cpp.

71 {
72 return quotes_;
73}
+ Here is the caller graph for this function:

◆ priority()

const boost::optional< unsigned short > & priority ( ) const

Definition at line 75 of file commoditycurveconfig.cpp.

75 {
76 return priority_;
77}

◆ offPeakDaily()

const boost::optional< PriceSegment::OffPeakDaily > & offPeakDaily ( ) const

Definition at line 79 of file commoditycurveconfig.cpp.

79 {
80 return offPeakDaily_;
81}
+ Here is the caller graph for this function:

◆ peakPriceCurveId()

const string & peakPriceCurveId ( ) const

Definition at line 83 of file commoditycurveconfig.cpp.

83 {
84 return peakPriceCurveId_;
85}
+ Here is the caller graph for this function:

◆ peakPriceCalendar()

const string & peakPriceCalendar ( ) const

Definition at line 87 of file commoditycurveconfig.cpp.

87 {
88 return peakPriceCalendar_;
89}
+ Here is the caller graph for this function:

◆ empty()

bool empty ( ) const

Definition at line 91 of file commoditycurveconfig.cpp.

91 {
92 return empty_;
93}

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 95 of file commoditycurveconfig.cpp.

95 {
96
97 XMLUtils::checkNode(node, "PriceSegment");
98 strType_ = XMLUtils::getChildValue(node, "Type", true);
100 conventionsId_ = XMLUtils::getChildValue(node, "Conventions", true);
101
102 if (XMLNode* n = XMLUtils::getChildNode(node, "Priority")) {
104 }
105
107 quotes_ = XMLUtils::getChildrenValues(node, "Quotes", "Quote", true);
108 peakPriceCurveId_ = XMLUtils::getChildValue(node, "PeakPriceCurveId", false);
109 peakPriceCalendar_ = XMLUtils::getChildValue(node, "PeakPriceCalendar", false);
110 } else {
111 XMLNode* n = XMLUtils::getChildNode(node, "OffPeakDaily");
112 QL_REQUIRE(n, "When price segment type is OffPeakPowerDaily, an OffPeakDaily node is required.");
113 offPeakDaily_ = OffPeakDaily();
114 offPeakDaily_->fromXML(n);
116 }
117
118 empty_ = false;
119}
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 XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static string getNodeValue(XMLNode *node)
Get a node's value.
Definition: xmlutils.cpp:489
static vector< string > getChildrenValues(XMLNode *node, const string &names, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:306
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Definition: parsers.cpp:136
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 130 of file commoditycurveconfig.cpp.

130 {
131
132 XMLNode* node = doc.allocNode("PriceSegment");
133 XMLUtils::addChild(doc, node, "Type", strType_);
134 if (priority_) {
135 XMLUtils::addChild(doc, node, "Priority", *priority_);
136 }
137 XMLUtils::addChild(doc, node, "Conventions", conventionsId_);
138
139
141 XMLUtils::addChildren(doc, node, "Quotes", "Quote", quotes_);
142 if (!peakPriceCurveId_.empty()) {
143 XMLUtils::addChild(doc, node, "PeakPriceCurveId", peakPriceCurveId_);
144 }
145 if (!peakPriceCalendar_.empty()) {
146 XMLUtils::addChild(doc, node, "PeakPriceCalendar", peakPriceCalendar_);
147 }
148 } else {
149 XMLUtils::appendNode(node, offPeakDaily_->toXML(doc));
150 }
151
152 return node;
153}
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
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
+ Here is the call graph for this function:

◆ populateQuotes()

void populateQuotes ( )
private

Populate quotes.

Definition at line 121 of file commoditycurveconfig.cpp.

121 {
122 // Populate the quotes_ with the off-peak and peak quotes
123 const auto& opqs = offPeakDaily_->offPeakQuotes();
124 set<string> quotes{ opqs.begin(), opqs.end() };
125 const auto& pqs = offPeakDaily_->peakQuotes();
126 quotes.insert(pqs.begin(), pqs.end());
127 quotes_.assign(quotes.begin(), quotes.end());
128}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ strType_

std::string strType_
private

Definition at line 99 of file commoditycurveconfig.hpp.

◆ conventionsId_

std::string conventionsId_
private

Definition at line 100 of file commoditycurveconfig.hpp.

◆ quotes_

std::vector<std::string> quotes_
private

Definition at line 101 of file commoditycurveconfig.hpp.

◆ priority_

boost::optional<unsigned short> priority_
private

Definition at line 102 of file commoditycurveconfig.hpp.

◆ offPeakDaily_

boost::optional<OffPeakDaily> offPeakDaily_
private

Definition at line 103 of file commoditycurveconfig.hpp.

◆ peakPriceCurveId_

std::string peakPriceCurveId_
private

Definition at line 104 of file commoditycurveconfig.hpp.

◆ peakPriceCalendar_

std::string peakPriceCalendar_
private

Definition at line 105 of file commoditycurveconfig.hpp.

◆ empty_

bool empty_
private

Definition at line 107 of file commoditycurveconfig.hpp.

◆ type_

Type type_
private

Definition at line 108 of file commoditycurveconfig.hpp.