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

#include <ored/configuration/conventions.hpp>

+ Inheritance diagram for CommodityForwardConvention:
+ Collaboration diagram for CommodityForwardConvention:

Public Member Functions

Constructors
 CommodityForwardConvention ()
 Default constructor. More...
 
 CommodityForwardConvention (const string &id, const string &spotDays="", const string &pointsFactor="", const string &advanceCalendar="", const string &spotRelative="", BusinessDayConvention bdc=Following, bool outright=true)
 Detailed constructor. More...
 
Inspectors
Natural spotDays () const
 
Real pointsFactor () const
 
const Calendar & advanceCalendar () const
 
string strAdvanceCalendar () const
 
bool spotRelative () const
 
BusinessDayConvention bdc () const
 
bool outright () const
 
- Public Member Functions inherited from Convention
virtual ~Convention ()
 Default destructor. More...
 
const string & id () const
 
Type type () 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

Natural spotDays_
 
Real pointsFactor_
 
Calendar advanceCalendar_
 
bool spotRelative_
 
BusinessDayConvention bdc_
 
bool outright_
 
string strSpotDays_
 
string strPointsFactor_
 
string strAdvanceCalendar_
 
string strSpotRelative_
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
virtual void build () override
 

Additional Inherited Members

- Public Types inherited from Convention
enum class  Type {
  Zero , Deposit , Future , FRA ,
  OIS , Swap , AverageOIS , TenorBasisSwap ,
  TenorBasisTwoSwap , BMABasisSwap , FX , CrossCcyBasis ,
  CrossCcyFixFloat , CDS , IborIndex , OvernightIndex ,
  SwapIndex , ZeroInflationIndex , InflationSwap , SecuritySpread ,
  CMSSpreadOption , CommodityForward , CommodityFuture , FxOption ,
  BondYield
}
 Supported convention types. More...
 
- Protected Member Functions inherited from Convention
 Convention ()
 
 Convention (const string &id, Type type)
 
- Protected Attributes inherited from Convention
Type type_
 
string id_
 

Detailed Description

Container for storing Commodity forward quote conventions

Definition at line 1268 of file conventions.hpp.

Constructor & Destructor Documentation

◆ CommodityForwardConvention() [1/2]

Default constructor.

Definition at line 1273 of file conventions.hpp.

1273{}

◆ CommodityForwardConvention() [2/2]

CommodityForwardConvention ( const string &  id,
const string &  spotDays = "",
const string &  pointsFactor = "",
const string &  advanceCalendar = "",
const string &  spotRelative = "",
BusinessDayConvention  bdc = Following,
bool  outright = true 
)

Detailed constructor.

Definition at line 1466 of file conventions.cpp.

1472 build();
1473}
const Calendar & advanceCalendar() const
BusinessDayConvention bdc() const
+ Here is the call graph for this function:

Member Function Documentation

◆ spotDays()

Natural spotDays ( ) const

Definition at line 1283 of file conventions.hpp.

◆ pointsFactor()

Real pointsFactor ( ) const

Definition at line 1284 of file conventions.hpp.

◆ advanceCalendar()

const Calendar & advanceCalendar ( ) const

Definition at line 1285 of file conventions.hpp.

◆ strAdvanceCalendar()

string strAdvanceCalendar ( ) const

Definition at line 1286 of file conventions.hpp.

1286{ return strAdvanceCalendar_; }

◆ spotRelative()

bool spotRelative ( ) const

Definition at line 1287 of file conventions.hpp.

◆ bdc()

BusinessDayConvention bdc ( ) const

Definition at line 1288 of file conventions.hpp.

1288{ return bdc_; }

◆ outright()

bool outright ( ) const

Definition at line 1289 of file conventions.hpp.

1289{ return outright_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Implements XMLSerializable.

Definition at line 1482 of file conventions.cpp.

1482 {
1483
1484 XMLUtils::checkNode(node, "CommodityForward");
1486 id_ = XMLUtils::getChildValue(node, "Id", true);
1487
1488 strSpotDays_ = XMLUtils::getChildValue(node, "SpotDays", false);
1489 strPointsFactor_ = XMLUtils::getChildValue(node, "PointsFactor", false);
1490 strAdvanceCalendar_ = XMLUtils::getChildValue(node, "AdvanceCalendar", false);
1491 strSpotRelative_ = XMLUtils::getChildValue(node, "SpotRelative", false);
1492
1493 bdc_ = Following;
1494 if (XMLNode* n = XMLUtils::getChildNode(node, "BusinessDayConvention")) {
1496 }
1497
1498 outright_ = true;
1499 if (XMLNode* n = XMLUtils::getChildNode(node, "Outright")) {
1501 }
1502
1503 build();
1504}
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
BusinessDayConvention parseBusinessDayConvention(const string &s)
Convert text to QuantLib::BusinessDayConvention.
Definition: parsers.cpp:173
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Implements XMLSerializable.

Definition at line 1506 of file conventions.cpp.

1506 {
1507
1508 XMLNode* node = doc.allocNode("CommodityForward");
1509 XMLUtils::addChild(doc, node, "Id", id_);
1510
1511 if (!strSpotDays_.empty())
1512 XMLUtils::addChild(doc, node, "SpotDays", strSpotDays_);
1513 if (!strPointsFactor_.empty())
1514 XMLUtils::addChild(doc, node, "PointsFactor", strPointsFactor_);
1515 if (!strAdvanceCalendar_.empty())
1516 XMLUtils::addChild(doc, node, "AdvanceCalendar", strAdvanceCalendar_);
1517 if (!strSpotRelative_.empty())
1518 XMLUtils::addChild(doc, node, "SpotRelative", strSpotRelative_);
1519
1520
1521 XMLUtils::addChild(doc, node, "BusinessDayConvention", ore::data::to_string(bdc_));
1522 XMLUtils::addChild(doc, node, "Outright", outright_);
1523
1524 return node;
1525}
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:

◆ build()

void build ( )
overridevirtual

Implements Convention.

Definition at line 1475 of file conventions.cpp.

1475 {
1476 spotDays_ = strSpotDays_.empty() ? 2 : lexical_cast<Natural>(strSpotDays_);
1480}
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Definition: parsers.cpp:157
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ spotDays_

Natural spotDays_
private

Definition at line 1300 of file conventions.hpp.

◆ pointsFactor_

Real pointsFactor_
private

Definition at line 1301 of file conventions.hpp.

◆ advanceCalendar_

Calendar advanceCalendar_
private

Definition at line 1302 of file conventions.hpp.

◆ spotRelative_

bool spotRelative_
private

Definition at line 1303 of file conventions.hpp.

◆ bdc_

BusinessDayConvention bdc_
private

Definition at line 1304 of file conventions.hpp.

◆ outright_

bool outright_
private

Definition at line 1305 of file conventions.hpp.

◆ strSpotDays_

string strSpotDays_
private

Definition at line 1308 of file conventions.hpp.

◆ strPointsFactor_

string strPointsFactor_
private

Definition at line 1309 of file conventions.hpp.

◆ strAdvanceCalendar_

string strAdvanceCalendar_
private

Definition at line 1310 of file conventions.hpp.

◆ strSpotRelative_

string strSpotRelative_
private

Definition at line 1311 of file conventions.hpp.