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

calibration helper for ATM cap More...

#include <caphelper.hpp>

+ Inheritance diagram for CapHelper:
+ Collaboration diagram for CapHelper:

Public Member Functions

 CapHelper (const Period &length, const Handle< Quote > &volatility, ext::shared_ptr< IborIndex > index, Frequency fixedLegFrequency, DayCounter fixedLegDayCounter, bool includeFirstSwaplet, Handle< YieldTermStructure > termStructure, BlackCalibrationHelper::CalibrationErrorType errorType=BlackCalibrationHelper::RelativePriceError, VolatilityType type=ShiftedLognormal, Real shift=0.0)
 
void addTimesTo (std::list< Time > &times) const override
 
Real modelValue () const override
 returns the price of the instrument according to the model More...
 
Real blackPrice (Volatility volatility) const override
 Black or Bachelier price given a volatility. More...
 
- 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 Member Functions

void performCalculations () const override
 

Private Attributes

ext::shared_ptr< Capcap_
 
const Period length_
 
const ext::shared_ptr< IborIndexindex_
 
const Handle< YieldTermStructuretermStructure_
 
const Frequency fixedLegFrequency_
 
const DayCounter fixedLegDayCounter_
 
const bool includeFirstSwaplet_
 

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 ATM cap

Definition at line 35 of file caphelper.hpp.

Constructor & Destructor Documentation

◆ CapHelper()

CapHelper ( const Period length,
const Handle< Quote > &  volatility,
ext::shared_ptr< IborIndex index,
Frequency  fixedLegFrequency,
DayCounter  fixedLegDayCounter,
bool  includeFirstSwaplet,
Handle< YieldTermStructure termStructure,
BlackCalibrationHelper::CalibrationErrorType  errorType = BlackCalibrationHelper::RelativePriceError,
VolatilityType  type = ShiftedLognormal,
Real  shift = 0.0 
)

Definition at line 33 of file caphelper.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ addTimesTo()

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

Implements BlackCalibrationHelper.

Definition at line 51 of file caphelper.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 63 of file caphelper.cpp.

+ Here is the call graph for this function:

◆ blackPrice()

Real blackPrice ( Volatility  volatility) const
overridevirtual

Black or Bachelier price given a volatility.

Implements BlackCalibrationHelper.

Definition at line 69 of file caphelper.cpp.

+ Here is the call graph for this function:

◆ performCalculations()

void performCalculations ( ) const
overrideprivatevirtual

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

Reimplemented from BlackCalibrationHelper.

Definition at line 91 of file caphelper.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ cap_

ext::shared_ptr<Cap> cap_
mutableprivate

Definition at line 55 of file caphelper.hpp.

◆ length_

const Period length_
private

Definition at line 56 of file caphelper.hpp.

◆ index_

const ext::shared_ptr<IborIndex> index_
private

Definition at line 57 of file caphelper.hpp.

◆ termStructure_

const Handle<YieldTermStructure> termStructure_
private

Definition at line 58 of file caphelper.hpp.

◆ fixedLegFrequency_

const Frequency fixedLegFrequency_
private

Definition at line 59 of file caphelper.hpp.

◆ fixedLegDayCounter_

const DayCounter fixedLegDayCounter_
private

Definition at line 60 of file caphelper.hpp.

◆ includeFirstSwaplet_

const bool includeFirstSwaplet_
private

Definition at line 61 of file caphelper.hpp.