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
HestonModelHelper Class Reference

calibration helper for Heston model More...

#include <hestonmodelhelper.hpp>

+ Inheritance diagram for HestonModelHelper:
+ Collaboration diagram for HestonModelHelper:

Public Member Functions

 HestonModelHelper (const Period &maturity, Calendar calendar, Real s0, Real strikePrice, const Handle< Quote > &volatility, const Handle< YieldTermStructure > &riskFreeRate, const Handle< YieldTermStructure > &dividendYield, BlackCalibrationHelper::CalibrationErrorType errorType=BlackCalibrationHelper::RelativePriceError)
 
 HestonModelHelper (const Period &maturity, Calendar calendar, const Handle< Quote > &s0, Real strikePrice, const Handle< Quote > &volatility, const Handle< YieldTermStructure > &riskFreeRate, const Handle< YieldTermStructure > &dividendYield, BlackCalibrationHelper::CalibrationErrorType errorType=BlackCalibrationHelper::RelativePriceError)
 
void addTimesTo (std::list< Time > &) const override
 
void performCalculations () const override
 
Real modelValue () const override
 returns the price of the instrument according to the model More...
 
Real blackPrice (Real volatility) const override
 Black or Bachelier price given a volatility. More...
 
Time maturity () const
 
- Public Member Functions inherited from BlackCalibrationHelper
 BlackCalibrationHelper (Handle< Quote > volatility, CalibrationErrorType calibrationErrorType=RelativePriceError, const VolatilityType type=ShiftedLognormal, const Real shift=0.0)
 
void performCalculations () const override
 
Handle< Quotevolatility () const
 returns the volatility Handle More...
 
VolatilityType volatilityType () const
 returns the volatility type More...
 
Real marketValue () const
 returns the actual price of the instrument (from volatility) More...
 
virtual Real modelValue () const =0
 returns the price of the instrument according to the model More...
 
Real calibrationError () override
 returns the error resulting from the model valuation More...
 
virtual void addTimesTo (std::list< Time > &times) const =0
 
Volatility impliedVolatility (Real targetValue, Real accuracy, Size maxEvaluations, Volatility minVol, Volatility maxVol) const
 Black volatility implied by the model. More...
 
virtual Real blackPrice (Volatility volatility) const =0
 Black or Bachelier price given a volatility. More...
 
void setPricingEngine (const ext::shared_ptr< PricingEngine > &engine)
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- 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 ()
 
- Public Member Functions inherited from CalibrationHelper
virtual ~CalibrationHelper ()=default
 
virtual Real calibrationError ()=0
 returns the error resulting from the model valuation More...
 

Private Attributes

const Period maturity_
 
const Calendar calendar_
 
const Handle< Quotes0_
 
const Real strikePrice_
 
const Handle< YieldTermStructureriskFreeRate_
 
const Handle< YieldTermStructuredividendYield_
 
Date exerciseDate_
 
Time tau_
 
Option::Type type_
 
ext::shared_ptr< VanillaOptionoption_
 

Additional Inherited Members

- Public Types inherited from BlackCalibrationHelper
enum  CalibrationErrorType { RelativePriceError , PriceError , ImpliedVolError }
 
- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 
- Protected Attributes inherited from BlackCalibrationHelper
Real marketValue_
 
Handle< Quotevolatility_
 
ext::shared_ptr< PricingEngineengine_
 
const VolatilityType volatilityType_
 
const Real shift_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Detailed Description

calibration helper for Heston model

Definition at line 34 of file hestonmodelhelper.hpp.

Constructor & Destructor Documentation

◆ HestonModelHelper() [1/2]

HestonModelHelper ( const Period maturity,
Calendar  calendar,
Real  s0,
Real  strikePrice,
const Handle< Quote > &  volatility,
const Handle< YieldTermStructure > &  riskFreeRate,
const Handle< YieldTermStructure > &  dividendYield,
BlackCalibrationHelper::CalibrationErrorType  errorType = BlackCalibrationHelper::RelativePriceError 
)

Definition at line 33 of file hestonmodelhelper.cpp.

+ Here is the call graph for this function:

◆ HestonModelHelper() [2/2]

HestonModelHelper ( const Period maturity,
Calendar  calendar,
const Handle< Quote > &  s0,
Real  strikePrice,
const Handle< Quote > &  volatility,
const Handle< YieldTermStructure > &  riskFreeRate,
const Handle< YieldTermStructure > &  dividendYield,
BlackCalibrationHelper::CalibrationErrorType  errorType = BlackCalibrationHelper::RelativePriceError 
)

Definition at line 48 of file hestonmodelhelper.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ addTimesTo()

void addTimesTo ( std::list< Time > &  ) const
overridevirtual

Implements BlackCalibrationHelper.

Definition at line 56 of file hestonmodelhelper.hpp.

◆ performCalculations()

void performCalculations ( ) const
overridevirtual

This method must implement any calculations which must be (re)done in order to calculate the desired results.

Reimplemented from BlackCalibrationHelper.

Definition at line 64 of file hestonmodelhelper.cpp.

+ Here is the call graph for this function:

◆ modelValue()

Real modelValue ( ) const
overridevirtual

returns the price of the instrument according to the model

Implements BlackCalibrationHelper.

Definition at line 80 of file hestonmodelhelper.cpp.

+ Here is the call graph for this function:

◆ blackPrice()

Real blackPrice ( Real  volatility) const
overridevirtual

Black or Bachelier price given a volatility.

Implements BlackCalibrationHelper.

Definition at line 86 of file hestonmodelhelper.cpp.

+ Here is the call graph for this function:

◆ maturity()

Time maturity ( ) const

Definition at line 60 of file hestonmodelhelper.hpp.

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

Member Data Documentation

◆ maturity_

const Period maturity_
private

Definition at line 62 of file hestonmodelhelper.hpp.

◆ calendar_

const Calendar calendar_
private

Definition at line 63 of file hestonmodelhelper.hpp.

◆ s0_

const Handle<Quote> s0_
private

Definition at line 64 of file hestonmodelhelper.hpp.

◆ strikePrice_

const Real strikePrice_
private

Definition at line 65 of file hestonmodelhelper.hpp.

◆ riskFreeRate_

const Handle<YieldTermStructure> riskFreeRate_
private

Definition at line 66 of file hestonmodelhelper.hpp.

◆ dividendYield_

const Handle<YieldTermStructure> dividendYield_
private

Definition at line 67 of file hestonmodelhelper.hpp.

◆ exerciseDate_

Date exerciseDate_
mutableprivate

Definition at line 68 of file hestonmodelhelper.hpp.

◆ tau_

Time tau_
mutableprivate

Definition at line 69 of file hestonmodelhelper.hpp.

◆ type_

Option::Type type_
mutableprivate

Definition at line 70 of file hestonmodelhelper.hpp.

◆ option_

ext::shared_ptr<VanillaOption> option_
mutableprivate

Definition at line 71 of file hestonmodelhelper.hpp.