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

Commodity curve configuration. More...

#include <ored/configuration/commoditycurveconfig.hpp>

+ Inheritance diagram for CommodityCurveConfig:
+ Collaboration diagram for CommodityCurveConfig:

Public Types

enum class  Type { Direct , CrossCurrency , Basis , Piecewise }
 

Public Member Functions

Constructors
 CommodityCurveConfig ()
 Default constructor. More...
 
 CommodityCurveConfig (const std::string &curveId, const std::string &curveDescription, const std::string &currency, const std::vector< std::string > &quotes, const std::string &commoditySpotQuote="", const std::string &dayCountId="A365", const std::string &interpolationMethod="Linear", bool extrapolation=true, const std::string &conventionsId="")
 Detailed constructor for Direct commodity curve configuration. More...
 
 CommodityCurveConfig (const std::string &curveId, const std::string &curveDescription, const std::string &currency, const std::string &basePriceCurveId, const std::string &baseYieldCurveId, const std::string &yieldCurveId, bool extrapolation=true)
 Detailed constructor for CrossCurrency commodity curve configuration. More...
 
 CommodityCurveConfig (const std::string &curveId, const std::string &curveDescription, const std::string &currency, const std::string &basePriceCurveId, const std::string &baseConventionsId, const std::vector< std::string > &basisQuotes, const std::string &basisConventionsId, const std::string &dayCountId="A365", const std::string &interpolationMethod="Linear", bool extrapolation=true, bool addBasis=true, QuantLib::Natural monthOffset=0, bool averageBase=true)
 Detailed constructor for Basis commodity curve configuration. More...
 
 CommodityCurveConfig (const std::string &curveId, const std::string &curveDescription, const std::string &currency, const std::vector< PriceSegment > &priceSegments, const std::string &dayCountId="A365", const std::string &interpolationMethod="Linear", bool extrapolation=true, const boost::optional< BootstrapConfig > &bootstrapConfig=boost::none)
 Detailed constructor for Piecewise commodity curve configuration. More...
 
Serialisation
void fromXML (XMLNode *node) override
 
XMLNodetoXML (XMLDocument &doc) const override
 
Inspectors
const Typetype () const
 
const std::string & currency () const
 
const std::string & commoditySpotQuoteId () const
 
const std::string & dayCountId () const
 
const std::string & interpolationMethod () const
 
const std::string & basePriceCurveId () const
 
const std::string & baseYieldCurveId () const
 
const std::string & yieldCurveId () const
 
bool extrapolation () const
 
const vector< string > & fwdQuotes () const
 
const std::string & conventionsId () const
 
const std::string & baseConventionsId () const
 
bool addBasis () const
 
QuantLib::Natural monthOffset () const
 
bool averageBase () const
 
bool priceAsHistFixing () const
 
const std::map< unsigned short, PriceSegment > & priceSegments () const
 
const boost::optional< BootstrapConfig > & bootstrapConfig () const
 
- 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

Type type_
 
vector< string > fwdQuotes_
 
std::string currency_
 
std::string commoditySpotQuoteId_
 
std::string dayCountId_
 
std::string interpolationMethod_
 
std::string basePriceCurveId_
 
std::string baseYieldCurveId_
 
std::string yieldCurveId_
 
bool extrapolation_
 
std::string conventionsId_
 
std::string baseConventionsId_
 
bool addBasis_
 
QuantLib::Natural monthOffset_
 
bool averageBase_
 
bool priceAsHistFixing_
 
std::map< unsigned short, PriceSegmentpriceSegments_
 
boost::optional< BootstrapConfigbootstrapConfig_
 
Typetype ()
 
std::string & currency ()
 
std::string & commoditySpotQuoteId ()
 
std::string & dayCountId ()
 
std::string & interpolationMethod ()
 
std::string & basePriceCurveId ()
 
std::string & baseYieldCurveId ()
 
std::string & yieldCurveId ()
 
boolextrapolation ()
 
std::string & conventionsId ()
 
