Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedblackvolatilitycurve.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 spreadedblackvolatilitycurve.hpp
20 \brief Spreaded Black volatility curve
21 \ingroup termstructures
22*/
23
24#pragma once
25
26#include <ql/math/interpolation.hpp>
27#include <ql/patterns/lazyobject.hpp>
28#include <ql/quote.hpp>
29#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
30
31namespace QuantExt {
32using namespace QuantLib;
33
34//! Spreaded Black volatility curve modeled as variance curve
35class SpreadedBlackVolatilityCurve : public LazyObject, public BlackVolatilityTermStructure {
36public:
37 /*! - times should be consistent with reference ts day counter
38 - if useAtmReferenceVolsOnly, only vols with strike Null<Real>() are read from the referenceVol,
39 otherwise the full reference vol surface (if it is one) is used
40 */
41 SpreadedBlackVolatilityCurve(const Handle<BlackVolTermStructure>& referenceVol, const std::vector<Time>& times,
42 const std::vector<Handle<Quote>>& volSpreads,
43 const bool useAtmReferenceVolsOnly = false);
44 Date maxDate() const override;
45 const Date& referenceDate() const override;
46 Calendar calendar() const override;
47 Natural settlementDays() const override;
48 Real minStrike() const override;
49 Real maxStrike() const override;
50 void update() override;
51
52private:
53 void performCalculations() const override;
54 Real blackVolImpl(Time t, Real) const override;
55
56 Handle<BlackVolTermStructure> referenceVol_;
57 std::vector<Time> times_;
58 std::vector<Handle<Quote>> volSpreads_;
60 mutable std::vector<Real> data_;
61 QuantLib::ext::shared_ptr<Interpolation> interpolation_;
62};
63
64} // namespace QuantExt
Spreaded Black volatility curve modeled as variance curve.
Real blackVolImpl(Time t, Real) const override
QuantLib::ext::shared_ptr< Interpolation > interpolation_