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

#include <ored/portfolio/commoditydigitalapo.hpp>

+ Inheritance diagram for CommodityDigitalAveragePriceOption:
+ Collaboration diagram for CommodityDigitalAveragePriceOption:

Public Member Functions

 CommodityDigitalAveragePriceOption ()
 
 CommodityDigitalAveragePriceOption (const ore::data::Envelope &envelope, const ore::data::OptionData &optionData, QuantLib::Real strike, QuantLib::Real digitalCashPayoff, const std::string &currency, const std::string &name, CommodityPriceType priceType, const std::string &startDate, const std::string &endDate, const std::string &paymentCalendar, const std::string &paymentLag, const std::string &paymentConvention, const std::string &pricingCalendar, const std::string &paymentDate="", QuantLib::Real gearing=1.0, QuantLib::Spread spread=0.0, QuantExt::CommodityQuantityFrequency commodityQuantityFrequency=QuantExt::CommodityQuantityFrequency::PerCalculationPeriod, CommodityPayRelativeTo commodityPayRelativeTo=CommodityPayRelativeTo::CalculationPeriodEndDate, QuantLib::Natural futureMonthOffset=0, QuantLib::Natural deliveryRollDays=0, bool includePeriodEnd=true, const BarrierData &barrierData={}, const std::string &fxIndex="")
 
void build (const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &engineFactory) override
 