std::string & baseConventionsId ()
 
booladdBasis ()
 
QuantLib::Natural & monthOffset ()
 
boolaverageBase ()
 
boolpriceAsHistFixing ()
 
void setPriceSegments (const std::map< unsigned short, PriceSegment > &priceSegments)
 
void setBootstrapConfig (const BootstrapConfig &bootstrapConfig)
 
void populateRequiredCurveIds ()
 Populate any dependent curve IDs. More...
 
void processSegments (std::vector< PriceSegment > priceSegments)
 Process price segments when configuring a Piecewise curve. More...
 

Additional Inherited Members

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

Detailed Description

Commodity curve configuration.

Definition at line 115 of file commoditycurveconfig.hpp.

Member Enumeration Documentation

◆ Type

enum class Type
strong

The type of commodity curve that has been configured:

  • Direct: if the commodity price curve is built from commodity forward quotes
  • CrossCurrency: if the commodity price curve is implied from a price curve in a different currency
  • Basis: if the commodity price curve is built from basis quotes
  • Piecewise: if the commodity price curve is bootstrapped from sets of instruments
Enumerator
Direct 
CrossCurrency 
Basis 
Piecewise 

Definition at line 123 of file commoditycurveconfig.hpp.

Constructor & Destructor Documentation

◆ CommodityCurveConfig() [1/5]

◆ CommodityCurveConfig() [2/5]

CommodityCurveConfig ( const std::string &  curveId,
const std::string &  curveDescription,
const std::string &  currency,
const std::vector< std::string > &  quotes,
const std::string &  commoditySpotQuote = "",
const std::string &  dayCountId = "A365",
const std::string &  interpolationMethod = "Linear",
bool  extrapolation = true,
const std::string &  conventionsId = "" 
)

Detailed constructor for Direct commodity curve configuration.

Definition at line 155 of file commoditycurveconfig.cpp.

163 averageBase_(true) {
164
165 quotes_ = quotes;
166 if (!commoditySpotQuote.empty()) {
167 quotes_.insert(quotes_.begin(), commoditySpotQuote);
168 }
169}
const std::string & conventionsId() const
const std::string & currency() const
const std::string & interpolationMethod() const
const std::string & dayCountId() const
vector< string > quotes_
Definition: curveconfig.hpp:74
const string & curveDescription() const
Definition: curveconfig.hpp:55
virtual const vector< string > & quotes()
Return all the market quotes required for this config.
Definition: curveconfig.hpp:69
CurveConfig()
Default constructor.
Definition: curveconfig.hpp:49
+ Here is the call graph for this function:

◆ CommodityCurveConfig() [3/5]

CommodityCurveConfig ( const std::string &  curveId,
const std::string &  curveDescription,
const std::string &  currency,
const std::string &  basePriceCurveId,
const std::string &  baseYieldCurveId,
const std::string &  yieldCurveId,
bool  extrapolation = true 
)

Detailed constructor for CrossCurrency commodity curve configuration.

Definition at line 171 of file commoditycurveconfig.cpp.

+ Here is the call graph for this function:

◆ CommodityCurveConfig() [4/5]

CommodityCurveConfig ( const std::string &  curveId,
const std::string &  curveDescription,
const std::string &  currency,
const std::string &  basePriceCurveId,
const std::string &  baseConventionsId,
const std::vector< std::string > &  basisQuotes,
const std::string &  basisConventionsId,
const std::string &  dayCountId = "A365",
const std::string &  interpolationMethod = "Linear",
bool  extrapolation = true,
bool  addBasis = true,
QuantLib::Natural  monthOffset = 0,
bool  averageBase = true 
)

Detailed constructor for Basis commodity curve configuration.

Definition at line 181 of file commoditycurveconfig.cpp.

+ Here is the call graph for this function:

◆ CommodityCurveConfig() [5/5]

