Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedcorrelationcurve.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 spreadedcorrelationcurve.hpp
20 \brief Spreaded correlation curve
21*/
22
23#pragma once
24
26
27#include <ql/math/interpolation.hpp>
28#include <ql/patterns/lazyobject.hpp>
29
30namespace QuantExt {
31using namespace QuantLib;
32
33//! Spreaded Correlation Curve
34class SpreadedCorrelationCurve : public CorrelationTermStructure, public LazyObject {
35public:
36 /*! - times should be consistent with reference ts day counter
37 - if useAtmReferenceCorrsOnly, only corrs with strike Null<Real>() are read from the referenceVol,
38 otherwise the full reference vol surface (if it is one) is used
39 */
40 SpreadedCorrelationCurve(const Handle<CorrelationTermStructure>& referenceCorrelation,
41 const std::vector<Time>& times, const std::vector<Handle<Quote>>& corrSpreads,
42 const bool useAtmReferenceVolsOnly = false);
43 //@}
44
45 Date maxDate() const override;
46 const Date& referenceDate() const override;
47 Calendar calendar() const override;
48 Natural settlementDays() const override;
49 Time minTime() const override;
50 void update() override;
51
52private:
53 Real correlationImpl(Time t, Real strike) const override;
54 void performCalculations() const override;
55
56 Handle<CorrelationTermStructure> referenceCorrelation_;
57 std::vector<Time> times_;
58 std::vector<Handle<Quote>> corrSpreads_;
60 mutable std::vector<Real> data_;
61 QuantLib::ext::shared_ptr<Interpolation> interpolation_;
62};
63
64} // namespace QuantExt
Real correlationImpl(Time t, Real strike) const override
Correlation calculation.
Time minTime() const override
The minimum time for which the curve can return values.
const Date & referenceDate() const override
QuantLib::ext::shared_ptr< Interpolation > interpolation_
Handle< CorrelationTermStructure > referenceCorrelation_
std::vector< Handle< Quote > > corrSpreads_
Term structure of correlations.