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

#include <qle/instruments/cashsettledeuropeanoption.hpp>

+ Inheritance diagram for CashSettledEuropeanOption:
+ Collaboration diagram for CashSettledEuropeanOption:

Classes

class  arguments
 
class  engine
 Engine. More...
 

Public Member Functions

 CashSettledEuropeanOption (QuantLib::Option::Type type, QuantLib::Real strike, const QuantLib::Date &expiryDate, const QuantLib::Date &paymentDate, bool automaticExercise, const QuantLib::ext::shared_ptr< QuantLib::Index > &underlying=nullptr, bool exercised=false, QuantLib::Real priceAtExercise=QuantLib::Null< QuantLib::Real >())
 Constructor for cash settled vanilla European option. More...
 
 CashSettledEuropeanOption (QuantLib::Option::Type type, QuantLib::Real strike, const QuantLib::Date &expiryDate, QuantLib::Natural paymentLag, const QuantLib::Calendar &paymentCalendar, QuantLib::BusinessDayConvention paymentConvention, bool automaticExercise, const QuantLib::ext::shared_ptr< QuantLib::Index > &underlying=nullptr, bool exercised=false, QuantLib::Real priceAtExercise=QuantLib::Null< QuantLib::Real >())
 Constructor for cash settled vanilla European option. More...
 
 CashSettledEuropeanOption (QuantLib::Option::Type type, QuantLib::Real strike, QuantLib::Real cashPayoff, const QuantLib::Date &expiryDate, const QuantLib::Date &paymentDate, bool automaticExercise, const QuantLib::ext::shared_ptr< QuantLib::Index > &underlying=nullptr, bool exercised=false, QuantLib::Real priceAtExercise=QuantLib::Null< QuantLib::Real >())
 Constructor for cash settled vanilla European option with digital payoff. More...
 
 CashSettledEuropeanOption (QuantLib::Option::Type type, QuantLib::Real strike, QuantLib::Real cashPayoff, const QuantLib::Date &expiryDate, QuantLib::Natural paymentLag, const QuantLib::Calendar &paymentCalendar, QuantLib::BusinessDayConvention paymentConvention, bool automaticExercise, const QuantLib::ext::shared_ptr< QuantLib::Index > &underlying=nullptr, bool exercised=false, QuantLib::Real priceAtExercise=QuantLib::Null< QuantLib::Real >())
 Constructor for cash settled vanilla European option with digital payoff. More...
 
Instrument interface
bool isExpired () const override
 Account for cash settled European options not being expired until payment is made. More...
 
void setupArguments (QuantLib::PricingEngine::arguments *args) const override
 Set up the extra arguments. More...
 
void exercise (QuantLib::Real priceAtExercise)
 Mark option as manually exercised at the given priceAtExercise. More...
 

Inspectors

QuantLib::Date paymentDate_
 
bool automaticExercise_
 
QuantLib::ext::shared_ptr< QuantLib::Index > underlying_
 
bool exercised_
 
QuantLib::Real priceAtExercise_
 
const QuantLib::Date & paymentDate () const
 
bool automaticExercise () const
 
const QuantLib::ext::shared_ptr< QuantLib::Index > & underlying () const
 
bool exercised () const
 
QuantLib::Real priceAtExercise () const
 
void init (bool exercised, QuantLib::Real priceAtExercise)
 Shared initialisation. More...
 

Detailed Description

Vanilla cash settled European options allowing for deferred payment and automatic exercise.

Definition at line 36 of file cashsettledeuropeanoption.hpp.

Constructor & Destructor Documentation

◆ CashSettledEuropeanOption() [1/4]

CashSettledEuropeanOption ( QuantLib::Option::Type  type,
QuantLib::Real  strike,
const QuantLib::Date &  expiryDate,
const QuantLib::Date &  paymentDate,
bool  automaticExercise,
const QuantLib::ext::shared_ptr< QuantLib::Index > &  underlying = nullptr,
bool  exercised = false,
QuantLib::Real  priceAtExercise = QuantLib::Null< QuantLib::Real >() 
)

Constructor for cash settled vanilla European option.

◆ CashSettledEuropeanOption() [2/4]

CashSettledEuropeanOption ( QuantLib::Option::Type  type,
QuantLib::Real  strike,
const QuantLib::Date &  expiryDate,
QuantLib::Natural  paymentLag,
const QuantLib::Calendar &  paymentCalendar,
QuantLib::BusinessDayConvention  paymentConvention,
bool  automaticExercise,
const QuantLib::ext::shared_ptr< QuantLib::Index > &  underlying = nullptr,
bool  exercised = false,
QuantLib::Real  priceAtExercise = QuantLib::Null< QuantLib::Real >() 
)

Constructor for cash settled vanilla European option.

◆ CashSettledEuropeanOption() [3/4]

