Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
swaptionvolcube2.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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/*
20 Copyright (C) 2006 Ferdinando Ametrano
21
22 This file is part of QuantLib, a free-software/open-source library
23 for financial quantitative analysts and developers - http://quantlib.org/
24
25 QuantLib is free software: you can redistribute it and/or modify it
26 under the terms of the QuantLib license. You should have received a
27 copy of the license along with this program; if not, please email
28 <quantlib-dev@lists.sf.net>. The license is also available online at
29 <http://quantlib.org/license.shtml>.
30
31 This program is distributed in the hope that it will be useful, but WITHOUT
32 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
33 FOR A PARTICULAR PURPOSE. See the license for more details.
34*/
35
36/*! \file swaptionvolcube2.hpp, with flat extrapolation in strike direction
37 \brief Swaption volatility cube, fit-later-interpolate-early approach
38 \ingroup termstructures
39*/
40
41#ifndef quantext_swaption_volcube_fit_later_interpolate_early_h
42#define quantext_swaption_volcube_fit_later_interpolate_early_h
43
44#include <ql/math/interpolations/interpolation2d.hpp>
45#include <ql/termstructures/volatility/swaption/swaptionvolcube.hpp>
46
47namespace QuantExt {
48using namespace QuantLib;
49
51public:
52 /*! The swaption vol cube is made up of ordered swaption vol surface
53 layers, each layer referring to a swap index of a given length
54 (in years), all indexes belonging to the same family. In order
55 to identify the family (and its market conventions) an index of
56 whatever length from that family must be passed in as
57 swapIndexBase.
58
59 Often for short swap length the swap index family is different,
60 e.g. the EUR case: swap vs 6M Euribor is used for length>1Y,
61 while swap vs 3M Euribor is used for the 1Y length. The
62 shortSwapIndexBase is used to identify this second family.
63
64 If flatExtrapolation is true the implied volatility is
65 extrapolated flat in strike direction.
66 */
67 /*! in case volsAreSpreads is false the given volSpreads are interpreted as absolute vols,
68 in this case the volSpreads inspectors also return absolute vols */
69 SwaptionVolCube2(const Handle<SwaptionVolatilityStructure>& atmVolStructure,
70 const std::vector<Period>& optionTenors, const std::vector<Period>& swapTenors,
71 const std::vector<Spread>& strikeSpreads,
72 const std::vector<std::vector<Handle<Quote> > >& volSpreads,
73 const QuantLib::ext::shared_ptr<SwapIndex>& swapIndexBase,
74 const QuantLib::ext::shared_ptr<SwapIndex>& shortSwapIndexBase, bool vegaWeightedSmileFit,
75 bool flatExtrapolation, bool volsAreSpreads = true);
76 //! \name LazyObject interface
77 //@{
78 void performCalculations() const override;
79 //@}
80 //! \name SwaptionVolatilityCube inspectors
81 //@{
82 const Matrix& volSpreads(Size i) const { return volSpreadsMatrix_[i]; }
83 QuantLib::ext::shared_ptr<SmileSection> smileSectionImpl(const Date& optionDate, const Period& swapTenor) const override;
84 QuantLib::ext::shared_ptr<SmileSection> smileSectionImpl(Time optionTime, Time swapLength) const override;
85 //@}
86private:
88 mutable std::vector<Interpolation2D> volSpreadsInterpolator_;
89 mutable std::vector<Matrix> volSpreadsMatrix_;
90};
91
92} // namespace QuantExt
93
94#endif
void performCalculations() const override
QuantLib::ext::shared_ptr< SmileSection > smileSectionImpl(const Date &optionDate, const Period &swapTenor) const override
std::vector< Matrix > volSpreadsMatrix_
const Matrix & volSpreads(Size i) const
std::vector< Interpolation2D > volSpreadsInterpolator_