CommodityCurveConfig ( const std::string &  curveId,
const std::string &  curveDescription,
const std::string &  currency,
const std::vector< PriceSegment > &  priceSegments,
const std::string &  dayCountId = "A365",
const std::string &  interpolationMethod = "Linear",
bool  extrapolation = true,
const boost::optional< BootstrapConfig > &  bootstrapConfig = boost::none 
)

Detailed constructor for Piecewise commodity curve configuration.

Definition at line 194 of file commoditycurveconfig.cpp.

202}
const std::map< unsigned short, PriceSegment > & priceSegments() const
void processSegments(std::vector< PriceSegment > priceSegments)
Process price segments when configuring a Piecewise curve.
const boost::optional< BootstrapConfig > & bootstrapConfig() const
boost::optional< BootstrapConfig > bootstrapConfig_
+ Here is the call graph for this function:

Member Function Documentation

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 204 of file commoditycurveconfig.cpp.

204 {
205
206 XMLUtils::checkNode(node, "CommodityCurve");
207
208 curveID_ = XMLUtils::getChildValue(node, "CurveId", true);
209 curveDescription_ = XMLUtils::getChildValue(node, "CurveDescription", true);
210 currency_ = XMLUtils::getChildValue(node, "Currency", true);
211
212 if (XMLNode* n = XMLUtils::getChildNode(node, "BasisConfiguration")) {
213
215 basePriceCurveId_ = XMLUtils::getChildValue(n, "BasePriceCurve", true);
216 baseConventionsId_ = XMLUtils::getChildValue(n, "BasePriceConventions", true);
217 quotes_ = fwdQuotes_ = XMLUtils::getChildrenValues(n, "BasisQuotes", "Quote");
218 conventionsId_ = XMLUtils::getChildValue(n, "BasisConventions", true);
219 dayCountId_ = XMLUtils::getChildValue(n, "DayCounter", false);
220 interpolationMethod_ = XMLUtils::getChildValue(n, "InterpolationMethod", false);
221 addBasis_ = XMLUtils::getChildValueAsBool(n, "AddBasis", false);
222 monthOffset_ = XMLUtils::getChildValueAsInt(n, "MonthOffset", false);
223 averageBase_ = XMLUtils::getChildValueAsBool(n, "AverageBase", false);
224 priceAsHistFixing_ = XMLUtils::getChildValueAsBool(n, "PriceAsHistoricalFixing", false);
225 } else if (XMLNode* n = XMLUtils::getChildNode(node, "BasePriceCurve")) {
226
229 baseYieldCurveId_ = XMLUtils::getChildValue(node, "BaseYieldCurve", true);
230 yieldCurveId_ = XMLUtils::getChildValue(node, "YieldCurve", true);
231
232 } else if (XMLNode* n = XMLUtils::getChildNode(node, "PriceSegments")) {
233
234 vector<PriceSegment> priceSegments;
237 PriceSegment ps;
238 ps.fromXML(c);
239 priceSegments.push_back(ps);
240 }
242
243 dayCountId_ = XMLUtils::getChildValue(node, "DayCounter", false);
244 interpolationMethod_ = XMLUtils::getChildValue(node, "InterpolationMethod", false);
245
246 if (XMLNode* bcn = XMLUtils::getChildNode(node, "BootstrapConfig")) {
247 bootstrapConfig_ = BootstrapConfig();
248 bootstrapConfig_->fromXML(bcn);
249 }
250
251 } else {
252
254 dayCountId_ = XMLUtils::getChildValue(node, "DayCounter", false);
255 commoditySpotQuoteId_ = XMLUtils::getChildValue(node, "SpotQuote", false);
256 fwdQuotes_ = XMLUtils::getChildrenValues(node, "Quotes", "Quote");
258 if (commoditySpotQuoteId_ != "")
259 quotes_.insert(quotes_.begin(), commoditySpotQuoteId_);
260
261 interpolationMethod_ = XMLUtils::getChildValue(node, "InterpolationMethod", false);
262 conventionsId_ = XMLUtils::getChildValue(node, "Conventions", false);
263 }
264
265 extrapolation_ = XMLUtils::getChildValueAsBool(node, "Extrapolation");
266
268}
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 string getNodeValue(XMLNode *node)
Get a node's value.
Definition: xmlutils.cpp:489
static int getChildValueAsInt(XMLNode *node, const string &name, bool mandatory=false, int defaultValue=0)
Definition: xmlutils.cpp:291
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
Definition: xmlutils.cpp:484
static vector< string > getChildrenValues(XMLNode *node, const string &names, const string &name, bool mandatory=false)
Definition: xmlutils.cpp:306
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 270 of file commoditycurveconfig.cpp.

