Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
spreadedbasecorrelationcurve.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 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#include <ql/math/interpolation.hpp>
27#include <ql/patterns/lazyobject.hpp>
28
29namespace QuantExt {
30using namespace QuantLib;
31
32//! Spreaded Base Correlation Curve
34public:
35 SpreadedBaseCorrelationCurve(const Handle<BaseCorrelationTermStructure>& baseCurve,
36 const std::vector<Period>& tenors, const std::vector<double>& detachmentPoints,
37 const std::vector<std::vector<Handle<Quote>>>& corrSpreads,
38 const Date& startDate = Date(),
39 boost::optional<DateGeneration::Rule> rule = boost::none);
40 //@}
41 void update() override;
42
43 // TermStructure interface
44 virtual Date maxDate() const override { return baseCurve_->maxDate(); }
45
46 virtual Time maxTime() const override { return baseCurve_->maxTime(); }
47 virtual Time minTime() const override { return baseCurve_->minTime(); }
48
49 virtual double minDetachmentPoint() const override { return baseCurve_->minDetachmentPoint(); }
50 virtual double maxDetachmentPoint() const override { return baseCurve_->maxDetachmentPoint(); }
51
52private:
53 Real correlationImpl(Time t, Real strike) const override;
54 void performCalculations() const override;
55 Handle<BaseCorrelationTermStructure> baseCurve_;
56 std::vector<std::vector<Handle<Quote>>> corrSpreads_;
57 mutable Matrix data_;
58 mutable Interpolation2D interpolation_;
59};
60
61} // namespace QuantExt
abstract base correlation structure and an 2d-interpolated base correlation structure
std::vector< double > detachmentPoints() const
boost::optional< DateGeneration::Rule > rule() const
Real correlationImpl(Time t, Real strike) const override
Correlation calculation.
virtual double minDetachmentPoint() const override
virtual Time minTime() const override
The minimum time for which the curve can return values.
std::vector< std::vector< Handle< Quote > > > corrSpreads_
Handle< BaseCorrelationTermStructure > baseCurve_
virtual double maxDetachmentPoint() const override