CashSettledEuropeanOption ( QuantLib::Option::Type  type,
QuantLib::Real  strike,
QuantLib::Real  cashPayoff,
const QuantLib::Date &  expiryDate,
const QuantLib::Date &  paymentDate,
bool  automaticExercise,
const QuantLib::ext::shared_ptr< QuantLib::Index > &  underlying = nullptr,
bool  exercised = false,
QuantLib::Real  priceAtExercise = QuantLib::Null< QuantLib::Real >() 
)

Constructor for cash settled vanilla European option with digital payoff.

◆ CashSettledEuropeanOption() [4/4]

CashSettledEuropeanOption ( QuantLib::Option::Type  type,
QuantLib::Real  strike,
QuantLib::Real  cashPayoff,
const QuantLib::Date &  expiryDate,
QuantLib::Natural  paymentLag,
const QuantLib::Calendar &  paymentCalendar,
QuantLib::BusinessDayConvention  paymentConvention,
bool  automaticExercise,
const QuantLib::ext::shared_ptr< QuantLib::Index > &  underlying = nullptr,
bool  exercised = false,
QuantLib::Real  priceAtExercise = QuantLib::Null< QuantLib::Real >() 
)

Constructor for cash settled vanilla European option with digital payoff.

Member Function Documentation

◆ isExpired()

bool isExpired ( ) const
override

Account for cash settled European options not being expired until payment is made.

Definition at line 141 of file cashsettledeuropeanoption.cpp.

141{ return QuantLib::detail::simple_event(paymentDate_).hasOccurred(); }

◆ setupArguments()

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

Set up the extra arguments.

Definition at line 143 of file cashsettledeuropeanoption.cpp.

143 {
144
145 VanillaOption::setupArguments(args);
146
147 CashSettledEuropeanOption::arguments* arguments = dynamic_cast<CashSettledEuropeanOption::arguments*>(args);
148
149 // We have a VanillaOption engine that will ignore the deferred payment.
150 if (!arguments)
151 return;
152
153 // Set up the arguments specific to cash settled european option.
154 arguments->paymentDate = paymentDate_;
155 arguments->automaticExercise = automaticExercise_;
156 arguments->underlying = underlying_;
157 arguments->exercised = exercised_;
158 arguments->priceAtExercise = priceAtExercise_;
159}
QuantLib::ext::shared_ptr< QuantLib::Index > underlying_

◆ exercise()

void exercise ( QuantLib::Real  priceAtExercise)

Mark option as manually exercised at the given priceAtExercise.

Definition at line 161 of file cashsettledeuropeanoption.cpp.

161 {
162 QL_REQUIRE(priceAtExercise != Null<Real>(), "Cannot exercise with a null price.");
163 QL_REQUIRE(Settings::instance().evaluationDate() >= exercise_->lastDate(),
164 "European option cannot be "
165 << "exercised before expiry date. Valuation date " << iso_date(Settings::instance().evaluationDate())
166 << " is before expiry date " << iso_date(exercise_->lastDate()) << ".");
167 exercised_ = true;
169 update();
170}
+ Here is the caller graph for this function:

◆ paymentDate()

const Date & paymentDate ( ) const

Definition at line 172 of file cashsettledeuropeanoption.cpp.

172{ return paymentDate_; }

◆ automaticExercise()

bool automaticExercise ( ) const

Definition at line 174 of file cashsettledeuropeanoption.cpp.

174{ return automaticExercise_; }

◆ underlying()

const QuantLib::ext::shared_ptr< Index > & underlying ( ) const

Definition at line 176 of file cashsettledeuropeanoption.cpp.

176{ return underlying_; }

◆ exercised()

bool exercised ( ) const

Definition at line 178 of file cashsettledeuropeanoption.cpp.

178{ return exercised_; }

◆ priceAtExercise()

Real priceAtExercise ( ) const

Definition at line 180 of file cashsettledeuropeanoption.cpp.

180{ return priceAtExercise_; }

◆ init()

void init ( bool  exercised,
QuantLib::Real  priceAtExercise 
)
private

Shared initialisation.

Definition at line 133 of file cashsettledeuropeanoption.cpp.

133 {
134 if (exercised)
136
138 registerWith(underlying_);
139}
void exercise(QuantLib::Real priceAtExercise)
Mark option as manually exercised at the given priceAtExercise.

Member Data Documentation

◆ paymentDate_

QuantLib::Date paymentDate_
private

Definition at line 91 of file cashsettledeuropeanoption.hpp.

◆ automaticExercise_

bool automaticExercise_
private

Definition at line 92 of file cashsettledeuropeanoption.hpp.

◆ underlying_

QuantLib::ext::shared_ptr<QuantLib::Index> underlying_
private

Definition at line 93 of file cashsettledeuropeanoption.hpp.

◆ exercised_

bool exercised_
private

Definition at line 94 of file cashsettledeuropeanoption.hpp.

◆ priceAtExercise_

QuantLib::Real priceAtExercise_
private

Definition at line 95 of file cashsettledeuropeanoption.hpp.