270 {
271
272 XMLNode* node = doc.allocNode("CommodityCurve");
273
274 XMLUtils::addChild(doc, node, "CurveId", curveID_);
275 XMLUtils::addChild(doc, node, "CurveDescription", curveDescription_);
276 XMLUtils::addChild(doc, node, "Currency", currency_);
277
278 if (type_ == Type::Basis) {
279 XMLNode* basisNode = XMLUtils::addChild(doc, node, "BasisConfiguration");
280 XMLUtils::addChild(doc, basisNode, "BasePriceCurve", basePriceCurveId_);
281 XMLUtils::addChild(doc, basisNode, "BasePriceConventions", baseConventionsId_);
282 XMLUtils::addChildren(doc, basisNode, "BasisQuotes", "Quote", fwdQuotes_);
283 XMLUtils::addChild(doc, basisNode, "BasisConventions", conventionsId_);
284 XMLUtils::addChild(doc, basisNode, "DayCounter", dayCountId_);
285 XMLUtils::addChild(doc, basisNode, "InterpolationMethod", interpolationMethod_);
286 XMLUtils::addChild(doc, basisNode, "AddBasis", addBasis_);
287 XMLUtils::addChild(doc, basisNode, "MonthOffset", static_cast<int>(monthOffset_));
288 XMLUtils::addChild(doc, basisNode, "AverageBase", averageBase_);
289 XMLUtils::addChild(doc, basisNode, "PriceAsHistoricalFixing", priceAsHistFixing_);
290
291 } else if (type_ == Type::CrossCurrency) {
292
293 XMLUtils::addChild(doc, node, "BasePriceCurve", basePriceCurveId_);
294 XMLUtils::addChild(doc, node, "BaseYieldCurve", baseYieldCurveId_);
295 XMLUtils::addChild(doc, node, "YieldCurve", yieldCurveId_);
296
297 } else if (type_ == Type::Piecewise) {
298
299 // Add the price segment nodes.
300 XMLNode* segmentsNode = doc.allocNode("PriceSegments");
301 for (auto& kv : priceSegments_) {
302 XMLUtils::appendNode(segmentsNode, kv.second.toXML(doc));
303 }
304 XMLUtils::appendNode(node, segmentsNode);
305
306 XMLUtils::addChild(doc, node, "DayCounter", dayCountId_);
307 XMLUtils::addChild(doc, node, "InterpolationMethod", interpolationMethod_);
308
309 } else {
310
311 if (!commoditySpotQuoteId_.empty())
312 XMLUtils::addChild(doc, node, "SpotQuote", commoditySpotQuoteId_);
313 XMLUtils::addChildren(doc, node, "Quotes", "Quote", fwdQuotes_);
314 XMLUtils::addChild(doc, node, "DayCounter", dayCountId_);
315 XMLUtils::addChild(doc, node, "InterpolationMethod", interpolationMethod_);
316 XMLUtils::addChild(doc, node, "Conventions", conventionsId_);
317 }
318
319 XMLUtils::addChild(doc, node, "Extrapolation", extrapolation_);
320
321 if (bootstrapConfig_) {
322 XMLUtils::appendNode(node, bootstrapConfig_->toXML(doc));
323 }
324
325 return node;
326}
std::map< unsigned short, PriceSegment > priceSegments_
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:

◆ type() [1/2]

const Type & type ( ) const

