Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FallbackOvernightIndex Class Reference

#include <qle/indexes/fallbackovernightindex.hpp>

+ Inheritance diagram for FallbackOvernightIndex:
+ Collaboration diagram for FallbackOvernightIndex:

Public Member Functions

 FallbackOvernightIndex (const QuantLib::ext::shared_ptr< OvernightIndex > originalIndex, const QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex, const Real spread, const Date &switchDate, const bool useRfrCurve)
 
 FallbackOvernightIndex (const QuantLib::ext::shared_ptr< OvernightIndex > originalIndex, const QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex, const Real spread, const Date &switchDate, const Handle< YieldTermStructure > &forwardingCurve)
 
void addFixing (const Date &fixingDate, Real fixing, bool forceOverwrite=false) override
 
Real fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const override
 
Rate pastFixing (const Date &fixingDate) const override
 
QuantLib::ext::shared_ptr< IborIndex > clone (const Handle< YieldTermStructure > &forwarding) const override
 
QuantLib::ext::shared_ptr< OvernightIndex > originalIndex () const
 
QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex () const
 
Real spread () const
 
const Date & switchDate () const
 
bool useRfrCurve () const
 

Private Member Functions

Rate forecastFixing (const Date &valueDate, const Date &endDate, Time t) const override
 

Private Attributes

QuantLib::ext::shared_ptr< OvernightIndex > originalIndex_
 
QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex_
 
Real spread_
 
Date switchDate_
 
bool useRfrCurve_
 

Detailed Description

Definition at line 35 of file fallbackovernightindex.hpp.

Constructor & Destructor Documentation

◆ FallbackOvernightIndex() [1/2]

FallbackOvernightIndex ( const QuantLib::ext::shared_ptr< OvernightIndex >  originalIndex,
const QuantLib::ext::shared_ptr< OvernightIndex >  rfrIndex,
const Real  spread,
const Date &  switchDate,
const bool  useRfrCurve 
)

Definition at line 30 of file fallbackovernightindex.cpp.

