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

Finite-differences Heston vanilla option engine. More...

#include <fdhestonvanillaengine.hpp>

+ Inheritance diagram for FdHestonVanillaEngine:
+ Collaboration diagram for FdHestonVanillaEngine:

Public Member Functions

 FdHestonVanillaEngine (const ext::shared_ptr< HestonModel > &model, Size tGrid=100, Size xGrid=100, Size vGrid=50, Size dampingSteps=0, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Hundsdorfer(), ext::shared_ptr< LocalVolTermStructure > leverageFct={}, Real mixingFactor=1.0)
 
 FdHestonVanillaEngine (const ext::shared_ptr< HestonModel > &model, DividendSchedule dividends, Size tGrid=100, Size xGrid=100, Size vGrid=50, Size dampingSteps=0, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Hundsdorfer(), ext::shared_ptr< LocalVolTermStructure > leverageFct={}, Real mixingFactor=1.0)
 
 FdHestonVanillaEngine (const ext::shared_ptr< HestonModel > &model, ext::shared_ptr< FdmQuantoHelper > quantoHelper, Size tGrid=100, Size xGrid=100, Size vGrid=50, Size dampingSteps=0, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Hundsdorfer(), ext::shared_ptr< LocalVolTermStructure > leverageFct={}, Real mixingFactor=1.0)
 
 FdHestonVanillaEngine (const ext::shared_ptr< HestonModel > &model, DividendSchedule dividends, ext::shared_ptr< FdmQuantoHelper > quantoHelper, Size tGrid=100, Size xGrid=100, Size vGrid=50, Size dampingSteps=0, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Hundsdorfer(), ext::shared_ptr< LocalVolTermStructure > leverageFct={}, Real mixingFactor=1.0)
 
void calculate () const override
 
void update () override
 
void enableMultipleStrikesCaching (const std::vector< Real > &strikes)
 
FdmSolverDesc getSolverDesc (Real equityScaleFactor) const
 
- Public Member Functions inherited from GenericModelEngine< HestonModel, VanillaOption::arguments, VanillaOption::results >
 GenericModelEngine (Handle< HestonModel > model=Handle< HestonModel >())
 
 GenericModelEngine (const ext::shared_ptr< HestonModel > &model)
 
- Public Member Functions inherited from GenericEngine< ArgumentsType, ResultsType >
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 ()
 

Private Attributes

DividendSchedule dividends_
 
const Size tGrid_
 
const Size xGrid_
 
const Size vGrid_
 
const Size dampingSteps_
 
const FdmSchemeDesc schemeDesc_
 
const ext::shared_ptr< LocalVolTermStructureleverageFct_
 
const ext::shared_ptr< FdmQuantoHelperquantoHelper_
 
const Real mixingFactor_
 
std::vector< Realstrikes_
 
std::vector< std::pair< VanillaOption::arguments, VanillaOption::results > > cachedArgs2results_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Attributes inherited from GenericModelEngine< HestonModel, VanillaOption::arguments, VanillaOption::results >
Handle< HestonModelmodel_
 
- Protected Attributes inherited from GenericEngine< ArgumentsType, ResultsType >
ArgumentsType arguments_
 
ResultsType results_
 

Detailed Description

Finite-differences Heston vanilla option engine.

Tests:
the correctness of the returned value is tested by reproducing results available in web/literature and comparison with Black pricing.

Definition at line 47 of file fdhestonvanillaengine.hpp.

Constructor & Destructor Documentation

◆ FdHestonVanillaEngine() [1/4]

FdHestonVanillaEngine ( const ext::shared_ptr< HestonModel > &  model,
Size  tGrid = 100,
Size  xGrid = 100,
Size  vGrid = 50,
Size  dampingSteps = 0,
const FdmSchemeDesc schemeDesc = FdmSchemeDesc::Hundsdorfer(),
ext::shared_ptr< LocalVolTermStructure leverageFct = {},
Real  mixingFactor = 1.0 
)
explicit

Definition at line 37 of file fdhestonvanillaengine.cpp.

◆ FdHestonVanillaEngine() [2/4]

