24#ifndef quantlib_markovfunctional_hpp
25#define quantlib_markovfunctional_hpp
111 virtual ext::shared_ptr<CustomSmileSection>
136 Size gaussHermitePoints,
138 Real marketRateAccuracy,
142 std::vector<Real> smileMoneyCheckpoints = std::vector<Real>(),
143 ext::shared_ptr<CustomSmileFactory> customSmileFactory =
144 ext::shared_ptr<CustomSmileFactory>())
166 "Only one of KahaleSmile, SabrSmile and CustomSmile"
167 "can be specified at the same time");
170 <<
") for the state process "
171 "discretization must be "
174 "Multiple of standard deviations covered by state "
175 "process discretization ("
178 "Number of gauss hermite integration points ("
182 <<
") must be positive");
185 <<
") must be positive");
188 "If Kahale extrapolation is used, the lower rate bound ("
194 <<
") must be strictly less than upper rate bound ("
198 "missing CustomSmileFactoy");
275#define QL_MFMESSAGE(o, message) \
277 std::ostringstream os; \
279 o.messages_.push_back(os.str()); \
307 std::vector<Date> volstepdates,
308 std::vector<Real> volatilities,
310 const std::vector<Date>& swaptionExpiries,
311 const std::vector<Period>& swaptionTenors,
312 const ext::shared_ptr<SwapIndex>& swapIndexBase,
318 std::vector<Date> volstepdates,
319 std::vector<Real> volatilities,
321 const std::vector<Date>& capletExpiries,
322 ext::shared_ptr<IborIndex> iborIndex,
333 void calibrate(
const std::vector<ext::shared_ptr<CalibrationHelper> >& helpers,
337 const std::vector<Real>& weights = std::vector<Real>(),
338 const std::vector<bool>& fixParameters = std::vector<bool>())
override {
345 void calibrate(
const std::vector<ext::shared_ptr<BlackCalibrationHelper> >& helpers,
349 const std::vector<Real>& weights = std::vector<Real>(),
350 const std::vector<bool>& fixParameters = std::vector<bool>()) {
352 std::vector<ext::shared_ptr<CalibrationHelper> > tmp(helpers.size());
353 for (
Size i=0; i<helpers.size(); ++i)
354 tmp[i] = ext::static_pointer_cast<CalibrationHelper>(helpers[i]);
417 const CalibrationPoint& p,
420 Real shift = 0.0)
const;
422 const CalibrationPoint& p,
442 bool zeroFixingDays =
false,
443 ext::shared_ptr<IborIndex> iborIdx = ext::shared_ptr<IborIndex>())
const;
450 bool zeroFixingDays =
false,
451 ext::shared_ptr<SwapIndex> swapIdx = ext::shared_ptr<SwapIndex>())
const;
458 bool zeroFixingDays =
false,
459 ext::shared_ptr<SwapIndex> swapIdx = ext::shared_ptr<SwapIndex>())
const;
467 bool zeroFixingDays =
false,
468 ext::shared_ptr<IborIndex> iborIdx = ext::shared_ptr<IborIndex>())
const;
477 bool zeroFixingDays =
false,
478 const ext::shared_ptr<SwapIndex>& swapIdx = ext::shared_ptr<SwapIndex>())
const;
1-D array used in linear algebra.
EndCriteria::Type endCriteria() const
Returns end criteria result.
const ext::shared_ptr< Constraint > & constraint() const
virtual void calibrate(const std::vector< ext::shared_ptr< CalibrationHelper > > &, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >(), const std::vector< bool > &fixParameters=std::vector< bool >())
Calibrate to a set of market instruments (usually caps/swaptions)
Criteria to end optimization process:
void performCalculations() const override
Shared handle to an observable.
virtual void calculate() const
virtual ext::shared_ptr< CustomSmileSection > smileSection(const ext::shared_ptr< SmileSection > &source, Real atm) const =0
virtual ~CustomSmileFactory()=default
virtual Real inverseDigitalCall(Real price, Real discount=1.0) const =0
const CalibrationPoint & p_
ZeroHelper(const MarkovFunctional *model, const Date &expiry, const CalibrationPoint &p, const Real marketPrice)
const MarkovFunctional * model_
Real operator()(Real strike) const
std::vector< Date > volstepdates_
Real zerobondImpl(Time T, Time t, Real y, const Handle< YieldTermStructure > &yts) const override
void calibrate(const std::vector< ext::shared_ptr< BlackCalibrationHelper > > &helpers, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >(), const std::vector< bool > &fixParameters=std::vector< bool >())
void performCalculations() const override
std::vector< std::pair< Size, Size > > arbitrageIndices() const
Array zerobondArray(Time T, Time t, const Array &y) const
const ModelOutputs & modelOutputs() const
Handle< SwaptionVolatilityStructure > swaptionVol_
void forceArbitrageIndices(const std::vector< std::pair< Size, Size > > &indices)
ext::shared_ptr< SwapIndex > swapIndexBase_
Real swapRateInternal(const Date &fixing, const Period &tenor, const Date &referenceDate=Null< Date >(), Real y=0.0, bool zeroFixingDays=false, ext::shared_ptr< SwapIndex > swapIdx=ext::shared_ptr< SwapIndex >()) const
std::vector< std::pair< Size, Size > > forcedArbitrageIndices_
Real swapAnnuityInternal(const Date &fixing, const Period &tenor, const Date &referenceDate=Null< Date >(), Real y=0.0, bool zeroFixingDays=false, ext::shared_ptr< SwapIndex > swapIdx=ext::shared_ptr< SwapIndex >()) const
Handle< OptionletVolatilityStructure > capletVol_
Array deflatedZerobondArray(Time T, Time t, const Array &y) const
const bool capletCalibrated_
void updateNumeraireTabulation() const
void updateSmiles() const
void updateTimes1() const
std::map< Date, CalibrationPoint > calibrationPoints_
ext::shared_ptr< IborIndex > iborIndex_
ext::shared_ptr< Matrix > discreteNumeraire_
void generateArguments() override
Real marketDigitalPrice(const Date &expiry, const CalibrationPoint &p, const Option::Type &type, Real strike) const
const Array & volatility() const
ModelOutputs modelOutputs_
const Date & numeraireDate() const
Real swaptionPriceInternal(const Option::Type &type, const Date &expiry, const Period &tenor, Rate strike, const Date &referenceDate=Null< Date >(), Real y=0.0, bool zeroFixingDays=false, const ext::shared_ptr< SwapIndex > &swapIdx=ext::shared_ptr< SwapIndex >()) const
void updateTimes2() const
Real deflatedZerobond(Time T, Time t=0.0, Real y=0.0) const
void makeCapletCalibrationPoint(const Date &expiry)
std::vector< Period > swaptionTenors_
ModelSettings modelSettings_
std::vector< Date > swaptionExpiries_
std::vector< ext::shared_ptr< Interpolation > > numeraire_
std::vector< Date > capletExpiries_
std::vector< Real > volatilities_
std::vector< std::pair< Size, Size > > arbitrageIndices_
std::vector< bool > FixedFirstVolatility() const
std::vector< Real > times_
Array numeraireArray(Time t, const Array &y) const
void makeSwaptionCalibrationPoint(const Date &expiry, const Period &tenor)
const ModelSettings & modelSettings() const
Real marketSwapRate(const Date &expiry, const CalibrationPoint &p, Real digitalPrice, Real guess=0.03, Real shift=0.0) const
Real forwardRateInternal(const Date &fixing, const Date &referenceDate=Null< Date >(), Real y=0.0, bool zeroFixingDays=false, ext::shared_ptr< IborIndex > iborIdx=ext::shared_ptr< IborIndex >()) const
std::vector< Time > volsteptimes_
Real capletPriceInternal(const Option::Type &type, const Date &expiry, Rate strike, const Date &referenceDate=Null< Date >(), Real y=0.0, bool zeroFixingDays=false, ext::shared_ptr< IborIndex > iborIdx=ext::shared_ptr< IborIndex >()) const
Real numeraireImpl(Time t, Real y, const Handle< YieldTermStructure > &yts) const override
const Time & numeraireTime() const
void calibrate(const std::vector< ext::shared_ptr< CalibrationHelper > > &helpers, OptimizationMethod &method, const EndCriteria &endCriteria, const Constraint &constraint=Constraint(), const std::vector< Real > &weights=std::vector< Real >(), const std::vector< bool > &fixParameters=std::vector< bool >()) override
Calibrate to a set of market instruments (usually caps/swaptions)
template class providing a null value for a given type.
Abstract class for constrained optimization method.
Base class for model arguments.
const Array & params() const
interest rate volatility smile section
const Handle< YieldTermStructure > & termStructure() const
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
basic interface for one factor interest rate models
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
base class for 1-D interpolations
State process for markov functional model.
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)
optionlet (caplet/floorlet) volatility structure
Smile section base class.
ext::shared_ptr< SmileSection > smileSection_
ext::shared_ptr< SmileSection > rawSmileSection_
std::vector< Date > paymentDates_
std::vector< Real > yearFractions_
std::vector< Real > adjustmentFactors_
std::vector< Real > marketZerorate_
std::vector< Real > digitalsAdjustmentFactors_
std::vector< Period > tenors_
std::vector< Real > modelZerorate_
std::vector< std::string > messages_
std::vector< std::vector< Real > > modelPutPremium_
std::vector< std::vector< Real > > marketPutPremium_
std::vector< Date > expiries_
std::vector< Real > annuity_
std::vector< std::vector< Real > > smileStrikes_
std::vector< std::vector< Real > > modelCallPremium_
std::vector< std::vector< Real > > marketVega_
std::vector< std::vector< Real > > marketCallPremium_
std::vector< std::vector< Real > > marketRawCallPremium_
std::vector< std::vector< Real > > marketRawPutPremium_
ModelSettings & withMarketRateAccuracy(Real a)
ModelSettings & withCustomSmileFactory(const ext::shared_ptr< CustomSmileFactory > &f)
ModelSettings & withDigitalGap(Real d)
ModelSettings & withLowerRateBound(Real l)
std::vector< Real > smileMoneynessCheckpoints_
ModelSettings & withYGridPoints(Size n)
ModelSettings & withGaussHermitePoints(Size n)
ModelSettings(Size yGridPoints, Real yStdDevs, Size gaussHermitePoints, Real digitalGap, Real marketRateAccuracy, Real lowerRateBound, Real upperRateBound, int adjustments, std::vector< Real > smileMoneyCheckpoints=std::vector< Real >(), ext::shared_ptr< CustomSmileFactory > customSmileFactory=ext::shared_ptr< CustomSmileFactory >())
ext::shared_ptr< CustomSmileFactory > customSmileFactory_
ModelSettings & addAdjustment(int a)
ModelSettings & withSmileMoneynessCheckpoints(const std::vector< Real > &m)
@ SmileExponentialExtrapolation
@ SmileDeleteArbitragePoints
ModelSettings & withUpperRateBound(Real u)
ModelSettings & withAdjustments(int a)
ModelSettings & withYStdDevs(Real s)
ModelSettings & removeAdjustment(int a)
Swaption volatility structure.