26#include <ql/methods/finitedifferences/meshers/fdm1dmesher.hpp>
27#include <ql/patterns/lazyobject.hpp>
28#include <ql/quote.hpp>
29#include <ql/termstructures/defaulttermstructure.hpp>
30#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
31#include <ql/termstructures/yieldtermstructure.hpp>
32#include <ql/types.hpp>
34#include <boost/enable_shared_from_this.hpp>
38using QuantLib::Handle;
41class DefaultableEquityJumpDiffusionModel;
48 const std::vector<Real>& stepTimes,
const QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>& equity,
49 const Handle<QuantLib::BlackVolTermStructure>& volatility,
50 const Handle<QuantLib::DefaultProbabilityTermStructure>& creditCurve,
const Real p = 0.0,
const Real eta = 1.0,
51 const bool staticMesher =
false,
const Size timeStepsPerYear = 24,
const Size stateGridPoints = 100,
52 const Real mesherEpsilon = 1E-4,
const Real mesherScaling = 1.5,
const Real mesherConcentration = Null<Real>(),
54 const bool calibrate =
true,
const bool adjustEquityVolatility =
true,
const bool adjustEquityForward =
true);
56 Handle<DefaultableEquityJumpDiffusionModel>
model()
const;
70 QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>
equity_;
92 mutable RelinkableHandle<DefaultableEquityJumpDiffusionModel>
model_;
96 public QuantLib::Observer,
121 const std::vector<Real>&
sigma,
122 const QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>&
equity,
123 const Handle<QuantLib::DefaultProbabilityTermStructure>&
creditCurve,
128 const std::vector<Real>&
stepTimes()
const;
129 QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>
equity()
const;
132 Handle<QuantLib::DefaultProbabilityTermStructure>
creditCurve()
const;
140 const std::vector<Real>&
h0()
const;
141 const std::vector<Real>&
sigma()
const;
144 Real
h(
const Real t,
const Real S)
const;
145 Real
h0(
const Real t)
const;
146 Real
r(
const Real t)
const;
147 Real
q(
const Real t)
const;
148 Real
sigma(
const Real t)
const;
154 void bootstrap(
const Handle<QuantLib::BlackVolTermStructure>& volatility,
const bool staticMesher,
155 const Size timeStepsPerYear,
const Size stateGridPoints = 100,
const Real mesherEpsilon = 1E-4,
156 const Real mesherScaling = 1.5,
const Real mesherConcentration = Null<Real>(),
159 const bool enforceFokkerPlanckBootstrap =
false,
const bool adjustEquityVolatility =
true)
const;
170 QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>
equity_;
177 mutable QuantLib::ext::shared_ptr<Fdm1dMesher>
mesher_;
183 static constexpr Real
fh_ = 1E-4;
std::vector< Real > stepTimes_
void forceRecalculate() override
force recalibration of model
void performCalculations() const override
Handle< BlackVolTermStructure > volatility_
bool adjustEquityForward_
Handle< DefaultProbabilityTermStructure > creditCurve_
std::vector< Real > cachedForwards_
std::vector< Real > cachedVariances_
bool requiresRecalibration() const override
if false is returned, the model does not require a recalibration
Real mesherConcentration_
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > equity_
bool enforceFokkerPlanckBootstrap_
bool calibrationPointsChanged(const bool updateCache) const
Handle< DefaultableEquityJumpDiffusionModel > model() const
QuantLib::ext::shared_ptr< MarketObserver > marketObserver_
bool adjustEquityVolatility_
BootstrapMode bootstrapMode_
RelinkableHandle< DefaultableEquityJumpDiffusionModel > model_
std::vector< Real > stepTimes_
bool adjustEquityForward() const
Real q(const Real t) const
const std::vector< Real > & h0() const
bool adjustEquityForward_
Real h0(const Real t) const
Handle< DefaultProbabilityTermStructure > creditCurve_
const std::vector< Real > & sigma() const
Handle< QuantLib::DefaultProbabilityTermStructure > creditCurve() const
Real r(const Real t) const
const std::vector< Real > & stepTimes() const
DayCounter volDayCounter_
void bootstrap(const Handle< QuantLib::BlackVolTermStructure > &volatility, const bool staticMesher, const Size timeStepsPerYear, const Size stateGridPoints=100, const Real mesherEpsilon=1E-4, const Real mesherScaling=1.5, const Real mesherConcentration=Null< Real >(), const DefaultableEquityJumpDiffusionModelBuilder::BootstrapMode bootstrapMode=DefaultableEquityJumpDiffusionModelBuilder::BootstrapMode::Alternating, const bool enforceFokkerPlanckBootstrap=false, const bool adjustEquityVolatility=true) const
Real timeFromReference(const Date &d) const
std::vector< Real > sigma_
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > equity_
QuantLib::ext::shared_ptr< Fdm1dMesher > mesher_
QuantLib::Size getTimeIndex(const Real t) const
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > equity() const
const DayCounter & volDayCounter() const
Real h(const Real t, const Real S) const
static constexpr Real fh_
Real dividendYield(const Real s, const Real t) const
Real totalBlackVariance() const
equity index class for holding equity fixing histories and forwarding.
helper class for model builders that observes market ts
Model builder base class.