Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
swaptionsabrcube.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2024 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file swaptionsabrcube.hpp
20 \brief SABR Swaption volatility cube
21 \ingroup termstructures
22*/
23
24#ifndef quantext_swaption_sabrcube_h
25#define quantext_swaption_sabrcube_h
26
29
30#include <ql/termstructures/volatility/swaption/swaptionvolcube.hpp>
31
32namespace QuantExt {
33using namespace QuantLib;
34
36public:
38 const Handle<SwaptionVolatilityStructure>& atmVolStructure, const std::vector<Period>& optionTenors,
39 const std::vector<Period>& swapTenors, const std::vector<Period>& atmOptionTenors,
40 const std::vector<Period>& atmSwapLengths, const std::vector<Spread>& strikeSpreads,
41 const std::vector<std::vector<Handle<Quote>>>& volSpreads,
42 const QuantLib::ext::shared_ptr<SwapIndex>& swapIndexBase,
43 const QuantLib::ext::shared_ptr<SwapIndex>& shortSwapIndexBase,
45 const boost::optional<QuantLib::VolatilityType> outputVolatilityType = boost::none,
46 const std::map<std::pair<Period, Period>, std::vector<std::pair<Real, bool>>>& initialModelParameters = {},
47 const QuantLib::Size maxCalibrationAttempts = 10, const QuantLib::Real exitEarlyErrorThreshold = 0.005,
48 const QuantLib::Real maxAcceptableError = 0.05);
49 void performCalculations() const override;
50 QuantLib::ext::shared_ptr<SmileSection> smileSectionImpl(Time optionTime, Time swapLength) const override;
51
52 QuantLib::ext::shared_ptr<ParametricVolatility> parametricVolatility() const { return parametricVolatility_; }
53
54private:
55 mutable std::map<std::pair<Real, Real>, QuantLib::ext::shared_ptr<ParametricVolatilitySmileSection>> cache_;
56 mutable QuantLib::ext::shared_ptr<ParametricVolatility> parametricVolatility_;
57 std::vector<Period> atmOptionTenors_, atmSwapTenors_;
59 boost::optional<QuantLib::VolatilityType> outputVolatilityType_;
60 std::map<std::pair<QuantLib::Period, QuantLib::Period>, std::vector<std::pair<Real, bool>>> initialModelParameters_;
63 QuantLib::Real maxAcceptableError_;
64};
65
66} // namespace QuantExt
67
68#endif
void performCalculations() const override
std::map< std::pair< QuantLib::Period, QuantLib::Period >, std::vector< std::pair< Real, bool > > > initialModelParameters_
boost::optional< QuantLib::VolatilityType > outputVolatilityType_
QuantLib::Real exitEarlyErrorThreshold_
QuantExt::SabrParametricVolatility::ModelVariant modelVariant_
std::map< std::pair< Real, Real >, QuantLib::ext::shared_ptr< ParametricVolatilitySmileSection > > cache_
std::vector< Period > atmSwapTenors_
QuantLib::ext::shared_ptr< ParametricVolatility > parametricVolatility_
QuantLib::ext::shared_ptr< SmileSection > smileSectionImpl(Time optionTime, Time swapLength) const override
QuantLib::Size maxCalibrationAttempts_
QuantLib::ext::shared_ptr< ParametricVolatility > parametricVolatility() const
std::vector< Period > atmOptionTenors_
sabr volatility structure