Definition at line 165 of file commoditycurveconfig.hpp.

165{ return type_; }

◆ currency() [1/2]

const std::string & currency ( ) const

Definition at line 166 of file commoditycurveconfig.hpp.

166{ return currency_; }
+ Here is the caller graph for this function:

◆ commoditySpotQuoteId() [1/2]

const std::string & commoditySpotQuoteId ( ) const

Definition at line 167 of file commoditycurveconfig.hpp.

167{ return commoditySpotQuoteId_; }
+ Here is the caller graph for this function:

◆ dayCountId() [1/2]

const std::string & dayCountId ( ) const

Definition at line 168 of file commoditycurveconfig.hpp.

168{ return dayCountId_; }
+ Here is the caller graph for this function:

◆ interpolationMethod() [1/2]

const std::string & interpolationMethod ( ) const

Definition at line 169 of file commoditycurveconfig.hpp.

169{ return interpolationMethod_; }
+ Here is the caller graph for this function:

◆ basePriceCurveId() [1/2]

const std::string & basePriceCurveId ( ) const

Definition at line 170 of file commoditycurveconfig.hpp.

170{ return basePriceCurveId_; }
+ Here is the caller graph for this function:

◆ baseYieldCurveId() [1/2]

const std::string & baseYieldCurveId ( ) const

Definition at line 171 of file commoditycurveconfig.hpp.

171{ return baseYieldCurveId_; }
+ Here is the caller graph for this function:

◆ yieldCurveId() [1/2]

const std::string & yieldCurveId ( ) const

Definition at line 172 of file commoditycurveconfig.hpp.

172{ return yieldCurveId_; }
+ Here is the caller graph for this function:

◆ extrapolation() [1/2]

bool extrapolation ( ) const

Definition at line 173 of file commoditycurveconfig.hpp.

173{ return extrapolation_; }
+ Here is the caller graph for this function:

◆ fwdQuotes()

const vector< string > & fwdQuotes ( ) const

Definition at line 174 of file commoditycurveconfig.hpp.

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

◆ conventionsId() [1/2]

const std::string & conventionsId ( ) const

Definition at line 175 of file commoditycurveconfig.hpp.

175{ return conventionsId_; }
+ Here is the caller graph for this function:

◆ baseConventionsId() [1/2]

const std::string & baseConventionsId ( ) const

Definition at line 176 of file commoditycurveconfig.hpp.

176{ return baseConventionsId_; }
+ Here is the caller graph for this function:

◆ addBasis() [1/2]

bool addBasis ( ) const

Definition at line 177 of file commoditycurveconfig.hpp.

177{ return addBasis_; }
+ Here is the caller graph for this function:

◆ monthOffset() [1/2]

QuantLib::Natural monthOffset ( ) const

Definition at line 178 of file commoditycurveconfig.hpp.

178{ return monthOffset_; }
+ Here is the caller graph for this function:

◆ averageBase() [1/2]

bool averageBase ( ) const

Definition at line 179 of file commoditycurveconfig.hpp.

179{ return averageBase_; }
+ Here is the caller graph for this function:

◆ priceAsHistFixing() [1/2]

bool priceAsHistFixing ( ) const

Definition at line 180 of file commoditycurveconfig.hpp.

180{ return priceAsHistFixing_; }
+ Here is the caller graph for this function:

◆ priceSegments()

const std::map< unsigned short, PriceSegment > & priceSegments ( ) const

Definition at line 181 of file commoditycurveconfig.hpp.

181{ return priceSegments_; }
+ Here is the caller graph for this function:

◆ bootstrapConfig()

const boost::optional< BootstrapConfig > & bootstrapConfig ( ) const

Definition at line 182 of file commoditycurveconfig.hpp.

182{ return bootstrapConfig_; }
+ Here is the caller graph for this function:

◆ type() [2/2]

Type & type ( )

Definition at line 187 of file commoditycurveconfig.hpp.

187{ return type_; }

◆ currency() [2/2]

