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
FallbackIborIndex Class Reference

#include <qle/indexes/fallbackiborindex.hpp>

+ Inheritance diagram for FallbackIborIndex:
+ Collaboration diagram for FallbackIborIndex:

Public Member Functions

 FallbackIborIndex (const QuantLib::ext::shared_ptr< IborIndex > originalIndex, const QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex, const Real spread, const Date &switchDate, const bool useRfrCurve)
 
 FallbackIborIndex (const QuantLib::ext::shared_ptr< IborIndex > 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< IborIndex > originalIndex () const
 
QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex () const
 
Real spread () const
 
const Date & switchDate () const
 
QuantLib::ext::shared_ptr< OvernightIndexedCoupononCoupon (const Date &iborFixingDate, const bool telescopicValueDates=false) const
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 35 of file fallbackiborindex.hpp.

Constructor & Destructor Documentation

◆ FallbackIborIndex() [1/2]

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

Definition at line 30 of file fallbackiborindex.cpp.

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

◆ FallbackIborIndex() [2/2]

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

Definition at line 42 of file fallbackiborindex.cpp.

45 : IborIndex(originalIndex->familyName(), originalIndex->tenor(), originalIndex->fixingDays(),
46 originalIndex->currency(), originalIndex->fixingCalendar(), originalIndex->businessDayConvention(),
47 originalIndex->endOfMonth(), originalIndex->dayCounter(), forwardingCurve),
49 registerWith(originalIndex);
50 registerWith(rfrIndex);
51 registerWith(forwardingCurve);
52}
QuantLib::ext::shared_ptr< IborIndex > originalIndex_
QuantLib::ext::shared_ptr< OvernightIndex > rfrIndex_
+ 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 54 of file fallbackiborindex.cpp.

54 {
55 if (fixingDate < switchDate_) {
56 IborIndex::addFixing(fixingDate, fixing, forceOverwrite);
57 } else {
58 QL_FAIL("Can not add fixing value "
59 << fixing << " for fixing date " << fixingDate << " to fall back ibor index '" << name()
60 << "' fixing history, since fixing date is after switch date (" << switchDate_ << ")");
61 }
62}
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 76 of file fallbackiborindex.cpp.

76 {
77 Date today = Settings::instance().evaluationDate();
78 if (today < switchDate_ || fixingDate < switchDate_) {
79 return originalIndex_->fixing(fixingDate, forecastTodaysFixing);
80 }
81 if (fixingDate > today) {
82 return IborIndex::forecastFixing(fixingDate);
83 } else {
84 if (QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(originalIndex_))
85 return rfrIndex_->fixing(fixingDate) + spread_;
86 else
87 return onCoupon(fixingDate, true)->rate() + spread_;
88 }
89}
QuantLib::ext::shared_ptr< OvernightIndexedCoupon > onCoupon(const Date &iborFixingDate, const bool telescopicValueDates=false) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pastFixing()

Rate pastFixing ( const Date &  fixingDate) const
override

Definition at line 91 of file fallbackiborindex.cpp.

91 {
92 Date today = Settings::instance().evaluationDate();
93 if (today < switchDate_) {
94 return originalIndex_->pastFixing(fixingDate);
95 }
96 return fixing(fixingDate);
97}
+ Here is the call graph for this function:

◆ clone()

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

Definition at line 99 of file fallbackiborindex.cpp.

99 {
100 return QuantLib::ext::make_shared<FallbackIborIndex>(originalIndex_, rfrIndex_, spread_, switchDate_, forwarding);
101}

◆ originalIndex()

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

Definition at line 114 of file fallbackiborindex.cpp.

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

◆ rfrIndex()

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

Definition at line 116 of file fallbackiborindex.cpp.

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

◆ spread()

Real spread ( ) const

Definition at line 118 of file fallbackiborindex.cpp.

118{ return spread_; }

◆ switchDate()

const Date & switchDate ( ) const

Definition at line 120 of file fallbackiborindex.cpp.

120{ return switchDate_; }

◆ onCoupon()

QuantLib::ext::shared_ptr< OvernightIndexedCoupon > onCoupon ( const Date &  iborFixingDate,
const bool  telescopicValueDates = false 
) const

Definition at line 64 of file fallbackiborindex.cpp.

65 {
66 QL_REQUIRE(iborFixingDate >= switchDate_, "FallbackIborIndex: onCoupon for ibor fixing date "
67 << iborFixingDate << " requested, which is before switch date "
68 << switchDate_ << " for index '" << name() << "'");
69 Date valueDate = originalIndex_->valueDate(iborFixingDate);
70 Date maturityDate = originalIndex_->maturityDate(valueDate);
71 return QuantLib::ext::make_shared<OvernightIndexedCoupon>(maturityDate, 1.0, valueDate, maturityDate, rfrIndex_, 1.0, 0.0,
72 Date(), Date(), DayCounter(), telescopicValueDates, false,
73 2 * Days, 0, Null<Size>());
74}
+ Here is the caller graph for this function:

◆ forecastFixing()

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

Definition at line 103 of file fallbackiborindex.cpp.

103 {
104 Date today = Settings::instance().evaluationDate();
105 Handle<YieldTermStructure> curve =
106 today < switchDate_ ? originalIndex_->forwardingTermStructure() : forwardingTermStructure();
107 QL_REQUIRE(!curve.empty(), "FallbackIborIndex: null term structure set for " << name() << ", today=" << today
108 << ", switchDate=" << switchDate_);
109 DiscountFactor disc1 = curve->discount(valueDate);
110 DiscountFactor disc2 = curve->discount(endDate);
111 return (disc1 / disc2 - 1.0) / t;
112}

Member Data Documentation

◆ originalIndex_

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

Definition at line 59 of file fallbackiborindex.hpp.

◆ rfrIndex_

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

Definition at line 60 of file fallbackiborindex.hpp.

◆ spread_

Real spread_
private

Definition at line 61 of file fallbackiborindex.hpp.

◆ switchDate_

Date switchDate_
private

Definition at line 62 of file fallbackiborindex.hpp.