Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
flatcorrelation.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 qle/termstructures/flatcorrelation.hpp
20 \brief Term structure of flat correlations
21*/
22
23#ifndef quantext_flat_correlation_hpp
24#define quantext_flat_correlation_hpp
25
26#include <ql/math/comparison.hpp>
27#include <ql/quotes/simplequote.hpp>
28#include <ql/termstructure.hpp>
29#include <ql/time/daycounters/actual365fixed.hpp>
31
32namespace QuantExt {
33using namespace QuantLib;
34
35//! Flat correlation structure
36/*! \ingroup correlationtermstructures */
38public:
39 //! \name Constructors
40 //@{
41 FlatCorrelation(const Date& referenceDate, const Handle<Quote>& correlation, const DayCounter&);
42 FlatCorrelation(const Date& referenceDate, Real correlation, const DayCounter&);
43 FlatCorrelation(Natural settlementDays, const Calendar& calendar, const Handle<Quote>& correlation,
44 const DayCounter&);
45 FlatCorrelation(Natural settlementDays, const Calendar& calendar, Real correlation, const DayCounter&);
46 //@}
47 //! \name TermStructure interface
48 //@{
49 Date maxDate() const override { return Date::maxDate(); }
50 Time maxTime() const override { return QL_MAX_REAL; }
51 //@}
52 //! \name Inspectors
53 //@{
54 const Handle<Quote>& quote() const { return correlation_; }
55 //@}
56
57private:
58 //! \name CorrelationTermStructure interface
59 //@{
60 Real correlationImpl(Time, Real) const override { return correlation_->value(); }
61 //@}
62
63 Handle<Quote> correlation_;
64};
65
66} // namespace QuantExt
67
68#endif
Real correlation(Time t, Real strike=Null< Real >(), bool extrapolate=false) const
Flat correlation structure.
const Handle< Quote > & quote() const
Date maxDate() const override
Time maxTime() const override
Real correlationImpl(Time, Real) const override
Correlation calculation.
Term structure of correlations.