27#include <ql/math/interpolations/interpolation2d.hpp>
45 const ModelVariant modelVariant,
const std::vector<MarketSmile> marketSmiles,
47 const QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve,
48 const std::map<std::pair<QuantLib::Real, QuantLib::Real>, std::vector<std::pair<Real, bool>>> modelParameters =
50 const QuantLib::Size maxCalibrationAttempts = 10,
const QuantLib::Real exitEarlyErrorThreshold = 0.005,
51 const QuantLib::Real maxAcceptableError = 0.05);
54 evaluate(
const QuantLib::Real timeToExpiry,
const QuantLib::Real underlyingLength,
const QuantLib::Real strike,
55 const QuantLib::Real forward,
const MarketQuoteType outputMarketQuoteType,
56 const QuantLib::Real outputLognormalShift = QuantLib::Null<QuantLib::Real>(),
57 const boost::optional<QuantLib::Option::Type> outputOptionType = boost::none)
const override;
64 const QuantLib::Matrix&
beta()
const {
return beta_; }
65 const QuantLib::Matrix&
nu()
const {
return nu_; }
66 const QuantLib::Matrix&
rho()
const {
return rho_; }
75 static constexpr double eps1 = .0000001;
76 static constexpr double eps2 = .9999;
78 static constexpr double max_nu = 2.0;
83 std::vector<Real>
getGuess(
const std::vector<std::pair<Real, bool>>& params,
const std::vector<Real>& randomSeq,
86 std::vector<Real>
direct(
const std::vector<Real>& x,
const Real forward,
const Real
lognormalShift)
const;
87 std::vector<Real>
inverse(
const std::vector<Real>& y,
const Real forward,
const Real
lognormalShift)
const;
88 std::vector<Real>
evaluateSabr(
const std::vector<Real>& params,
const Real forward,
const Real timeToExpiry,
90 std::tuple<std::vector<Real>, Real, QuantLib::Size>
94 std::map<std::pair<QuantLib::Real, QuantLib::Real>, std::vector<std::pair<Real, bool>>>
modelParameters_;
static constexpr double eps1
const std::vector< Real > & timeToEpiries() const
QuantLib::Interpolation2D alphaInterpolation_
std::vector< Real > underlyingLengths_
const QuantLib::Matrix & calibrationError() const
static constexpr double eps2
const QuantLib::Matrix & rho() const
QuantLib::Matrix numberOfCalibrationAttempts_
QuantLib::Matrix calibrationError_
std::vector< Real > timeToExpiriesForInterpolation_
QuantLib::Interpolation2D lognormalShiftInterpolation_
static constexpr double max_nvol_equiv
std::vector< std::pair< Real, bool > > defaultModelParameters() const
const QuantLib::Matrix & alpha() const
static constexpr double max_nu
QuantLib::Interpolation2D nuInterpolation_
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::map< std::pair< Real, Real >, Real > calibrationErrors_
QuantLib::Matrix lognormalShift_
std::vector< Real > underlyingLengthsForInterpolation_
QuantLib::Real exitEarlyErrorThreshold_
const QuantLib::Matrix & beta() const
const QuantLib::Matrix & lognormalShift() const
ModelVariant modelVariant_
QuantLib::Real maxAcceptableError_
std::vector< Real > inverse(const std::vector< Real > &y, const Real forward, const Real lognormalShift) const
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
std::map< std::pair< Real, Real >, QuantLib::Size > noOfAttempts_
QuantLib::Matrix isInterpolated_
const std::vector< Real > & underlyingLenghts() const
const QuantLib::Matrix & numberOfCalibrationAttempts() const
std::map< std::pair< Real, Real >, std::vector< Real > > calibratedSabrParams_
std::vector< Real > getGuess(const std::vector< std::pair< Real, bool > > ¶ms, const std::vector< Real > &randomSeq, const Real forward, const Real lognormalShift) const
@ Antonov2015FreeBoundaryNormal
@ Hagan2002NormalZeroBeta
const QuantLib::Matrix & isInterpolated() const
QuantLib::Interpolation2D rhoInterpolation_
std::map< std::pair< QuantLib::Real, QuantLib::Real >, std::vector< std::pair< Real, bool > > > modelParameters_
const QuantLib::Matrix & nu() const
std::tuple< std::vector< Real >, Real, QuantLib::Size > calibrateModelParameters(const MarketSmile &marketSmile, const std::vector< std::pair< Real, bool > > ¶ms) const
QuantLib::Size maxCalibrationAttempts_
QuantLib::Interpolation2D betaInterpolation_
std::vector< Real > timeToExpiries_
std::map< std::pair< Real, Real >, Real > lognormalShifts_
std::vector< Real > direct(const std::vector< Real > &x, const Real forward, const Real lognormalShift) const
ParametricVolatility::MarketQuoteType preferredOutputQuoteType() const
cross-asset, generic volatility structure