QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Calibration of a local volatility surface to a sparse grid of options. More...
#include <andreasenhugevolatilityinterpl.hpp>
Classes | |
struct | SingleStepCalibrationResult |
Public Types | |
enum | InterpolationType { PiecewiseConstant , Linear , CubicSpline } |
enum | CalibrationType { Call = Option::Call , Put = Option::Put , CallPut } |
typedef std::vector< std::pair< ext::shared_ptr< VanillaOption >, ext::shared_ptr< Quote > > > | CalibrationSet |
Public Types inherited from Observer | |
typedef set_type::iterator | iterator |
Public Member Functions | |
AndreasenHugeVolatilityInterpl (const CalibrationSet &calibrationSet, Handle< Quote > spot, Handle< YieldTermStructure > rTS, Handle< YieldTermStructure > qTS, InterpolationType interpolationType=CubicSpline, CalibrationType calibrationType=Call, Size nGridPoints=500, Real minStrike=Null< Real >(), Real maxStrike=Null< Real >(), ext::shared_ptr< OptimizationMethod > optimizationMethod=ext::shared_ptr< OptimizationMethod >(new LevenbergMarquardt), const EndCriteria &endCriteria=EndCriteria(500, 100, 1e-12, 1e-10, 1e-10)) | |
Date | maxDate () const |
Real | minStrike () const |
Real | maxStrike () const |
Real | fwd (Time t) const |
const Handle< YieldTermStructure > & | riskFreeRate () const |
ext::tuple< Real, Real, Real > | calibrationError () const |
Real | optionPrice (Time t, Real strike, Option::Type optionType) const |
Volatility | localVol (Time t, Real strike) const |
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 &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (Observable &&)=delete |
virtual | ~Observable ()=default |
void | notifyObservers () |
Public Member Functions inherited from Observer | |
Observer ()=default | |
Observer (const Observer &) | |
Observer & | operator= (const Observer &) |
virtual | ~Observer () |
std::pair< iterator, bool > | registerWith (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 () |
Protected Member Functions | |
void | performCalculations () const override |
Protected Member Functions inherited from LazyObject | |
virtual void | calculate () const |
Private Types | |
typedef std::map< Time, ext::tuple< Real, ext::shared_ptr< Array >, ext::shared_ptr< Interpolation > > > | TimeValueCacheType |
Private Member Functions | |
ext::shared_ptr< AndreasenHugeCostFunction > | buildCostFunction (Size iExpiry, Option::Type optionType, const Array &previousNPVs) const |
Size | getExerciseTimeIdx (Time t) const |
Real | getCacheValue (Real strike, const TimeValueCacheType::const_iterator &f) const |
Array | getPriceSlice (Time t, Option::Type optionType) const |
Array | getLocalVolSlice (Time t, Option::Type optionType) const |
Private Attributes | |
CalibrationSet | calibrationSet_ |
const Handle< Quote > | spot_ |
const Handle< YieldTermStructure > | rTS_ |
const Handle< YieldTermStructure > | qTS_ |
const InterpolationType | interpolationType_ |
const CalibrationType | calibrationType_ |
const Size | nGridPoints_ |
const Real | minStrike_ |
const Real | maxStrike_ |
const ext::shared_ptr< OptimizationMethod > | optimizationMethod_ |
const EndCriteria | endCriteria_ |
std::vector< Real > | strikes_ |
std::vector< Date > | expiries_ |
std::vector< Time > | expiryTimes_ |
std::vector< Time > | dT_ |
std::vector< std::vector< Size > > | calibrationMatrix_ |
Real | avgError_ |
Real | minError_ |
Real | maxError_ |
ext::shared_ptr< FdmMesherComposite > | mesher_ |
Array | gridPoints_ |
Array | gridInFwd_ |
std::vector< SingleStepCalibrationResult > | calibrationResults_ |
TimeValueCacheType | localVolCache_ |
TimeValueCacheType | priceCache_ |
Additional Inherited Members | |
Protected Attributes inherited from LazyObject | |
bool | calculated_ = false |
bool | frozen_ = false |
bool | alwaysForward_ |
Calibration of a local volatility surface to a sparse grid of options.
References:
Andreasen J., Huge B., 2010. Volatility Interpolation https://ssrn.com/abstract=1694972
Definition at line 54 of file andreasenhugevolatilityinterpl.hpp.
typedef std::vector<std::pair< ext::shared_ptr<VanillaOption>, ext::shared_ptr<Quote> > > CalibrationSet |
Definition at line 63 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 103 of file andreasenhugevolatilityinterpl.hpp.
enum InterpolationType |
Enumerator | |
---|---|
PiecewiseConstant | |
Linear | |
CubicSpline |
Definition at line 57 of file andreasenhugevolatilityinterpl.hpp.
enum CalibrationType |
Enumerator | |
---|---|
Call | |
Put | |
CallPut |
Definition at line 58 of file andreasenhugevolatilityinterpl.hpp.
AndreasenHugeVolatilityInterpl | ( | const CalibrationSet & | calibrationSet, |
Handle< Quote > | spot, | ||
Handle< YieldTermStructure > | rTS, | ||
Handle< YieldTermStructure > | qTS, | ||
InterpolationType | interpolationType = CubicSpline , |
||
CalibrationType | calibrationType = Call , |
||
Size | nGridPoints = 500 , |
||
Real | minStrike = Null<Real>() , |
||
Real | maxStrike = Null<Real>() , |
||
ext::shared_ptr< OptimizationMethod > | optimizationMethod = ext::shared_ptr<OptimizationMethod>(new LevenbergMarquardt) , |
||
const EndCriteria & | endCriteria = EndCriteria(500, 100, 1e-12, 1e-10, 1e-10) |
||
) |
Definition at line 210 of file andreasenhugevolatilityinterpl.cpp.
Date maxDate | ( | ) | const |
Definition at line 447 of file andreasenhugevolatilityinterpl.cpp.
Real minStrike | ( | ) | const |
Definition at line 451 of file andreasenhugevolatilityinterpl.cpp.
Real maxStrike | ( | ) | const |
Definition at line 456 of file andreasenhugevolatilityinterpl.cpp.
Definition at line 461 of file andreasenhugevolatilityinterpl.cpp.
const Handle< YieldTermStructure > & riskFreeRate | ( | ) | const |
Definition at line 466 of file andreasenhugevolatilityinterpl.cpp.
Definition at line 471 of file andreasenhugevolatilityinterpl.cpp.
Real optionPrice | ( | Time | t, |
Real | strike, | ||
Option::Type | optionType | ||
) | const |
Definition at line 508 of file andreasenhugevolatilityinterpl.cpp.
Volatility localVol | ( | Time | t, |
Real | strike | ||
) | const |
Definition at line 591 of file andreasenhugevolatilityinterpl.cpp.
|
overrideprotectedvirtual |
This method must implement any calculations which must be (re)done in order to calculate the desired results.
Implements LazyObject.
Definition at line 342 of file andreasenhugevolatilityinterpl.cpp.
|
private |
Definition at line 287 of file andreasenhugevolatilityinterpl.cpp.
Definition at line 477 of file andreasenhugevolatilityinterpl.cpp.
Definition at line 484 of file andreasenhugevolatilityinterpl.cpp.
|
private |
Definition at line 496 of file andreasenhugevolatilityinterpl.cpp.
|
private |
Definition at line 558 of file andreasenhugevolatilityinterpl.cpp.
|
private |
Definition at line 123 of file andreasenhugevolatilityinterpl.hpp.
Definition at line 124 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 125 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 126 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 127 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 128 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 130 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 131 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 131 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 133 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 134 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 136 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 137 of file andreasenhugevolatilityinterpl.hpp.
|
mutableprivate |
Definition at line 138 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 138 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 140 of file andreasenhugevolatilityinterpl.hpp.
|
mutableprivate |
Definition at line 141 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 141 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 141 of file andreasenhugevolatilityinterpl.hpp.
|
mutableprivate |
Definition at line 143 of file andreasenhugevolatilityinterpl.hpp.
|
mutableprivate |
Definition at line 144 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 144 of file andreasenhugevolatilityinterpl.hpp.
|
mutableprivate |
Definition at line 146 of file andreasenhugevolatilityinterpl.hpp.
|
mutableprivate |
Definition at line 148 of file andreasenhugevolatilityinterpl.hpp.
|
private |
Definition at line 148 of file andreasenhugevolatilityinterpl.hpp.