Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
blackvariancesurfacestddevs.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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 blackvariancesurfacestddevs.hpp
20 \brief Black volatility surface modeled as variance surface
21 */
22
23#ifndef quantext_black_variance_surface_stddevs_hpp
24#define quantext_black_variance_surface_stddevs_hpp
25
26#include <ql/math/interpolations/linearinterpolation.hpp>
27#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
28#include <ql/termstructures/yieldtermstructure.hpp>
29#include <ql/time/daycounters/actual365fixed.hpp>
30#include <ql/termstructures/yieldtermstructure.hpp>
34
35namespace QuantExt {
36using namespace QuantLib;
37
38//! Black volatility surface based on forward moneyness
39//! \ingroup termstructures
41public:
42 BlackVarianceSurfaceStdDevs(const Calendar& cal, const Handle<Quote>& spot, const std::vector<Time>& times,
43 const std::vector<Real>& stdDevs,
44 const std::vector<std::vector<Handle<Quote> > >& blackVolMatrix,
45 const DayCounter& dayCounter, const QuantLib::ext::shared_ptr<EqFxIndexBase>& index,
46 bool stickyStrike = false, bool flatExtrapMoneyness = false);
47
48 // A method that takes a reference to a vector of vector of quotes (that will be populated), termstructure,
49 // expiry times, and standard deviation points. Fills the quotes with the correct points from the termstructure.
50 // Inputs: - termStructre - the BlackVolTermStructure from which to get the values.
51 // - quotesToPopulate - vector of vector of quotes, matching the given expiries and std dev points.
52 // - expiries & stdDevPoints - the points matching the quotesToPopulate axes.
53 // - fowardCurve & atmVolCurve - forward curve and atm vol curve, used in the calcs for strike values.
54 static void populateVolMatrix(const QuantLib::Handle<QuantLib::BlackVolTermStructure>& termStructre,
55 std::vector<std::vector<Handle<QuantLib::Quote> > >& quotesToPopulate,
56 const std::vector<Real>& times, const std::vector<Real>& stdDevPoints,
57 const QuantLib::Interpolation& forwardCurve,
58 const QuantLib::Interpolation atmVolCurve);
59
60private:
61 virtual Real moneyness(Time t, Real strike) const override;
62 QuantLib::ext::shared_ptr<EqFxIndexBase> index_;
63 std::vector<Real> forwards_; // cache fwd values if StickyStrike==true
64 Interpolation forwardCurve_;
65 Interpolation atmVarCurve_;
66 std::vector<Time> atmTimes_;
67 std::vector<Real> atmVariances_;
68 bool flatExtrapolateMoneyness_; // flatly extrapolate on moneyness axis
69};
70
71} // namespace QuantExt
72
73#endif
Black volatility surface based on forward moneyness.
Abstract Black volatility surface based on moneyness (moneyness defined in subclasses)
std::vector< QuantLib::Real > moneyness() const
QuantLib::ext::shared_ptr< EqFxIndexBase > index_
static void populateVolMatrix(const QuantLib::Handle< QuantLib::BlackVolTermStructure > &termStructre, std::vector< std::vector< Handle< QuantLib::Quote > > > &quotesToPopulate, const std::vector< Real > &times, const std::vector< Real > &stdDevPoints, const QuantLib::Interpolation &forwardCurve, const QuantLib::Interpolation atmVolCurve)
A common base class for the FX and Equity Indices. Provides a forecast fixing method for time so the ...