35 : QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(
36 rfrIndex->clone(originalIndex->forwardingTermStructure())),
38 useRfrCurve ? Handle<YieldTermStructure>(QuantLib::ext::make_shared<OvernightFallbackCurve>(
40 : originalIndex->forwardingTermStructure()) {}
FallbackOvernightIndex(const QuantLib::ext::shared_ptr< OvernightIndex > originalIndex, const QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex, const Real spread, const Date &switchDate, const bool useRfrCurve)
QuantLib::ext::shared_ptr< OvernightIndex > originalIndex() const
QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex() const

◆ FallbackOvernightIndex() [2/2]

FallbackOvernightIndex ( const QuantLib::ext::shared_ptr< OvernightIndex >  originalIndex,
const QuantLib::ext::shared_ptr< OvernightIndex >  rfrIndex,
const Real  spread,
const Date &  switchDate,
const Handle< YieldTermStructure > &  forwardingCurve 
)

Definition at line 42 of file fallbackovernightindex.cpp.

45 : OvernightIndex(originalIndex->familyName(), originalIndex->fixingDays(),
46 originalIndex->currency(), originalIndex->fixingCalendar(),
47 originalIndex->dayCounter(), forwardingCurve),
49 useRfrCurve_(false) {
50 registerWith(originalIndex);
51 registerWith(rfrIndex);
52 registerWith(forwardingCurve);
53}
QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex_
QuantLib::ext::shared_ptr< OvernightIndex > originalIndex_
+ Here is the call graph for this function:

Member Function Documentation

◆ addFixing()

void addFixing ( const Date &  fixingDate,
Real  fixing,
bool  forceOverwrite = false 
)
override

Definition at line 55 of file fallbackovernightindex.cpp.

55 {
56 if (fixingDate < switchDate_) {
57 IborIndex::addFixing(fixingDate, fixing, forceOverwrite);
58 } else {
59 QL_FAIL("Can not add fixing value "
60 << fixing << " for fixing date " << fixingDate << " to fall back ibor index '" << name()
61 << "' fixing history, since fixing date is after switch date (" << switchDate_ << ")");
62 }
63}
Real fixing(const Date &fixingDate, bool forecastTodaysFixing=false) const override
+ Here is the call graph for this function:

◆ fixing()

Real fixing ( const Date &  fixingDate,
bool  forecastTodaysFixing = false 
) const
override

Definition at line 65 of file fallbackovernightindex.cpp.

65 {
66 Date today = Settings::instance().evaluationDate();
67 if (today < switchDate_ || fixingDate < switchDate_) {
68 return originalIndex_->fixing(fixingDate, forecastTodaysFixing);
69 }
70 if (fixingDate > today) {
71 return IborIndex::forecastFixing(fixingDate);
72 } else {
73 return rfrIndex_->fixing(fixingDate) + spread_;
74 }
75}
+ Here is the caller graph for this function:

◆ pastFixing()

Rate pastFixing ( const Date &  fixingDate) const
override

Definition at line 77 of file fallbackovernightindex.cpp.

77 {
78 Date today = Settings::instance().evaluationDate();
79 if (today < switchDate_) {
80 return originalIndex_->pastFixing(fixingDate);
81 }
82 return fixing(fixingDate);
83}
+ Here is the call graph for this function:

◆ clone()

QuantLib::ext::shared_ptr< IborIndex > clone ( const Handle< YieldTermStructure > &  forwarding) const
override

Definition at line 85 of file fallbackovernightindex.cpp.

85 {
86 return QuantLib::ext::make_shared<FallbackOvernightIndex>(originalIndex_, rfrIndex_, spread_, switchDate_, forwarding);
87}

◆ originalIndex()

QuantLib::ext::shared_ptr< OvernightIndex > originalIndex ( ) const

Definition at line 100 of file fallbackovernightindex.cpp.

100{ return originalIndex_; }
+ Here is the caller graph for this function:

◆ rfrIndex()

QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex ( ) const

Definition at line 102 of file fallbackovernightindex.cpp.

102{ return rfrIndex_; }
+ Here is the caller graph for this function:

◆ spread()

Real spread ( ) const

Definition at line 104 of file fallbackovernightindex.cpp.

104{ return spread_; }

◆ switchDate()

const Date & switchDate ( ) const

Definition at line 106 of file fallbackovernightindex.cpp.

106{ return switchDate_; }

◆ useRfrCurve()

bool useRfrCurve ( ) const

Definition at line 108 of file fallbackovernightindex.cpp.

108{ return useRfrCurve_; }

◆ forecastFixing()

Rate forecastFixing ( const Date &  valueDate,
const Date &  endDate,
Time  t 
) const
overrideprivate

Definition at line 89 of file fallbackovernightindex.cpp.

89 {
90 Date today = Settings::instance().evaluationDate();
91 Handle<YieldTermStructure> curve =
92 today < switchDate_ ? originalIndex_->forwardingTermStructure() : forwardingTermStructure();
93 QL_REQUIRE(!curve.empty(), "FallbackOvernightIndex: null term structure set for " << name() << ", today=" << today
94 << ", switchDate=" << switchDate_);
95 DiscountFactor disc1 = curve->discount(valueDate);
96 DiscountFactor disc2 = curve->discount(endDate);
97 return (disc1 / disc2 - 1.0) / t;
98}

Member Data Documentation

◆ originalIndex_

QuantLib::ext::shared_ptr<OvernightIndex> originalIndex_
private

Definition at line 57 of file fallbackovernightindex.hpp.

◆ rfrIndex_

QuantLib::ext::shared_ptr<OvernightIndex> rfrIndex_
private

Definition at line 58 of file fallbackovernightindex.hpp.

◆ spread_

Real spread_
private

Definition at line 59 of file fallbackovernightindex.hpp.

◆ switchDate_

Date switchDate_
private

Definition at line 60 of file fallbackovernightindex.hpp.

◆ useRfrCurve_

bool useRfrCurve_
private

Definition at line 61 of file fallbackovernightindex.hpp.