FdHestonVanillaEngine ( const ext::shared_ptr< HestonModel > &  model,
DividendSchedule  dividends,
Size  tGrid = 100,
Size  xGrid = 100,
Size  vGrid = 50,
Size  dampingSteps = 0,
const FdmSchemeDesc schemeDesc = FdmSchemeDesc::Hundsdorfer(),
ext::shared_ptr< LocalVolTermStructure leverageFct = {},
Real  mixingFactor = 1.0 
)

Definition at line 52 of file fdhestonvanillaengine.cpp.

◆ FdHestonVanillaEngine() [3/4]

FdHestonVanillaEngine ( const ext::shared_ptr< HestonModel > &  model,
ext::shared_ptr< FdmQuantoHelper quantoHelper,
Size  tGrid = 100,
Size  xGrid = 100,
Size  vGrid = 50,
Size  dampingSteps = 0,
const FdmSchemeDesc schemeDesc = FdmSchemeDesc::Hundsdorfer(),
ext::shared_ptr< LocalVolTermStructure leverageFct = {},
Real  mixingFactor = 1.0 
)

Definition at line 69 of file fdhestonvanillaengine.cpp.

◆ FdHestonVanillaEngine() [4/4]

FdHestonVanillaEngine ( const ext::shared_ptr< HestonModel > &  model,
DividendSchedule  dividends,
ext::shared_ptr< FdmQuantoHelper quantoHelper,
Size  tGrid = 100,
Size  xGrid = 100,
Size  vGrid = 50,
Size  dampingSteps = 0,
const FdmSchemeDesc schemeDesc = FdmSchemeDesc::Hundsdorfer(),
ext::shared_ptr< LocalVolTermStructure leverageFct = {},
Real  mixingFactor = 1.0 
)

Definition at line 85 of file fdhestonvanillaengine.cpp.

Member Function Documentation

◆ calculate()

void calculate ( ) const
overridevirtual

Implements PricingEngine.

Definition at line 175 of file fdhestonvanillaengine.cpp.

+ Here is the call graph for this function:

◆ update()

void update ( )
overridevirtual

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Reimplemented from GenericEngine< ArgumentsType, ResultsType >.

Definition at line 231 of file fdhestonvanillaengine.cpp.

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

◆ enableMultipleStrikesCaching()

void enableMultipleStrikesCaching ( const std::vector< Real > &  strikes)

Definition at line 238 of file fdhestonvanillaengine.cpp.

◆ getSolverDesc()

FdmSolverDesc getSolverDesc ( Real  equityScaleFactor) const

Definition at line 103 of file fdhestonvanillaengine.cpp.

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

Member Data Documentation

◆ dividends_

DividendSchedule dividends_
private

Definition at line 103 of file fdhestonvanillaengine.hpp.

◆ tGrid_

const Size tGrid_
private

Definition at line 104 of file fdhestonvanillaengine.hpp.

◆ xGrid_

const Size xGrid_
private

Definition at line 104 of file fdhestonvanillaengine.hpp.

◆ vGrid_

const Size vGrid_
private

Definition at line 104 of file fdhestonvanillaengine.hpp.

◆ dampingSteps_

const Size dampingSteps_
private

Definition at line 104 of file fdhestonvanillaengine.hpp.

◆ schemeDesc_

const FdmSchemeDesc schemeDesc_
private

Definition at line 105 of file fdhestonvanillaengine.hpp.

◆ leverageFct_

const ext::shared_ptr<LocalVolTermStructure> leverageFct_
private

Definition at line 106 of file fdhestonvanillaengine.hpp.

◆ quantoHelper_

const ext::shared_ptr<FdmQuantoHelper> quantoHelper_
private

Definition at line 107 of file fdhestonvanillaengine.hpp.

◆ mixingFactor_

const Real mixingFactor_
private

Definition at line 108 of file fdhestonvanillaengine.hpp.

◆ strikes_

std::vector<Real> strikes_
private

Definition at line 110 of file fdhestonvanillaengine.hpp.

◆ cachedArgs2results_

std::vector<std::pair<VanillaOption::arguments, VanillaOption::results> > cachedArgs2results_
mutableprivate

Definition at line 113 of file fdhestonvanillaengine.hpp.