Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
List of all members
CorrelationTermStructure Class Referenceabstract

Correlation term structure. More...

#include <qle/termstructures/correlationtermstructure.hpp>

+ Inheritance diagram for CorrelationTermStructure:
+ Collaboration diagram for CorrelationTermStructure:

Public Member Functions

Constructors
 CorrelationTermStructure (const DayCounter &dc=DayCounter())
 
 CorrelationTermStructure (const Date &referenceDate, const Calendar &cal=Calendar(), const DayCounter &dc=DayCounter())
 
 CorrelationTermStructure (Natural settlementDays, const Calendar &cal, const DayCounter &dc=DayCounter())
 
Correlations
Real correlation (Time t, Real strike=Null< Real >(), bool extrapolate=false) const
 
Real correlation (const Date &d, Real strike=Null< Real >(), bool extrapolate=false) const
 
virtual Time minTime () const
 The minimum time for which the curve can return values. More...
 

Protected Member Functions

Calculations

This method must be implemented in derived classes to perform the actual calculations.

virtual Real correlationImpl (Time t, Real strike) const =0
 Correlation calculation. More...
 
virtual void checkRange (Time t, Real strike, bool extrapolate) const
 Extra time range check for minimum time, then calls TermStructure::checkRange. More...
 

Detailed Description

Correlation term structure.

This abstract class defines the interface of concrete correlation term structures which will be derived from this one.

Definition at line 39 of file correlationtermstructure.hpp.

Constructor & Destructor Documentation

◆ CorrelationTermStructure() [1/3]

CorrelationTermStructure ( const DayCounter &  dc = DayCounter())

Definition at line 25 of file correlationtermstructure.cpp.

◆ CorrelationTermStructure() [2/3]

CorrelationTermStructure ( const Date &  referenceDate,
const Calendar &  cal = Calendar(),
const DayCounter &  dc = DayCounter() 
)

Definition at line 27 of file correlationtermstructure.cpp.

28 : TermStructure(referenceDate, cal, dc) {}

◆ CorrelationTermStructure() [3/3]

CorrelationTermStructure ( Natural  settlementDays,
const Calendar &  cal,
const DayCounter &  dc = DayCounter() 
)

Definition at line 30 of file correlationtermstructure.cpp.

31 : TermStructure(settlementDays, cal, dc) {}

Member Function Documentation

◆ correlation() [1/2]

Real correlation ( Time  t,
Real  strike = Null<Real>(),
bool  extrapolate = false 
) const

Definition at line 33 of file correlationtermstructure.cpp.

33 {
34 checkRange(t, strike, extrapolate);
35
36 // Fail if correlation is negative
37 Real correlation = correlationImpl(t, strike);
38 QL_REQUIRE(correlation >= -1 && correlation <= 1,
39 "Correlation returned from CorrelationTermStructure must be between -1 and 1 (" << correlation << ")");
40
41 return correlation;
42}
virtual Real correlationImpl(Time t, Real strike) const =0
Correlation calculation.
Real correlation(Time t, Real strike=Null< Real >(), bool extrapolate=false) const
virtual void checkRange(Time t, Real strike, bool extrapolate) const
Extra time range check for minimum time, then calls TermStructure::checkRange.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ correlation() [2/2]

Real correlation ( const Date &  d,
Real  strike = Null<Real>(),
bool  extrapolate = false 
) const

Definition at line 44 of file correlationtermstructure.cpp.

44 {
45 return correlation(timeFromReference(d), strike, extrapolate);
46}
+ Here is the call graph for this function:

◆ minTime()

Time minTime ( ) const
virtual

The minimum time for which the curve can return values.

Reimplemented in BaseCorrelationTermStructure, SpreadedBaseCorrelationCurve, and SpreadedCorrelationCurve.

Definition at line 48 of file correlationtermstructure.cpp.

48 {
49 // Default implementation
50 return 0.0;
51}
+ Here is the caller graph for this function:

◆ correlationImpl()

virtual Real correlationImpl ( Time  t,
Real  strike 
) const
protectedpure virtual

◆ checkRange()

void checkRange ( Time  t,
Real  strike,
bool  extrapolate 
) const
protectedvirtual

Extra time range check for minimum time, then calls TermStructure::checkRange.

Reimplemented in BaseCorrelationTermStructure.

Definition at line 53 of file correlationtermstructure.cpp.

53 {
54 QL_REQUIRE(extrapolate || allowsExtrapolation() || t >= minTime() || close_enough(t, minTime()),
55 "time (" << t << ") is before min curve time (" << minTime() << ")");
56
57 // Now, do the usual TermStructure checks
58 TermStructure::checkRange(t, extrapolate);
59}
virtual Time minTime() const
The minimum time for which the curve can return values.
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
+ Here is the call graph for this function:
+ Here is the caller graph for this function: