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 Attributes | Private Attributes | List of all members
BlackCalibrationHelper Class Referenceabstract

liquid Black76 market instrument used during calibration More...

#include <calibrationhelper.hpp>

+ Inheritance diagram for BlackCalibrationHelper:
+ Collaboration diagram for BlackCalibrationHelper:

Public Types

enum  CalibrationErrorType { RelativePriceError , PriceError , ImpliedVolError }
 
- Public Types inherited from Observer
typedef set_type::iterator iterator
 

Public Member Functions

 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...
 

Protected Attributes

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_
 

Private Attributes

const CalibrationErrorType calibrationErrorType_
 

Additional Inherited Members

- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 

Detailed Description

liquid Black76 market instrument used during calibration

Definition at line 48 of file calibrationhelper.hpp.

Member Enumeration Documentation

◆ CalibrationErrorType

Enumerator
RelativePriceError 
PriceError 
ImpliedVolError 

Definition at line 50 of file calibrationhelper.hpp.

Constructor & Destructor Documentation

◆ BlackCalibrationHelper()

BlackCalibrationHelper ( Handle< Quote volatility,
CalibrationErrorType  calibrationErrorType = RelativePriceError,
const VolatilityType  type = ShiftedLognormal,
const Real  shift = 0.0 
)

Definition at line 53 of file calibrationhelper.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ performCalculations()

void performCalculations ( ) const
overridevirtual

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

Implements LazyObject.

Reimplemented in HestonModelHelper, CapHelper, and SwaptionHelper.

Definition at line 62 of file calibrationhelper.hpp.

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

◆ volatility()

Handle< Quote > volatility ( ) const

returns the volatility Handle

Definition at line 67 of file calibrationhelper.hpp.

+ Here is the caller graph for this function:

◆ volatilityType()

VolatilityType volatilityType ( ) const

returns the volatility type

Definition at line 70 of file calibrationhelper.hpp.

◆ marketValue()

Real marketValue ( ) const

returns the actual price of the instrument (from volatility)

Definition at line 73 of file calibrationhelper.hpp.

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

◆ modelValue()

virtual Real modelValue ( ) const
pure virtual

returns the price of the instrument according to the model

Implemented in HestonModelHelper, CapHelper, and SwaptionHelper.

+ Here is the caller graph for this function:

◆ calibrationError()

Real calibrationError ( )
overridevirtual

returns the error resulting from the model valuation

Implements CalibrationHelper.

Definition at line 52 of file calibrationhelper.cpp.

+ Here is the call graph for this function:

◆ addTimesTo()

virtual void addTimesTo ( std::list< Time > &  times) const
pure virtual

◆ impliedVolatility()

Volatility impliedVolatility ( Real  targetValue,
Real  accuracy,
Size  maxEvaluations,
Volatility  minVol,
Volatility  maxVol 
) const

Black volatility implied by the model.

Definition at line 40 of file calibrationhelper.cpp.

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

◆ blackPrice()

virtual Real blackPrice ( Volatility  volatility) const
pure virtual

Black or Bachelier price given a volatility.

Implemented in HestonModelHelper, CapHelper, and SwaptionHelper.

+ Here is the caller graph for this function:

◆ setPricingEngine()

void setPricingEngine ( const ext::shared_ptr< PricingEngine > &  engine)

Definition at line 93 of file calibrationhelper.hpp.

Member Data Documentation

◆ marketValue_

Real marketValue_
mutableprotected

Definition at line 98 of file calibrationhelper.hpp.

◆ volatility_

Handle<Quote> volatility_
protected

Definition at line 99 of file calibrationhelper.hpp.

◆ engine_

ext::shared_ptr<PricingEngine> engine_
protected

Definition at line 100 of file calibrationhelper.hpp.

◆ volatilityType_

const VolatilityType volatilityType_
protected

Definition at line 101 of file calibrationhelper.hpp.

◆ shift_

const Real shift_
protected

Definition at line 102 of file calibrationhelper.hpp.

◆ calibrationErrorType_

const CalibrationErrorType calibrationErrorType_
private

Definition at line 106 of file calibrationhelper.hpp.