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

Base class for FFT pricing engines for European vanilla options. More...

#include <fftengine.hpp>

+ Inheritance diagram for FFTEngine:
+ Collaboration diagram for FFTEngine:

Public Member Functions

 FFTEngine (ext::shared_ptr< StochasticProcess1D > process, Real logStrikeSpacing)
 
void calculate () const override
 
void update () override
 
void precalculate (const std::vector< ext::shared_ptr< Instrument > > &optionList)
 
virtual std::unique_ptr< FFTEngineclone () const =0
 

Protected Member Functions

virtual void precalculateExpiry (Date d)=0
 
virtual std::complex< RealcomplexFourierTransform (std::complex< Real > u) const =0
 
virtual Real discountFactor (Date d) const =0
 
virtual Real dividendYield (Date d) const =0
 
void calculateUncached (const ext::shared_ptr< StrikedTypePayoff > &payoff, const ext::shared_ptr< Exercise > &exercise) const
 

Protected Attributes

ext::shared_ptr< StochasticProcess1Dprocess_
 
Real lambda_
 

Private Types

typedef std::map< ext::shared_ptr< StrikedTypePayoff >, RealPayoffResultMap
 
typedef std::map< Date, PayoffResultMapResultMap
 

Private Attributes

ResultMap resultMap_
 

Detailed Description

Base class for FFT pricing engines for European vanilla options.

The FFT engine calculates the values of all options with the same expiry at the same time. For that reason it is very inefficient to price options individually. When using this engine you should collect all the options you wish to price in a list and call the engine's precalculate method before calling the NPV method of the option.

References: Carr, P. and D. B. Madan (1998), "Option Valuation using the fast Fourier transform," Journal of Computational Finance, 2, 61-73.

Definition at line 47 of file fftengine.hpp.

Member Typedef Documentation

◆ PayoffResultMap

typedef std::map<ext::shared_ptr<StrikedTypePayoff>, Real> PayoffResultMap
private

Definition at line 68 of file fftengine.hpp.

◆ ResultMap

typedef std::map<Date, PayoffResultMap> ResultMap
private

Definition at line 69 of file fftengine.hpp.

Constructor & Destructor Documentation

◆ FFTEngine()

FFTEngine ( ext::shared_ptr< StochasticProcess1D process,
Real  logStrikeSpacing 
)

Definition at line 29 of file fftengine.cpp.

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 34 of file fftengine.cpp.

+ Here is the call graph for this function:

◆ update()

void update ( )
override

Definition at line 58 of file fftengine.cpp.

◆ precalculate()

void precalculate ( const std::vector< ext::shared_ptr< Instrument > > &  optionList)

Definition at line 79 of file fftengine.cpp.

+ Here is the call graph for this function:

◆ clone()

virtual std::unique_ptr< FFTEngine > clone ( ) const
pure virtual

Implemented in FFTVanillaEngine, and FFTVarianceGammaEngine.

+ Here is the caller graph for this function:

◆ precalculateExpiry()

virtual void precalculateExpiry ( Date  d)
protectedpure virtual

Implemented in FFTVanillaEngine, and FFTVarianceGammaEngine.

+ Here is the caller graph for this function:

◆ complexFourierTransform()

virtual std::complex< Real > complexFourierTransform ( std::complex< Real u) const
protectedpure virtual

Implemented in FFTVanillaEngine, and FFTVarianceGammaEngine.

+ Here is the caller graph for this function:

◆ discountFactor()

virtual Real discountFactor ( Date  d) const
protectedpure virtual

Implemented in FFTVanillaEngine, and FFTVarianceGammaEngine.

+ Here is the caller graph for this function:

◆ dividendYield()

virtual Real dividendYield ( Date  d) const
protectedpure virtual

Implemented in FFTVanillaEngine, and FFTVarianceGammaEngine.

+ Here is the caller graph for this function:

◆ calculateUncached()

void calculateUncached ( const ext::shared_ptr< StrikedTypePayoff > &  payoff,
const ext::shared_ptr< Exercise > &  exercise 
) const
protected

Definition at line 67 of file fftengine.cpp.

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

Member Data Documentation

◆ process_

ext::shared_ptr<StochasticProcess1D> process_
protected

Definition at line 64 of file fftengine.hpp.

◆ lambda_

Real lambda_
protected

Definition at line 65 of file fftengine.hpp.

◆ resultMap_

ResultMap resultMap_
private

Definition at line 70 of file fftengine.hpp.