#include <qle/termstructures/sabrparametricvolatility.hpp>
Public Types | |
enum class | ModelVariant { Hagan2002Lognormal = 0 , Hagan2002Normal = 1 , Hagan2002NormalZeroBeta = 2 , Antonov2015FreeBoundaryNormal = 3 , KienitzLawsonSwaynePde = 4 , FlochKennedy = 5 } |
Public Types inherited from ParametricVolatility | |
enum class | MarketModelType { Black76 } |
enum class | MarketQuoteType { Price , NormalVolatility , ShiftedLognormalVolatility } |
Public Member Functions | |
SabrParametricVolatility (const ModelVariant modelVariant, const std::vector< MarketSmile > marketSmiles, const MarketModelType marketModelType, const MarketQuoteType inputMarketQuoteType, const QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve, const std::map< std::pair< QuantLib::Real, QuantLib::Real >, std::vector< std::pair< Real, bool > > > modelParameters={}, const QuantLib::Size maxCalibrationAttempts=10, const QuantLib::Real exitEarlyErrorThreshold=0.005, const QuantLib::Real maxAcceptableError=0.05) | |
QuantLib::Real | evaluate (const QuantLib::Real timeToExpiry, const QuantLib::Real underlyingLength, const QuantLib::Real strike, const QuantLib::Real forward, const MarketQuoteType outputMarketQuoteType, const QuantLib::Real outputLognormalShift=QuantLib::Null< QuantLib::Real >(), const boost::optional< QuantLib::Option::Type > outputOptionType=boost::none) const override |
const std::vector< Real > & | timeToEpiries () const |
const std::vector< Real > & | underlyingLenghts () const |
const QuantLib::Matrix & | alpha () const |
const QuantLib::Matrix & | beta () const |
const QuantLib::Matrix & | nu () const |
const QuantLib::Matrix & | rho () const |
const QuantLib::Matrix & | lognormalShift () const |
const QuantLib::Matrix & | numberOfCalibrationAttempts () const |
const QuantLib::Matrix & | calibrationError () const |
const QuantLib::Matrix & | isInterpolated () const |
Public Member Functions inherited from ParametricVolatility | |
virtual | ~ParametricVolatility () |
ParametricVolatility (const std::vector< MarketSmile > marketSmiles, const MarketModelType marketModelType, const MarketQuoteType inputMarketQuoteType, const QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve) | |
Real | convert (const Real inputQuote, const MarketQuoteType inputMarketQuoteType, const QuantLib::Real inputLognormalShift, const boost::optional< QuantLib::Option::Type > inputOptionType, const QuantLib::Real timeToExpiry, const QuantLib::Real strike, const QuantLib::Real forward, const MarketQuoteType outputMarketQuoteType, const QuantLib::Real outputLognormalShift, const boost::optional< QuantLib::Option::Type > outputOptionType=boost::none) const |
virtual QuantLib::Real | evaluate (const QuantLib::Real timeToExpiry, const QuantLib::Real underlyingLength, const QuantLib::Real strike, const QuantLib::Real forward, const MarketQuoteType outputMarketQuoteType, const QuantLib::Real outputLognormalShift=QuantLib::Null< QuantLib::Real >(), const boost::optional< QuantLib::Option::Type > outputOptionType=boost::none) const =0 |
Private Member Functions | |
void | calculate () |
std::vector< std::pair< Real, bool > > | defaultModelParameters () const |
std::vector< Real > | getGuess (const std::vector< std::pair< Real, bool > > ¶ms, const std::vector< Real > &randomSeq, const Real forward, const Real lognormalShift) const |
ParametricVolatility::MarketQuoteType | preferredOutputQuoteType () const |
std::vector< Real > | direct (const std::vector< Real > &x, const Real forward, const Real lognormalShift) const |
std::vector< Real > | inverse (const std::vector< Real > &y, const Real forward, const Real lognormalShift) const |
std::vector< Real > | evaluateSabr (const std::vector< Real > ¶ms, const Real forward, const Real timeToExpiry, const Real lognormalShift, const std::vector< Real > &strikes) const |
std::tuple< std::vector< Real >, Real, QuantLib::Size > | calibrateModelParameters (const MarketSmile &marketSmile, const std::vector< std::pair< Real, bool > > ¶ms) const |
Private Attributes | |
ModelVariant | modelVariant_ |
std::map< std::pair< QuantLib::Real, QuantLib::Real >, std::vector< std::pair< Real, bool > > > | modelParameters_ |
QuantLib::Size | maxCalibrationAttempts_ |
QuantLib::Real | exitEarlyErrorThreshold_ |
QuantLib::Real | maxAcceptableError_ |
std::map< std::pair< Real, Real >, std::vector< Real > > | calibratedSabrParams_ |
std::map< std::pair< Real, Real >, Real > | lognormalShifts_ |
std::map< std::pair< Real, Real >, Real > | calibrationErrors_ |
std::map< std::pair< Real, Real >, QuantLib::Size > | noOfAttempts_ |
std::vector< Real > | underlyingLengths_ |
std::vector< Real > | timeToExpiries_ |
std::vector< Real > | underlyingLengthsForInterpolation_ |
std::vector< Real > | timeToExpiriesForInterpolation_ |
QuantLib::Matrix | alpha_ |
QuantLib::Matrix | beta_ |
QuantLib::Matrix | nu_ |
QuantLib::Matrix | rho_ |
QuantLib::Matrix | lognormalShift_ |
QuantLib::Matrix | calibrationError_ |
QuantLib::Matrix | isInterpolated_ |
QuantLib::Matrix | numberOfCalibrationAttempts_ |
QuantLib::Interpolation2D | alphaInterpolation_ |
QuantLib::Interpolation2D | betaInterpolation_ |
QuantLib::Interpolation2D | nuInterpolation_ |
QuantLib::Interpolation2D | rhoInterpolation_ |
QuantLib::Interpolation2D | lognormalShiftInterpolation_ |
Static Private Attributes | |
static constexpr double | eps1 = .0000001 |
static constexpr double | eps2 = .9999 |
static constexpr double | max_nvol_equiv = 0.02 |
static constexpr double | max_nu = 2.0 |
Additional Inherited Members | |
Protected Attributes inherited from ParametricVolatility | |
std::vector< MarketSmile > | marketSmiles_ |
MarketModelType | marketModelType_ |
MarketQuoteType | inputMarketQuoteType_ |
QuantLib::Handle< QuantLib::YieldTermStructure > | discountCurve_ |
Definition at line 31 of file sabrparametricvolatility.hpp.
|
strong |
Enumerator | |
---|---|
Hagan2002Lognormal | |
Hagan2002Normal | |
Hagan2002NormalZeroBeta | |
Antonov2015FreeBoundaryNormal | |
KienitzLawsonSwaynePde | |
FlochKennedy |
Definition at line 33 of file sabrparametricvolatility.hpp.
SabrParametricVolatility | ( | const ModelVariant | modelVariant, |
const std::vector< MarketSmile > | marketSmiles, | ||
const MarketModelType | marketModelType, | ||
const MarketQuoteType | inputMarketQuoteType, | ||
const QuantLib::Handle< QuantLib::YieldTermStructure > | discountCurve, | ||
const std::map< std::pair< QuantLib::Real, QuantLib::Real >, std::vector< std::pair< Real, bool > > > | modelParameters = {} , |
||
const QuantLib::Size | maxCalibrationAttempts = 10 , |
||
const QuantLib::Real | exitEarlyErrorThreshold = 0.005 , |
||
const QuantLib::Real | maxAcceptableError = 0.05 |
||
) |
modelParameters are given by (tte, underlyingLen) as a vector of parameter values and whether the values are fixed
Definition at line 36 of file sabrparametricvolatility.cpp.
|
overridevirtual |
Implements ParametricVolatility.
Definition at line 602 of file sabrparametricvolatility.cpp.
const std::vector< Real > & timeToEpiries | ( | ) | const |
const std::vector< Real > & underlyingLenghts | ( | ) | const |
const QuantLib::Matrix & alpha | ( | ) | const |
Definition at line 63 of file sabrparametricvolatility.hpp.
const QuantLib::Matrix & beta | ( | ) | const |
Definition at line 64 of file sabrparametricvolatility.hpp.
const QuantLib::Matrix & nu | ( | ) | const |
Definition at line 65 of file sabrparametricvolatility.hpp.
const QuantLib::Matrix & rho | ( | ) | const |
Definition at line 66 of file sabrparametricvolatility.hpp.
const QuantLib::Matrix & lognormalShift | ( | ) | const |
Definition at line 67 of file sabrparametricvolatility.hpp.
const QuantLib::Matrix & numberOfCalibrationAttempts | ( | ) | const |
Definition at line 68 of file sabrparametricvolatility.hpp.
const QuantLib::Matrix & calibrationError | ( | ) | const |
Definition at line 70 of file sabrparametricvolatility.hpp.
const QuantLib::Matrix & isInterpolated | ( | ) | const |
Definition at line 72 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 426 of file sabrparametricvolatility.cpp.
|
private |
Definition at line 103 of file sabrparametricvolatility.cpp.
|
private |
Definition at line 68 of file sabrparametricvolatility.cpp.
|
private |
Definition at line 48 of file sabrparametricvolatility.cpp.
|
private |
Definition at line 123 of file sabrparametricvolatility.cpp.
|
private |
Definition at line 134 of file sabrparametricvolatility.cpp.
|
private |
Definition at line 145 of file sabrparametricvolatility.cpp.
|
private |
Definition at line 253 of file sabrparametricvolatility.cpp.
|
staticconstexprprivate |
Definition at line 75 of file sabrparametricvolatility.hpp.
|
staticconstexprprivate |
Definition at line 76 of file sabrparametricvolatility.hpp.
|
staticconstexprprivate |
Definition at line 77 of file sabrparametricvolatility.hpp.
|
staticconstexprprivate |
Definition at line 78 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 93 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 94 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 95 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 96 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 97 of file sabrparametricvolatility.hpp.
|
mutableprivate |
Definition at line 99 of file sabrparametricvolatility.hpp.
|
mutableprivate |
Definition at line 100 of file sabrparametricvolatility.hpp.
|
mutableprivate |
Definition at line 101 of file sabrparametricvolatility.hpp.
|
mutableprivate |
Definition at line 102 of file sabrparametricvolatility.hpp.
|
mutableprivate |
Definition at line 104 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 104 of file sabrparametricvolatility.hpp.
|
mutableprivate |
Definition at line 105 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 105 of file sabrparametricvolatility.hpp.
|
mutableprivate |
Definition at line 106 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 106 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 106 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 106 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 106 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 106 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 106 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 107 of file sabrparametricvolatility.hpp.
|
mutableprivate |
Definition at line 108 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 108 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 108 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 108 of file sabrparametricvolatility.hpp.
|
private |
Definition at line 109 of file sabrparametricvolatility.hpp.