QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ReplicatingVarianceSwapEngine Class Reference

Variance-swap pricing engine using replicating cost,. More...

#include <replicatingvarianceswapengine.hpp>

+ Inheritance diagram for ReplicatingVarianceSwapEngine:
+ Collaboration diagram for ReplicatingVarianceSwapEngine:

Public Types

typedef std::vector< std::pair< ext::shared_ptr< StrikedTypePayoff >, Real > > weights_type
 
- Public Types inherited from Observer
typedef set_type::iterator iterator
 

Public Member Functions

 ReplicatingVarianceSwapEngine (ext::shared_ptr< GeneralizedBlackScholesProcess > process, Real dk=5.0, const std::vector< Real > &callStrikes=std::vector< Real >(), const std::vector< Real > &putStrikes=std::vector< Real >())
 
void calculate () const override
 
- Public Member Functions inherited from GenericEngine< VarianceSwap::arguments, VarianceSwap::results >
PricingEngine::argumentsgetArguments () const override
 
const PricingEngine::resultsgetResults () const override
 
void reset () override
 
void update () override
 
- Public Member Functions inherited from PricingEngine
 ~PricingEngine () override=default
 
virtual argumentsgetArguments () const =0
 
virtual const resultsgetResults () const =0
 
virtual void reset ()=0
 
virtual void calculate () const =0
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Protected Member Functions

void computeOptionWeights (const std::vector< Real > &, Option::Type, weights_type &optionWeights) const
 
Real computeLogPayoff (Real, Real) const
 
Real computeReplicatingPortfolio (const weights_type &optionWeights) const
 
Rate riskFreeRate () const
 
DiscountFactor riskFreeDiscount () const
 
Real underlying () const
 
Time residualTime () const
 

Private Attributes

ext::shared_ptr< GeneralizedBlackScholesProcessprocess_
 
Real dk_
 
std::vector< RealcallStrikes_
 
std::vector< RealputStrikes_
 

Additional Inherited Members

- Protected Attributes inherited from GenericEngine< VarianceSwap::arguments, VarianceSwap::results >
VarianceSwap::arguments arguments_
 
VarianceSwap::results results_
 

Detailed Description

Variance-swap pricing engine using replicating cost,.

as described in Demeterfi, Derman, Kamal & Zou, "A Guide to Volatility and Variance Swaps", 1999

Tests:
returned variances verified against results from literature

Definition at line 44 of file replicatingvarianceswapengine.hpp.

Member Typedef Documentation

◆ weights_type

typedef std::vector<std::pair< ext::shared_ptr<StrikedTypePayoff>, Real> > weights_type

Definition at line 47 of file replicatingvarianceswapengine.hpp.

Constructor & Destructor Documentation

◆ ReplicatingVarianceSwapEngine()

ReplicatingVarianceSwapEngine ( ext::shared_ptr< GeneralizedBlackScholesProcess process,
Real  dk = 5.0,
const std::vector< Real > &  callStrikes = std::vector<Real>(),
const std::vector< Real > &  putStrikes = std::vector<Real>() 
)

Definition at line 76 of file replicatingvarianceswapengine.hpp.

Member Function Documentation

◆ calculate()

void calculate ( ) const
overridevirtual

Implements PricingEngine.

Definition at line 182 of file replicatingvarianceswapengine.hpp.

+ Here is the call graph for this function:

◆ computeOptionWeights()

void computeOptionWeights ( const std::vector< Real > &  availStrikes,
Option::Type  type,
weights_type optionWeights 
) const
protected

Definition at line 94 of file replicatingvarianceswapengine.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ computeLogPayoff()

Real computeLogPayoff ( Real  strike,
Real  callPutStrikeBoundary 
) const
protected

Definition at line 146 of file replicatingvarianceswapengine.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ computeReplicatingPortfolio()

Real computeReplicatingPortfolio ( const weights_type optionWeights) const
protected

Definition at line 155 of file replicatingvarianceswapengine.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ riskFreeRate()

Rate riskFreeRate ( ) const
protected

Definition at line 219 of file replicatingvarianceswapengine.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ riskFreeDiscount()

DiscountFactor riskFreeDiscount ( ) const
protected

Definition at line 226 of file replicatingvarianceswapengine.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ underlying()

Real underlying ( ) const
protected

Definition at line 209 of file replicatingvarianceswapengine.hpp.

+ Here is the caller graph for this function:

◆ residualTime()

Time residualTime ( ) const
protected

Definition at line 214 of file replicatingvarianceswapengine.hpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ process_

ext::shared_ptr<GeneralizedBlackScholesProcess> process_
private

Definition at line 68 of file replicatingvarianceswapengine.hpp.

◆ dk_

Real dk_
private

Definition at line 69 of file replicatingvarianceswapengine.hpp.

◆ callStrikes_

std::vector<Real> callStrikes_
private

Definition at line 70 of file replicatingvarianceswapengine.hpp.

◆ putStrikes_

std::vector<Real> putStrikes_
private

Definition at line 70 of file replicatingvarianceswapengine.hpp.