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

Equity Option Position instrument wrapper. More...

#include <ored/portfolio/equityoptionposition.hpp>

+ Inheritance diagram for EquityOptionPositionInstrumentWrapper:
+ Collaboration diagram for EquityOptionPositionInstrumentWrapper:

Classes

class  arguments
 
class  engine
 
class  results
 

Public Member Functions

 EquityOptionPositionInstrumentWrapper (const Real quantity, const std::vector< QuantLib::ext::shared_ptr< QuantLib::VanillaOption > > &options, const std::vector< Real > &positions, const std::vector< Real > &weights, const std::vector< Handle< Quote > > &fxConversion={})
 
void setNpvCurrencyConversion (const Handle< Quote > &npvCcyConversion)
 

Instrument interface

Real quantity_
 
std::vector< QuantLib::ext::shared_ptr< QuantLib::VanillaOption > > options_
 
std::vector< Real > weights_
 
std::vector< Real > positions_
 
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
 

Detailed Description

Equity Option Position instrument wrapper.

Definition at line 122 of file equityoptionposition.hpp.

Constructor & Destructor Documentation

◆ EquityOptionPositionInstrumentWrapper()

EquityOptionPositionInstrumentWrapper ( const Real  quantity,
const std::vector< QuantLib::ext::shared_ptr< QuantLib::VanillaOption > > &  options,
const std::vector< Real > &  positions,
const std::vector< Real > &  weights,
const std::vector< Handle< Quote > > &  fxConversion = {} 
)

Definition at line 203 of file equityoptionposition.cpp.

206 : quantity_(quantity), options_(options), weights_(weights), positions_(positions), fxConversion_(fxConversion) {
207 QL_REQUIRE(options_.size() == weights_.size(), "EquityOptionPositionInstrumentWrapper: options size ("
208 << options_.size() << ") must match weights size ("
209 << weights_.size() << ")");
210 QL_REQUIRE(fxConversion_.empty() || fxConversion_.size() == options_.size(),
211 "EquityPositionInstrumentWrapper: fxConversion size ("
212 << fxConversion_.size() << ") must match options size (" << options_.size() << ")");
213 for (auto const& o : options)
214 registerWith(o);
215 for (auto const& fx : fxConversion)
216 registerWith(fx);
217}
std::vector< QuantLib::ext::shared_ptr< QuantLib::VanillaOption > > options_

Member Function Documentation

◆ setNpvCurrencyConversion()

void setNpvCurrencyConversion ( const Handle< Quote > &  npvCcyConversion)

Definition at line 219 of file equityoptionposition.cpp.

219 {
220 unregisterWith(npvCcyConversion_);
221 npvCcyConversion_ = npvCcyConversion;
222 registerWith(npvCcyConversion_);
223 update();
224}

◆ isExpired()

bool isExpired ( ) const
override

Definition at line 226 of file equityoptionposition.cpp.

226 {
227 for (auto const& o : options_)
228 if (!o->isExpired())
229 return false;
230 return true;
231}

◆ setupArguments()

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

Definition at line 233 of file equityoptionposition.cpp.

233 {
234 EquityOptionPositionInstrumentWrapper::arguments* a =
235 dynamic_cast<EquityOptionPositionInstrumentWrapper::arguments*>(args);
236 QL_REQUIRE(a != nullptr, "wrong argument type in EquityOptionPositionInstrumentWrapper");
237 a->quantity_ = quantity_;
238 a->options_ = options_;
239 a->weights_ = weights_;
240 a->positions_ = positions_;
241 a->fxConversion_ = fxConversion_;
242 a->npvCcyConversion_ = npvCcyConversion_;
243}

◆ fetchResults()

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

Definition at line 245 of file equityoptionposition.cpp.

245 {
246 Instrument::fetchResults(r);
247}

Member Data Documentation

◆ quantity_

Real quantity_
private

Definition at line 144 of file equityoptionposition.hpp.

◆ options_

std::vector<QuantLib::ext::shared_ptr<QuantLib::VanillaOption> > options_
private

Definition at line 145 of file equityoptionposition.hpp.

◆ weights_

std::vector<Real> weights_
private

Definition at line 146 of file equityoptionposition.hpp.

◆ positions_

std::vector<Real> positions_
private

Definition at line 147 of file equityoptionposition.hpp.

◆ fxConversion_

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

Definition at line 148 of file equityoptionposition.hpp.

◆ npvCcyConversion_

Handle<Quote> npvCcyConversion_
private

Definition at line 149 of file equityoptionposition.hpp.