Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedyoyvolsurface.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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 spreadedoptionletvolatility2.hpp
20 \brief Optionlet volatility with overlayed bilinearly interpolated spread surface
21 \ingroup termstructures
22*/
23
24#pragma once
25
26#include <ql/math/interpolations/interpolation2d.hpp>
27#include <ql/patterns/lazyobject.hpp>
28#include <ql/quote.hpp>
29#include <ql/termstructures/volatility/inflation/yoyinflationoptionletvolatilitystructure.hpp>
30
31#include <boost/smart_ptr/shared_ptr.hpp>
32
33namespace QuantExt {
34using namespace QuantLib;
35
36class SpreadedYoYVolatilitySurface : public QuantExt::YoYOptionletVolatilitySurface, public LazyObject {
37public:
38 // warning we assume that volatilities are retrieved with obLag = -1D, i.e. using the standard lag from the ts
39 SpreadedYoYVolatilitySurface(const Handle<YoYOptionletVolatilitySurface>& baseVol,
40 const std::vector<Date>& optionDates, const std::vector<Real>& strikes,
41 const std::vector<std::vector<Handle<Quote>>>& volSpreads);
42 Rate minStrike() const override;
43 Rate maxStrike() const override;
44 Date maxDate() const override;
45 Time maxTime() const override;
46 const Date& referenceDate() const override;
47 void update() override;
48 void deepUpdate() override;
49
50protected:
51 Volatility volatilityImpl(Time length, Rate strike) const override;
52 void performCalculations() const override;
53
54private:
55 Handle<YoYOptionletVolatilitySurface> baseVol_;
56 std::vector<Date> optionDates_;
57 std::vector<Real> strikes_;
58 std::vector<std::vector<Handle<Quote>>> volSpreads_;
59 //
60 mutable std::vector<Real> optionTimes_;
61 mutable Matrix volSpreadValues_;
62 mutable Interpolation2D volSpreadInterpolation_;
63};
64
65} // namespace QuantExt
Handle< YoYOptionletVolatilitySurface > baseVol_
const Date & referenceDate() const override
Volatility volatilityImpl(Time length, Rate strike) const override
std::vector< std::vector< Handle< Quote > > > volSpreads_
vector< Real > strikes