Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedoptionletvolatility2.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/quote.hpp>
28#include <ql/termstructures/volatility/optionlet/optionletvolatilitystructure.hpp>
29
30#include <boost/smart_ptr/shared_ptr.hpp>
31
32namespace QuantExt {
33using namespace QuantLib;
34
35class SpreadedOptionletVolatility2 : public OptionletVolatilityStructure, public LazyObject {
36public:
37 SpreadedOptionletVolatility2(const Handle<OptionletVolatilityStructure>& baseVol,
38 const std::vector<Date>& optionDates, const std::vector<Real>& strikes,
39 const std::vector<std::vector<Handle<Quote>>>& volSpreads);
40 BusinessDayConvention businessDayConvention() const override;
41 Rate minStrike() const override;
42 Rate maxStrike() const override;
43 DayCounter dayCounter() const override;
44 Date maxDate() const override;
45 Time maxTime() const override;
46 const Date& referenceDate() const override;
47 Calendar calendar() const override;
48 Natural settlementDays() const override;
49 VolatilityType volatilityType() const override;
50 Real displacement() const override;
51 void update() override;
52 void deepUpdate() override;
53
54protected:
55 QuantLib::ext::shared_ptr<SmileSection> smileSectionImpl(Time optionTime) const override;
56 Volatility volatilityImpl(Time optionTime, Rate strike) const override;
57 void performCalculations() const override;
58
59private:
60 Handle<OptionletVolatilityStructure> baseVol_;
61 std::vector<Date> optionDates_;
62 std::vector<Real> strikes_;
63 std::vector<std::vector<Handle<Quote>>> volSpreads_;
64 //
65 mutable std::vector<Real> optionTimes_;
66 mutable Matrix volSpreadValues_;
67 mutable Interpolation2D volSpreadInterpolation_;
68};
69} // namespace QuantExt
Volatility volatilityImpl(Time optionTime, Rate strike) const override
Handle< OptionletVolatilityStructure > baseVol_
std::vector< std::vector< Handle< Quote > > > volSpreads_
QuantLib::ext::shared_ptr< SmileSection > smileSectionImpl(Time optionTime) const override
BusinessDayConvention businessDayConvention() const override
vector< Real > strikes