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

Commodity Position instrument wrapper. More...

#include <ored/portfolio/commodityposition.hpp>

+ Inheritance diagram for CommodityPositionInstrumentWrapper:
+ Collaboration diagram for CommodityPositionInstrumentWrapper:

Classes

class  arguments
 
class  engine
 
class  results
 

Public Member Functions

 CommodityPositionInstrumentWrapper (const Real quantity, const std::vector< QuantLib::ext::shared_ptr< QuantExt::CommodityIndex > > &commodities, const std::vector< Real > &weights, const std::vector< Handle< Quote > > &fxConversion={})
 

Instrument interface

Real quantity_
 
std::vector< QuantLib::ext::shared_ptr< QuantExt::CommodityIndex > > commodities_
 
std::vector< Real > weights_
 
std::vector< Handle< Quote > > fxConversion_
 
Handle< Quote > npvCcyConversion_
 
bool isExpired () const override
 
void setupArguments (QuantLib::PricingEngine::arguments *) const override
 
void fetchResults (const QuantLib::PricingEngine::results *) const override
 
void setNpvCurrencyConversion (const Handle< Quote > &npvCcyConversion)
 
void setupExpired () const override
 

Detailed Description

Commodity Position instrument wrapper.

Definition at line 84 of file commodityposition.hpp.

Constructor & Destructor Documentation

◆ CommodityPositionInstrumentWrapper()

CommodityPositionInstrumentWrapper ( const Real  quantity,
const std::vector< QuantLib::ext::shared_ptr< QuantExt::CommodityIndex > > &  commodities,
const std::vector< Real > &  weights,
const std::vector< Handle< Quote > > &  fxConversion = {} 
)

Definition at line 155 of file commodityposition.cpp.

158 : quantity_(quantity), commodities_(commodities), weights_(weights), fxConversion_(fxConversion) {
159 QL_REQUIRE(commodities_.size() == weights_.size(), "CommodityPositionInstrumentWrapper: commodities size ("
160 << commodities_.size() << ") must match weights size ("
161 << weights_.size() << ")");
162 QL_REQUIRE(fxConversion_.empty() || fxConversion_.size() == commodities_.size(),
163 "CommodityPositionInstrumentWrapper: fxConversion size ("
164 << fxConversion_.size() << ") must match commodities size (" << commodities_.size() << ")");
165 for (auto const& i : commodities_)
166 registerWith(i);
167 for (auto const& f : fxConversion_)
168 registerWith(f);
169 registerWith(npvCcyConversion_);
170}
std::vector< QuantLib::ext::shared_ptr< QuantExt::CommodityIndex > > commodities_

Member Function Documentation

◆ isExpired()

bool isExpired ( ) const
override

Definition at line 176 of file commodityposition.cpp.

176{ return false; }

◆ setupArguments()

void setupArguments ( QuantLib::PricingEngine::arguments ) const
override

Definition at line 180 of file commodityposition.cpp.

180 {
181 CommodityPositionInstrumentWrapper::arguments* a = dynamic_cast<CommodityPositionInstrumentWrapper::arguments*>(args);
182 QL_REQUIRE(a != nullptr, "wrong argument type in CommodityPositionInstrumentWrapper");
183 a->quantity_ = quantity_;
184 a->commodities_ = commodities_;
185 a->weights_ = weights_;
186 a->fxConversion_ = fxConversion_;
187 a->npvCcyConversion_ = npvCcyConversion_;
188}

◆ fetchResults()

void fetchResults ( const QuantLib::PricingEngine::results *  ) const
override

Definition at line 190 of file commodityposition.cpp.

190 {
191 Instrument::fetchResults(r);
192}

◆ setNpvCurrencyConversion()

void setNpvCurrencyConversion ( const Handle< Quote > &  npvCcyConversion)

Definition at line 172 of file commodityposition.cpp.

172 {
173 npvCcyConversion_ = npvCcyConversion;
174}

◆ setupExpired()

void setupExpired ( ) const
overrideprivate

Definition at line 178 of file commodityposition.cpp.

178{ Instrument::setupExpired(); }

Member Data Documentation

◆ quantity_

Real quantity_
private

Definition at line 105 of file commodityposition.hpp.

◆ commodities_

std::vector<QuantLib::ext::shared_ptr<QuantExt::CommodityIndex> > commodities_
private

Definition at line 106 of file commodityposition.hpp.

◆ weights_

std::vector<Real> weights_
private

Definition at line 107 of file commodityposition.hpp.

◆ fxConversion_

std::vector<Handle<Quote> > fxConversion_
private

Definition at line 108 of file commodityposition.hpp.

◆ npvCcyConversion_

Handle<Quote> npvCcyConversion_
private

Definition at line 109 of file commodityposition.hpp.