std::string & currency ( )

Definition at line 188 of file commoditycurveconfig.hpp.

188{ return currency_; }

◆ commoditySpotQuoteId() [2/2]

std::string & commoditySpotQuoteId ( )

Definition at line 189 of file commoditycurveconfig.hpp.

189{ return commoditySpotQuoteId_; }

◆ dayCountId() [2/2]

std::string & dayCountId ( )

Definition at line 190 of file commoditycurveconfig.hpp.

190{ return dayCountId_; }

◆ interpolationMethod() [2/2]

std::string & interpolationMethod ( )

Definition at line 191 of file commoditycurveconfig.hpp.

191{ return interpolationMethod_; }

◆ basePriceCurveId() [2/2]

std::string & basePriceCurveId ( )

Definition at line 192 of file commoditycurveconfig.hpp.

192{ return basePriceCurveId_; }

◆ baseYieldCurveId() [2/2]

std::string & baseYieldCurveId ( )

Definition at line 193 of file commoditycurveconfig.hpp.

193{ return baseYieldCurveId_; }

◆ yieldCurveId() [2/2]

std::string & yieldCurveId ( )

Definition at line 194 of file commoditycurveconfig.hpp.

194{ return yieldCurveId_; }

◆ extrapolation() [2/2]

bool & extrapolation ( )

Definition at line 195 of file commoditycurveconfig.hpp.

195{ return extrapolation_; }

◆ conventionsId() [2/2]

std::string & conventionsId ( )

Definition at line 196 of file commoditycurveconfig.hpp.

196{ return conventionsId_; }

◆ baseConventionsId() [2/2]

std::string & baseConventionsId ( )

Definition at line 197 of file commoditycurveconfig.hpp.

197{ return baseConventionsId_; }

◆ addBasis() [2/2]

bool & addBasis ( )

Definition at line 198 of file commoditycurveconfig.hpp.

198{ return addBasis_; }

◆ monthOffset() [2/2]

QuantLib::Natural & monthOffset ( )

Definition at line 199 of file commoditycurveconfig.hpp.

199{ return monthOffset_; }

◆ averageBase() [2/2]

bool & averageBase ( )

Definition at line 200 of file commoditycurveconfig.hpp.

200{ return averageBase_; }

◆ priceAsHistFixing() [2/2]

bool & priceAsHistFixing ( )

Definition at line 201 of file commoditycurveconfig.hpp.

201{ return priceAsHistFixing_; }

◆ setPriceSegments()

void setPriceSegments ( const std::map< unsigned short, PriceSegment > &  priceSegments)

Definition at line 202 of file commoditycurveconfig.hpp.

202 {
204 }
+ Here is the call graph for this function:

◆ setBootstrapConfig()

void setBootstrapConfig ( const BootstrapConfig bootstrapConfig)

Definition at line 205 of file commoditycurveconfig.hpp.

+ Here is the call graph for this function:

◆ populateRequiredCurveIds()

void populateRequiredCurveIds ( )
private

Populate any dependent curve IDs.

Definition at line 328 of file commoditycurveconfig.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processSegments()

void processSegments ( std::vector< PriceSegment priceSegments)
private

Process price segments when configuring a Piecewise curve.

Definition at line 337 of file commoditycurveconfig.cpp.

