Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
blackvolsurfaceproxy.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 qle/termstructures/blackvolsurfaceproxy.hpp
20 \brief Wrapper class for a BlackVolTermStructure when using proxy vols.
21 \ingroup termstructures
22*/
23
24#pragma once
25
26#include <ql/shared_ptr.hpp>
27#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
28#include <ql/termstructures/yieldtermstructure.hpp>
32
33namespace QuantExt {
34using namespace QuantLib;
35
36//! Wrapper class for a BlackVolTermStructure that allows us to proxy one equity vol surface off another.
37/*! This class implements BlackVolatilityTermStructure and takes a surface (well, any BlackVolTermStructure) as an
38 input. It also takes Handles to two EquityIndices (index and proxyIndex), where index is the 'EquityIndex' of the
39 underlying for the surface being constructed and proxyIndex is the 'EquityIndex' for the surface being proxied off.
40
41 The vol returned from the new surface is proxied from the base, adjusting by the forward prices to match ATM:
42
43 \f{eqnarray}{
44 \sigma_2(K,T) = \sigma_1(\frac{K}{F_2}*F_1,T)
45 \f}
46
47 Where \n\n
48 \f$ \sigma_1 = \text{Volatility of underlying being proxied against}\f$ \n
49 \f$ \sigma_2 = \text{Volatility of underlying being proxied}\f$ \n
50 \f$ F_1 = \text{Forward at time T of the underlying being proxied against}\f$ \n
51 \f$ F_2 = \text{Forward at time T of the underlying being proxied}\f$ \n
52 \f$ T = \text{Time}\f$
53 \n
54
55 Note: This surface only proxies equity volatilities, this is because we are forced to look up the equity fixings
56 using time instead of date and use the forecastFixing method in an EquityIndex. A more general class could be
57 developed if need, using Index instead of EquityIndex, if the time lookup could be overcome.
58
59 */
60//!\ingroup termstructures
61
62class BlackVolatilitySurfaceProxy : public BlackVolatilityTermStructure {
63public:
64 //! Constructor. This is a floating term structure (settlement days is zero)
65 BlackVolatilitySurfaceProxy(const QuantLib::ext::shared_ptr<BlackVolTermStructure>& proxySurface,
66 const QuantLib::ext::shared_ptr<EqFxIndexBase>& index,
67 const QuantLib::ext::shared_ptr<EqFxIndexBase>& proxyIndex,
68 const QuantLib::ext::shared_ptr<BlackVolTermStructure>& fxSurface = nullptr,
69 const QuantLib::ext::shared_ptr<FxIndex>& fxIndex = nullptr,
70 const QuantLib::ext::shared_ptr<CorrelationTermStructure>& correlation = nullptr);
71
72 //! \name TermStructure interface
73 //@{
74 DayCounter dayCounter() const override { return proxySurface_->dayCounter(); }
75 Date maxDate() const override { return proxySurface_->maxDate(); }
76 Time maxTime() const override { return proxySurface_->maxTime(); }
77 const Date& referenceDate() const override { return proxySurface_->referenceDate(); }
78 Calendar calendar() const override { return proxySurface_->calendar(); }
79 Natural settlementDays() const override { return proxySurface_->settlementDays(); }
80 //@}
81
82 //! \name VolatilityTermStructure interface
83 //@{
84 Rate minStrike() const override;
85 Rate maxStrike() const override;
86 //@}
87
88 //! \name Inspectors
89 //@{
90 QuantLib::ext::shared_ptr<BlackVolTermStructure> proxySurface() const { return proxySurface_; }
91 QuantLib::ext::shared_ptr<EqFxIndexBase> index() const { return index_; }
92 QuantLib::ext::shared_ptr<EqFxIndexBase> proxyIndex() const { return proxyIndex_; }
93 //@}
94
95protected:
96 // Here we adjust the returned vol.
97 Volatility blackVolImpl(Time t, Real strike) const override;
98
99private:
100 QuantLib::ext::shared_ptr<BlackVolTermStructure> proxySurface_;
101 QuantLib::ext::shared_ptr<EqFxIndexBase> index_, proxyIndex_;
102 QuantLib::ext::shared_ptr<BlackVolTermStructure> fxSurface_;
103 QuantLib::ext::shared_ptr<FxIndex> fxIndex_;
104 QuantLib::ext::shared_ptr<CorrelationTermStructure> correlation_;
105};
106
107} // namespace QuantExt
Wrapper class for a BlackVolTermStructure that allows us to proxy one equity vol surface off another.
QuantLib::ext::shared_ptr< EqFxIndexBase > index_
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
const Date & referenceDate() const override
QuantLib::ext::shared_ptr< BlackVolTermStructure > proxySurface_
QuantLib::ext::shared_ptr< EqFxIndexBase > proxyIndex_
QuantLib::ext::shared_ptr< CorrelationTermStructure > correlation_
QuantLib::ext::shared_ptr< BlackVolTermStructure > fxSurface_
QuantLib::ext::shared_ptr< EqFxIndexBase > proxyIndex() const
Volatility blackVolImpl(Time t, Real strike) const override
QuantLib::ext::shared_ptr< EqFxIndexBase > index() const
QuantLib::ext::shared_ptr< BlackVolTermStructure > proxySurface() const
Term structure of correlations.
equity index class for holding equity fixing histories and forwarding.
FX index class.