std::map< AssetClass, std::set< std::string > > underlyingIndices (const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const override
 Add underlying Commodity names. More...
 
Inspectors
const ore::data::OptionDataoptionData ()
 
const ore::data::BarrierDatabarrierData ()
 
QuantLib::Real strike () const
 
QuantLib::Real digitalCashPayoff () const
 
const std::string & currency () const
 
const std::string & name () const
 
CommodityPriceType priceType () const
 
const std::string & startDate () const
 
const std::string & endDate () const
 
const std::string & paymentCalendar () const
 
const std::string & paymentLag () const
 
const std::string & paymentConvention () const
 
const std::string & pricingCalendar () const
 
const std::string & paymentDate () const
 
QuantLib::Real gearing () const
 
QuantLib::Spread spread () const
 
QuantExt::CommodityQuantityFrequency commodityQuantityFrequency () const
 
CommodityPayRelativeTo commodityPayRelativeTo () const
 
QuantLib::Natural futureMonthOffset () const
 
QuantLib::Natural deliveryRollDays () const
 
bool includePeriodEnd () const
 
const std::string & fxIndex () const
 
Serialisation
virtual void fromXML (ore::data::XMLNode *node) override
 
virtual ore::data::XMLNodetoXML (ore::data::XMLDocument &doc) const override
 
- Public Member Functions inherited from Trade
 Trade ()
 Default constructor. More...
 
 Trade (const string &tradeType, const Envelope &env=Envelope(), const TradeActions &ta=TradeActions())
 Base class constructor. More...
 
virtual ~Trade ()
 Default destructor. More...
 
virtual void build (const QuantLib::ext::shared_ptr< EngineFactory > &)=0
 
virtual std::map< std::string, RequiredFixings::FixingDatesfixings (const QuantLib::Date &settlementDate=QuantLib::Date()) const
 
const RequiredFixingsrequiredFixings () const
 
virtual std::map< AssetClass, std::set< std::string > > underlyingIndices (const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const
 
void reset ()
 Reset trade, clear all base class data. This does not reset accumulated timings for this trade. More...
 
void resetPricingStats (const std::size_t numberOfPricings=0, const boost::timer::nanosecond_type cumulativePricingTime=0)
 Reset accumulated timings to given values. More...
 
string & id ()
 Set the trade id. More...
 
void setEnvelope (const Envelope &envelope)
 Set the envelope with counterparty and portfolio info. More...
 
void setAdditionalData (const std::map< std::string, boost::any > &additionalData)
 
TradeActionstradeActions ()
 Set the trade actions. More...
 
const string & id () const
 
const string & tradeType () const
 
const Envelopeenvelope () const
 
const set< string > & portfolioIds () const
 
const TradeActionstradeActions () const
 
const QuantLib::ext::shared_ptr< InstrumentWrapper > & instrument () const
 
const std::vector< QuantLib::Leg > & legs () const
 
const std::vector< string > & legCurrencies () const
 
const std::vector< bool > & legPayers () const
 
const string & npvCurrency () const
 
virtual QuantLib::Real notional () const
 Return the current notional in npvCurrency. See individual sub-classes for the precise definition. More...
 
virtual string notionalCurrency () const
 
const Date & maturity () const
 
virtual bool isExpired (const Date &d)
 
const string & issuer () const
 
template<typename T >
additionalDatum (const std::string &tag) const
 returns any additional datum. More...
 
virtual const std::map< std::string, boost::any > & additionalData () const
 returns all additional data returned by the trade once built More...
 
const std::string & sensitivityTemplate () const
 
void validate () const
 Utility to validate that everything that needs to be set in this base class is actually set. More...
 
boost::timer::nanosecond_type getCumulativePricingTime () const
 Get cumulative timing spent on pricing. More...
 
std::size_t getNumberOfPricings () const
 Get number of pricings. 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...
 

Trade

ore::data::OptionData optionData_
 
ore::data::BarrierData barrierData_
 
QuantLib::Real strike_
 
QuantLib::Real digitalCashPayoff_
 
std::string currency_
 
std::string name_
 
CommodityPriceType priceType_
 
std::string startDate_
 
std::string endDate_
 
std::string paymentCalendar_
 
std::string paymentLag_
 
std::string paymentConvention_
 
std::string pricingCalendar_
 
std::string paymentDate_
 
QuantLib::Real gearing_
 
QuantLib::Spread spread_
 
QuantExt::CommodityQuantityFrequency commodityQuantityFrequency_
 
CommodityPayRelativeTo commodityPayRelativeTo_
 
QuantLib::Natural futureMonthOffset_
 
QuantLib::Natural deliveryRollDays_
 
bool includePeriodEnd_
 
std::string fxIndex_
 
bool hasCashflows () const override
 

Additional Inherited Members

- Protected Member Functions inherited from Trade
Date addPremiums (std::vector< QuantLib::ext::shared_ptr< Instrument > > &instruments, std::vector< Real > &multipliers, const Real tradeMultiplier, const PremiumData &premiumData, const Real premiumMultiplier, const Currency &tradeCurrency, const QuantLib::ext::shared_ptr< EngineFactory > &factory, const string &configuration)
 
void setLegBasedAdditionalData (const Size legNo, Size resultLegId=Null< Size >()) const
 
void setSensitivityTemplate (const EngineBuilder &builder)
 
void setSensitivityTemplate (const std::string &id)
 
- Protected Attributes inherited from Trade
string tradeType_
 
QuantLib::ext::shared_ptr< InstrumentWrapperinstrument_
 
std::vector< QuantLib::Leg > legs_
 
std::vector< string > legCurrencies_
 
std::vector< boollegPayers_
 
string npvCurrency_
 
QuantLib::Real notional_
 
string notionalCurrency_
 
Date maturity_
 
string issuer_
 
string sensitivityTemplate_
 
bool sensitivityTemplateSet_ = false
 
std::size_t savedNumberOfPricings_ = 0
 
boost::timer::nanosecond_type savedCumulativePricingTime_ = 0
 
RequiredFixings requiredFixings_
 
std::map< std::string, boost::any > additionalData_
 

Detailed Description

Serializable Commodity Average Price Option

Definition at line 38 of file commoditydigitalapo.hpp.

Constructor & Destructor Documentation

◆ CommodityDigitalAveragePriceOption() [1/2]

Definition at line 40 of file commoditydigitalapo.hpp.

40: ore::data::Trade("CommodityDigitalAveragePriceOption") {}
Trade base class.
Definition: trade.hpp:55

◆ CommodityDigitalAveragePriceOption() [2/2]

CommodityDigitalAveragePriceOption ( const ore::data::Envelope envelope,
const ore::data::OptionData optionData,
QuantLib::Real  strike,
QuantLib::Real  digitalCashPayoff,
const std::string &  currency,
const std::string &  name,
CommodityPriceType  priceType,
const std::string &  startDate,
const std::string &  endDate,
const std::string &  paymentCalendar,
const std::string &  paymentLag,
const std::string &  paymentConvention,
const std::string &  pricingCalendar,
const std::string &  paymentDate = "",
QuantLib::Real  gearing = 1.0,
QuantLib::Spread  spread = 0.0,
QuantExt::CommodityQuantityFrequency  commodityQuantityFrequency = QuantExt::CommodityQuantityFrequency::PerCalculationPeriod,
CommodityPayRelativeTo  commodityPayRelativeTo = CommodityPayRelativeTo::CalculationPeriodEndDate,
QuantLib::Natural  futureMonthOffset = 0,
QuantLib::Natural  deliveryRollDays = 0,
bool  includePeriodEnd = true,
const BarrierData barrierData = {},
const std::string &  fxIndex = "" 
)

Member Function Documentation

◆ build()

void build ( const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &  engineFactory)
override

Definition at line 54 of file commoditydigitalapo.cpp.

54 {
55
56 reset();
57
58 DLOG("CommodityDigitalAveragePriceOption::build() called for trade " << id());
59
60 // ISDA taxonomy, assuming Commodity follows the Equity template
61 additionalData_["isdaAssetClass"] = std::string("Commodity");
62 additionalData_["isdaBaseProduct"] = std::string("Option");
63 additionalData_["isdaSubProduct"] = std::string("Price Return Basic Performance");
64 // skip the transaction level mapping for now
65 additionalData_["isdaTransaction"] = std::string("");
66
67 QL_REQUIRE(optionData_.exerciseDates().size() == 1, "Invalid number of excercise dates");
68 Date exDate = parseDate(optionData_.exerciseDates().front());
69
70
71 Real strikeSpread = strike_ * 0.01; // FIXME, what is a usual spread here, and where should we put it?
72 Real strike1 = strike_ - strikeSpread / 2;
73 Real strike2 = strike_ + strikeSpread / 2;
78
83
84 opt1.build(engineFactory);
85 opt2.build(engineFactory);
86
87 setSensitivityTemplate(opt1.sensitivityTemplate());
88
89 QuantLib::ext::shared_ptr<Instrument> inst1 = opt1.instrument()->qlInstrument();
90 QuantLib::ext::shared_ptr<Instrument> inst2 = opt2.instrument()->qlInstrument();
91
92 QuantLib::ext::shared_ptr<CompositeInstrument> composite = QuantLib::ext::make_shared<CompositeInstrument>();
93 // add and subtract such that the long call spread and long put spread have positive values
94 if (optionData_.callPut() == "Call") {
95 composite->add(inst1);
96 composite->subtract(inst2);
97 } else if (optionData_.callPut() == "Put") {
98 composite->add(inst2);
99 composite->subtract(inst1);
100 } else {
101 QL_FAIL("OptionType Call or Put required in CommodityDigitalOption " << id());
102 }
103
104 Position::Type positionType = parsePositionType(optionData_.longShort());
105 Real bsIndicator = (positionType == QuantLib::Position::Long ? 1.0 : -1.0);
106 Real multiplier = digitalCashPayoff_ * bsIndicator / strikeSpread;
107 std::vector<QuantLib::ext::shared_ptr<Instrument>> additionalInstruments;
108 std::vector<Real> additionalMultipliers;
109 // FIXME: Do we need to retrieve the engine builder's configuration
110 string configuration = Market::defaultConfiguration;
111 Currency ccy = parseCurrencyWithMinors(currency_);
112
113 maturity_ =
114 std::max(exDate, addPremiums(additionalInstruments, additionalMultipliers, multiplier,
115 optionData_.premiumData(), -bsIndicator, ccy, engineFactory, configuration));
116
117 instrument_ = QuantLib::ext::shared_ptr<InstrumentWrapper>(
118 new VanillaInstrument(composite, multiplier, additionalInstruments, additionalMultipliers));
119
123
124 // LOG the volatility if the trade expiry date is in the future.
125 if (exDate > Settings::instance().evaluationDate()) {
126 DLOG("Implied vol for " << tradeType_ << " on " << name_ << " with expiry " << exDate << " and strike "
127 << strike_ << " is "
128 << engineFactory->market()->commodityVolatility(name_)->blackVol(exDate, strike_));
129 }
130
132 additionalData_["strike"] = strike_;
133 additionalData_["optionType"] = optionData_.callPut();
134 additionalData_["strikeCurrency"] = currency_;
135}
QuantExt::CommodityQuantityFrequency commodityQuantityFrequency_
static const string defaultConfiguration
Default configuration label.
Definition: market.hpp:296
const string & callPut() const
Definition: optiondata.hpp:71
const string & longShort() const
Definition: optiondata.hpp:70
const PremiumData & premiumData() const
Definition: optiondata.hpp:83
const vector< string > & exerciseDates() const
Definition: optiondata.hpp:76
string npvCurrency_
Definition: trade.hpp:201
QuantLib::Real notional_
Definition: trade.hpp:202
Date addPremiums(std::vector< QuantLib::ext::shared_ptr< Instrument > > &instruments, std::vector< Real > &multipliers, const Real tradeMultiplier, const PremiumData &premiumData, const Real premiumMultiplier, const Currency &tradeCurrency, const QuantLib::ext::shared_ptr< EngineFactory > &factory, const string &configuration)
Definition: trade.cpp:58
void setSensitivityTemplate(const EngineBuilder &builder)
Definition: trade.cpp:295
string tradeType_
Definition: trade.hpp:196
const Envelope & envelope() const
Definition: trade.hpp:135
QuantLib::ext::shared_ptr< InstrumentWrapper > instrument_
Definition: trade.hpp:197
void reset()
Reset trade, clear all base class data. This does not reset accumulated timings for this trade.
Definition: trade.cpp:130
string notionalCurrency_
Definition: trade.hpp:203
std::map< std::string, boost::any > additionalData_
Definition: trade.hpp:224
Currency parseCurrencyWithMinors(const string &s)
Convert text to QuantLib::Currency.
Definition: parsers.cpp:310
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
Position::Type parsePositionType(const std::string &s)
Convert text to QuantLib::Position::Type.
Definition: parsers.cpp:404
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
+ Here is the call graph for this function:

◆ underlyingIndices()

std::map< AssetClass, std::set< std::string > > underlyingIndices ( const QuantLib::ext::shared_ptr< ReferenceDataManager > &  referenceDataManager = nullptr) const
overridevirtual

Add underlying Commodity names.

Reimplemented from Trade.

Definition at line 137 of file commoditydigitalapo.cpp.

138 {
139 return {{AssetClass::COM, std::set<std::string>({name_})}};
140}

◆ optionData()

const ore::data::OptionData & optionData ( )

Definition at line 63 of file commoditydigitalapo.hpp.

63{ return optionData_; }

◆ barrierData()

const ore::data::BarrierData & barrierData ( )

Definition at line 64 of file commoditydigitalapo.hpp.

64{ return barrierData_; }

◆ strike()

QuantLib::Real strike ( ) const

Definition at line 65 of file commoditydigitalapo.hpp.

65{ return strike_; }

◆ digitalCashPayoff()

QuantLib::Real digitalCashPayoff ( ) const

Definition at line 66 of file commoditydigitalapo.hpp.

66{ return digitalCashPayoff_; }

◆ currency()

const std::string & currency ( ) const

Definition at line 67 of file commoditydigitalapo.hpp.

67{ return currency_; }

◆ name()

const std::string & name ( ) const

Definition at line 68 of file commoditydigitalapo.hpp.

68{ return name_; }

◆ priceType()

CommodityPriceType priceType ( ) const

Definition at line 69 of file commoditydigitalapo.hpp.

69{ return priceType_; }

◆ startDate()

const std::string & startDate ( ) const

Definition at line 70 of file commoditydigitalapo.hpp.

70{ return startDate_; }

◆ endDate()

const std::string & endDate ( ) const

Definition at line 71 of file commoditydigitalapo.hpp.

71{ return endDate_; }

◆ paymentCalendar()

const std::string & paymentCalendar ( ) const

Definition at line 72 of file commoditydigitalapo.hpp.

72{ return paymentCalendar_; }

◆ paymentLag()

const std::string & paymentLag ( ) const

Definition at line 73 of file commoditydigitalapo.hpp.

73{ return paymentLag_; }

◆ paymentConvention()

const std::string & paymentConvention ( ) const

Definition at line 74 of file commoditydigitalapo.hpp.

74{ return paymentConvention_; }

◆ pricingCalendar()

const std::string & pricingCalendar ( ) const

Definition at line 75 of file commoditydigitalapo.hpp.

75{ return pricingCalendar_; }

◆ paymentDate()

const std::string & paymentDate ( ) const

Definition at line 76 of file commoditydigitalapo.hpp.

76{ return paymentDate_; }

◆ gearing()

QuantLib::Real gearing ( ) const

Definition at line 77 of file commoditydigitalapo.hpp.

77{ return gearing_; }

◆ spread()

QuantLib::Spread spread ( ) const

Definition at line 78 of file commoditydigitalapo.hpp.

78{ return spread_; }

◆ commodityQuantityFrequency()

QuantExt::CommodityQuantityFrequency commodityQuantityFrequency ( ) const

Definition at line 79 of file commoditydigitalapo.hpp.

◆ commodityPayRelativeTo()

CommodityPayRelativeTo commodityPayRelativeTo ( ) const

Definition at line 80 of file commoditydigitalapo.hpp.

◆ futureMonthOffset()

QuantLib::Natural futureMonthOffset ( ) const

Definition at line 81 of file commoditydigitalapo.hpp.

81{ return futureMonthOffset_; }

◆ deliveryRollDays()

QuantLib::Natural deliveryRollDays ( ) const

Definition at line 82 of file commoditydigitalapo.hpp.

82{ return deliveryRollDays_; }

◆ includePeriodEnd()

bool includePeriodEnd ( ) const

Definition at line 83 of file commoditydigitalapo.hpp.

83{ return includePeriodEnd_; }

◆ fxIndex()

const std::string & fxIndex ( ) const

Definition at line 84 of file commoditydigitalapo.hpp.

84{ return fxIndex_; }

◆ fromXML()

void fromXML ( ore::data::XMLNode node)
overridevirtual

Reimplemented from Trade.

Definition at line 142 of file commoditydigitalapo.cpp.

142 {
143
144 Trade::fromXML(node);
145
146 XMLNode* apoNode = XMLUtils::getChildNode(node, "CommodityDigitalAveragePriceOptionData");
147 QL_REQUIRE(apoNode, "No CommodityDigitalAveragePriceOptionData Node");
148
149 optionData_.fromXML(XMLUtils::getChildNode(apoNode, "OptionData"));
150 if(auto b = XMLUtils::getChildNode(apoNode, "BarrierData")) {
152 }
153 name_ = XMLUtils::getChildValue(apoNode, "Name", true);
154 currency_ = XMLUtils::getChildValue(apoNode, "Currency", true);
155 strike_ = XMLUtils::getChildValueAsDouble(apoNode, "Strike", true);
156 digitalCashPayoff_ = XMLUtils::getChildValueAsDouble(apoNode, "DigitalCashPayoff", true);
157 priceType_ = parseCommodityPriceType(XMLUtils::getChildValue(apoNode, "PriceType", true));
158 startDate_ = XMLUtils::getChildValue(apoNode, "StartDate", true);
159 endDate_ = XMLUtils::getChildValue(apoNode, "EndDate", true);
160 paymentCalendar_ = XMLUtils::getChildValue(apoNode, "PaymentCalendar", true);
161 paymentLag_ = XMLUtils::getChildValue(apoNode, "PaymentLag", true);
162 paymentConvention_ = XMLUtils::getChildValue(apoNode, "PaymentConvention", true);
163 pricingCalendar_ = XMLUtils::getChildValue(apoNode, "PricingCalendar", true);
164
165 paymentDate_ = XMLUtils::getChildValue(apoNode, "PaymentDate", false);
166
167 gearing_ = 1.0;
168 if (XMLNode* n = XMLUtils::getChildNode(apoNode, "Gearing")) {
170 }
171
172 spread_ = XMLUtils::getChildValueAsDouble(apoNode, "Spread", false);
173
174 commodityQuantityFrequency_ = CommodityQuantityFrequency::PerCalculationPeriod;
175 if (XMLNode* n = XMLUtils::getChildNode(apoNode, "CommodityQuantityFrequency")) {
177 }
178
180 if (XMLNode* n = XMLUtils::getChildNode(apoNode, "CommodityPayRelativeTo")) {
182 }
183
184 futureMonthOffset_ = XMLUtils::getChildValueAsInt(apoNode, "FutureMonthOffset", false);
185 deliveryRollDays_ = XMLUtils::getChildValueAsInt(apoNode, "DeliveryRollDays", false);
186
187 includePeriodEnd_ = true;
188 if (XMLNode* n = XMLUtils::getChildNode(apoNode, "IncludePeriodEnd")) {
190 }
191
192 if (XMLNode* n = XMLUtils::getChildNode(apoNode, "FXIndex")){
194 }
195}
virtual void fromXML(ore::data::XMLNode *node) override
Definition: barrierdata.cpp:25
virtual void fromXML(XMLNode *node) override
Definition: optiondata.cpp:32
virtual void fromXML(XMLNode *node) override
Definition: trade.cpp:34
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
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
bool parseBool(const string &s)
Convert text to bool.
Definition: parsers.cpp:144
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
CommodityPriceType parseCommodityPriceType(const string &s)
CommodityPayRelativeTo parseCommodityPayRelativeTo(const string &s)
CommodityQuantityFrequency parseCommodityQuantityFrequency(const string &s)
Convert text to QuantExt::CommodityQuantityFrequency.
Definition: parsers.cpp:1192
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( ore::data::XMLDocument doc) const
overridevirtual

Reimplemented from Trade.

Definition at line 197 of file commoditydigitalapo.cpp.

197 {
198
199 XMLNode* node = Trade::toXML(doc);
200
201 XMLNode* apoNode = doc.allocNode("CommodityDigitalAveragePriceOptionData");
202 XMLUtils::appendNode(node, apoNode);
203
207 XMLUtils::addChild(doc, apoNode, "Name", name_);
208 XMLUtils::addChild(doc, apoNode, "Currency", currency_);
209 XMLUtils::addChild(doc, apoNode, "Strike", strike_);
210 XMLUtils::addChild(doc, apoNode, "DigitalCashPayoff", digitalCashPayoff_);
211 XMLUtils::addChild(doc, apoNode, "PriceType", to_string(priceType_));
212 XMLUtils::addChild(doc, apoNode, "StartDate", startDate_);
213 XMLUtils::addChild(doc, apoNode, "EndDate", endDate_);
214 XMLUtils::addChild(doc, apoNode, "PaymentCalendar", paymentCalendar_);
215 XMLUtils::addChild(doc, apoNode, "PaymentLag", paymentLag_);
216 XMLUtils::addChild(doc, apoNode, "PaymentConvention", paymentConvention_);
217 XMLUtils::addChild(doc, apoNode, "PricingCalendar", pricingCalendar_);
218 XMLUtils::addChild(doc, apoNode, "PaymentDate", paymentDate_);
219 XMLUtils::addChild(doc, apoNode, "Gearing", gearing_);
220 XMLUtils::addChild(doc, apoNode, "Spread", spread_);
221 XMLUtils::addChild(doc, apoNode, "CommodityQuantityFrequency", to_string(commodityQuantityFrequency_));
222 XMLUtils::addChild(doc, apoNode, "CommodityPayRelativeTo", to_string(commodityPayRelativeTo_));
223 XMLUtils::addChild(doc, apoNode, "FutureMonthOffset", static_cast<int>(futureMonthOffset_));
224 XMLUtils::addChild(doc, apoNode, "DeliveryRollDays", static_cast<int>(deliveryRollDays_));
225 XMLUtils::addChild(doc, apoNode, "IncludePeriodEnd", includePeriodEnd_);
226 if(!fxIndex_.empty()){
227 XMLUtils::addChild(doc, apoNode, "FXIndex", fxIndex_);
228 }
229
230 return node;
231}
virtual ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
Definition: barrierdata.cpp:49
bool initialized() const
Definition: barrierdata.hpp:52
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: optiondata.cpp:86
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: trade.cpp:46
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
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
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ hasCashflows()

bool hasCashflows ( ) const
overridevirtual

Utility method indicating if the trade has cashflows for the cashflow report. The default implementation returns true so that a trade is automatically considered when cashflows are being written. To prevent a trade from being asked for its cashflows, the method can be overridden to return false.

Reimplemented from Trade.

Definition at line 95 of file commoditydigitalapo.hpp.

95{ return false; }

Member Data Documentation

◆ optionData_

ore::data::OptionData optionData_
private

Definition at line 99 of file commoditydigitalapo.hpp.

◆ barrierData_

ore::data::BarrierData barrierData_
private

Definition at line 100 of file commoditydigitalapo.hpp.

◆ strike_

QuantLib::Real strike_
private

Definition at line 101 of file commoditydigitalapo.hpp.

◆ digitalCashPayoff_

QuantLib::Real digitalCashPayoff_
private

Definition at line 102 of file commoditydigitalapo.hpp.

◆ currency_

std::string currency_
private

Definition at line 103 of file commoditydigitalapo.hpp.

◆ name_

std::string name_
private

Definition at line 104 of file commoditydigitalapo.hpp.

◆ priceType_

CommodityPriceType priceType_
private

Definition at line 105 of file commoditydigitalapo.hpp.

◆ startDate_

std::string startDate_
private

Definition at line 106 of file commoditydigitalapo.hpp.

◆ endDate_

std::string endDate_
private

Definition at line 107 of file commoditydigitalapo.hpp.

◆ paymentCalendar_

std::string paymentCalendar_
private

Definition at line 108 of file commoditydigitalapo.hpp.

◆ paymentLag_

std::string paymentLag_
private

Definition at line 109 of file commoditydigitalapo.hpp.

◆ paymentConvention_

std::string paymentConvention_
private

Definition at line 110 of file commoditydigitalapo.hpp.

◆ pricingCalendar_

std::string pricingCalendar_
private

Definition at line 111 of file commoditydigitalapo.hpp.

◆ paymentDate_

std::string paymentDate_
private

Definition at line 112 of file commoditydigitalapo.hpp.

◆ gearing_

QuantLib::Real gearing_
private

Definition at line 113 of file commoditydigitalapo.hpp.

◆ spread_

QuantLib::Spread spread_
private

Definition at line 114 of file commoditydigitalapo.hpp.

◆ commodityQuantityFrequency_

QuantExt::CommodityQuantityFrequency commodityQuantityFrequency_
private

Definition at line 115 of file commoditydigitalapo.hpp.

◆ commodityPayRelativeTo_

CommodityPayRelativeTo commodityPayRelativeTo_
private

Definition at line 116 of file commoditydigitalapo.hpp.

◆ futureMonthOffset_

QuantLib::Natural futureMonthOffset_
private

Definition at line 117 of file commoditydigitalapo.hpp.

◆ deliveryRollDays_

QuantLib::Natural deliveryRollDays_
private

Definition at line 118 of file commoditydigitalapo.hpp.

◆ includePeriodEnd_

bool includePeriodEnd_
private

Definition at line 119 of file commoditydigitalapo.hpp.

◆ fxIndex_

std::string fxIndex_
private

Definition at line 120 of file commoditydigitalapo.hpp.