337 {
338
339 QL_REQUIRE(!priceSegments.empty(), "Need at least one price segment for a Piecewise commodity curve.");
340
341 // Populate the quotes with each segment's quotes. Remove any price segments that have a valid priority value and
342 // add to the priceSegments_ map. What remains in priceSegments are price segments without a priority.
343 auto it = priceSegments.begin();
344 while (it != priceSegments.end()) {
345
346 // If price segment is AveragingOffPeakPower, need a peak power curve Id.
348 QL_REQUIRE(!it->peakPriceCurveId().empty(), "An AveragingOffPeakPower price segment should have" <<
349 " a non empty PeakPriceCurveId");
350 requiredCurveIds_[CurveSpec::CurveType::Commodity].insert(it->peakPriceCurveId());
351 }
352
353 // Quotes
354 fwdQuotes_.insert(fwdQuotes_.end(), it->quotes().begin(), it->quotes().end());
355
356 // Price segments
357 if (it->priority()) {
358 unsigned short p = *it->priority();
359 QL_REQUIRE(priceSegments_.count(p) == 0, "CommodityCurveConfig: already configured a price segment " <<
360 "with priority " << p << " for commodity curve configuration " << curveID() << ".");
361 priceSegments_[p] = *it;
362 it = priceSegments.erase(it);
363 } else {
364 it++;
365 }
366
367 }
368
369 // Get the current largest priority.
370 unsigned short largestPriority = 0;
371 if (!priceSegments_.empty()) {
372 largestPriority = priceSegments_.rbegin()->first;
373 }
374
375 // Very unlikely but check that the priorities entered will not cause an overflow of short int.
376 QL_REQUIRE(priceSegments.size() <= static_cast<unsigned short>(std::numeric_limits<unsigned short>::max() - largestPriority),
377 "Largest price segment priority (" << largestPriority << ") and number of segments without a " <<
378 "priority (" << priceSegments.size() << ") combine to give a value too large for unsigned short.");
379
380 // Now add the price segments without a priority to the end of the map.
381 for (const auto& ps : priceSegments) {
382 priceSegments_[++largestPriority] = ps;
383 }
384
386}
const string & curveID() const
Definition: curveconfig.hpp:54
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ type_

Type type_
private

Definition at line 215 of file commoditycurveconfig.hpp.

◆ fwdQuotes_

vector<string> fwdQuotes_
private

Definition at line 216 of file commoditycurveconfig.hpp.

◆ currency_

std::string currency_
private

Definition at line 217 of file commoditycurveconfig.hpp.

◆ commoditySpotQuoteId_

std::string commoditySpotQuoteId_
private

Definition at line 218 of file commoditycurveconfig.hpp.

◆ dayCountId_

std::string dayCountId_
private

Definition at line 219 of file commoditycurveconfig.hpp.

◆ interpolationMethod_

std::string interpolationMethod_
private

Definition at line 220 of file commoditycurveconfig.hpp.

◆ basePriceCurveId_

std::string basePriceCurveId_
private

Definition at line 221 of file commoditycurveconfig.hpp.

◆ baseYieldCurveId_

std::string baseYieldCurveId_
private

Definition at line 222 of file commoditycurveconfig.hpp.

◆ yieldCurveId_

std::string yieldCurveId_
private

Definition at line 223 of file commoditycurveconfig.hpp.

◆ extrapolation_

bool extrapolation_
private

Definition at line 224 of file commoditycurveconfig.hpp.

◆ conventionsId_

std::string conventionsId_
private

Definition at line 225 of file commoditycurveconfig.hpp.

◆ baseConventionsId_

std::string baseConventionsId_
private

Definition at line 226 of file commoditycurveconfig.hpp.

◆ addBasis_

bool addBasis_
private

Definition at line 227 of file commoditycurveconfig.hpp.

◆ monthOffset_

QuantLib::Natural monthOffset_
private

Definition at line 228 of file commoditycurveconfig.hpp.

◆ averageBase_

bool averageBase_
private

Definition at line 229 of file commoditycurveconfig.hpp.

◆ priceAsHistFixing_

bool priceAsHistFixing_
private

Definition at line 230 of file commoditycurveconfig.hpp.

◆ priceSegments_

std::map<unsigned short, PriceSegment> priceSegments_
private

The map key is the internal priority of the price segment and does not necessarily map the PriceSegment's priority member value. We are allowing here for the priority to be unspecified in the PriceSegment during configuration.

Definition at line 235 of file commoditycurveconfig.hpp.

◆ bootstrapConfig_

boost::optional<BootstrapConfig> bootstrapConfig_
private

Definition at line 236 of file commoditycurveconfig.hpp.