Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedblackvolatilitysurfacemoneyness.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 spreadedblackvolatilitysurfacemoneyness.hpp
20 \brief Spreaded Black volatility surface based on moneyness
21 \ingroup termstructures
22 */
23
24#pragma once
25
26#include <ql/math/interpolation.hpp>
27#include <ql/math/interpolations/interpolation2d.hpp>
28#include <ql/patterns/lazyobject.hpp>
29#include <ql/quote.hpp>
30#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
31#include <ql/termstructures/yieldtermstructure.hpp>
32#include <ql/time/daycounters/actual365fixed.hpp>
33
34namespace QuantExt {
35using namespace QuantLib;
36
37//! Abstract Spreaded Black volatility surface based on moneyness (moneyness defined in subclasses)
38class SpreadedBlackVolatilitySurfaceMoneyness : public LazyObject, public BlackVolatilityTermStructure {
39public:
40 /* The smile dynamics is defined in terms of the forward curve defined by the spot and moving term structure.
41 The sticky spot and term structures define the sticky forward curve of the reference vol instead, which
42 should not react to the moving forward curve. */
43 SpreadedBlackVolatilitySurfaceMoneyness(const Handle<BlackVolTermStructure>& referenceVol,
44 const Handle<Quote>& movingSpot, const std::vector<Time>& times,
45 const std::vector<Real>& moneyness,
46 const std::vector<std::vector<Handle<Quote>>>& volSpreads,
47 const Handle<Quote>& stickySpot,
48 const Handle<YieldTermStructure>& stickyDividendTs,
49 const Handle<YieldTermStructure>& stickyRiskFreeTs,
50 const Handle<YieldTermStructure>& movingDividendTs,
51 const Handle<YieldTermStructure>& movingRiskFreeTs, bool stickyStrike);
52
53 Date maxDate() const override;
54 const Date& referenceDate() const override;
55 Calendar calendar() const override;
56 Natural settlementDays() const override;
57 Real minStrike() const override;
58 Real maxStrike() const override;
59 void update() override;
60
61 const std::vector<QuantLib::Real>& moneyness() const;
62
63protected:
64 virtual Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const = 0;
65 virtual Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const = 0;
66
67 Handle<BlackVolTermStructure> referenceVol_;
68 Handle<Quote> movingSpot_;
69 std::vector<Time> times_;
70 std::vector<Real> moneyness_;
71 std::vector<std::vector<Handle<Quote>>> volSpreads_;
72 Handle<Quote> stickySpot_;
73 Handle<YieldTermStructure> stickyDividendTs_;
74 Handle<YieldTermStructure> stickyRiskFreeTs_;
75 Handle<YieldTermStructure> movingDividendTs_;
76 Handle<YieldTermStructure> movingRiskFreeTs_;
78
79 mutable Matrix data_;
80 mutable Interpolation2D volSpreadSurface_;
81
82private:
83 void performCalculations() const override;
84 Real blackVolImpl(Time t, Real strike) const override;
85};
86
87//! Spreaded Black volatility surface based on spot moneyness
89public:
91
92private:
93 Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override;
94 Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override;
95};
96
97//! Black volatility surface based on forward moneyness
99public:
101
102private:
103 Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override;
104 Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override;
105};
106
107//! Spreaded Black volatility surface based on spot log moneyness
109public:
111
112private:
113 Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override;
114 Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override;
115};
116
117//! Black volatility surface based on forward log moneyness
119public:
121
122private:
123 Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override;
124 Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override;
125};
126
127//! Black volatility surface based on std devs (standardised log moneyness)
129public:
131
132private:
133 Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override;
134 Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override;
135};
136
137//! Spreaded Black volatility surface based on absolute spot moneyness
139public:
141
142private:
143 Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override;
144 Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override;
145};
146
147//! Spreaded Black volatility surface based on absolute forward moneyness
149public:
151
152private:
153 Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override;
154 Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override;
155};
156
157} // namespace QuantExt
Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override
Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override
Spreaded Black volatility surface based on spot log moneyness.
Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override
Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override
Spreaded Black volatility surface based on absolute forward moneyness.
Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override
Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override
Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override
Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override
Abstract Spreaded Black volatility surface based on moneyness (moneyness defined in subclasses)
virtual Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const =0
virtual Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const =0
SpreadedBlackVolatilitySurfaceMoneyness(const Handle< BlackVolTermStructure > &referenceVol, const Handle< Quote > &movingSpot, const std::vector< Time > &times, const std::vector< Real > &moneyness, const std::vector< std::vector< Handle< Quote > > > &volSpreads, const Handle< Quote > &stickySpot, const Handle< YieldTermStructure > &stickyDividendTs, const Handle< YieldTermStructure > &stickyRiskFreeTs, const Handle< YieldTermStructure > &movingDividendTs, const Handle< YieldTermStructure > &movingRiskFreeTs, bool stickyStrike)
Spreaded Black volatility surface based on absolute spot moneyness.
Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override
Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override
Spreaded Black volatility surface based on spot moneyness.
Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override
Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override
Black volatility surface based on std devs (standardised log moneyness)
Real strikeFromMoneyness(Time t, Real moneyness, const bool stickyReference) const override
Real moneynessFromStrike(Time t, Real strike, const bool stickyReference) const override