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

Rate helper for bootstrapping using Overnight Indexed Swaps. More...

#include <qle/termstructures/oisratehelper.hpp>

+ Inheritance diagram for OISRateHelper:
+ Collaboration diagram for OISRateHelper:

Public Member Functions

 OISRateHelper (Natural settlementDays, const Period &swapTenor, const Handle< Quote > &fixedRate, const QuantLib::ext::shared_ptr< OvernightIndex > &overnightIndex, const DayCounter &fixedDayCounter, const Calendar &fixedCalendar, Natural paymentLag=0, bool endOfMonth=false, Frequency paymentFrequency=Annual, BusinessDayConvention fixedConvention=Following, BusinessDayConvention paymentAdjustment=Following, DateGeneration::Rule rule=DateGeneration::Backward, const Handle< YieldTermStructure > &discountingCurve=Handle< YieldTermStructure >(), bool telescopicValueDates=false, Pillar::Choice pillar=Pillar::LastRelevantDate, Date customPillarDate=Date())
 
RateHelper interface
Real impliedQuote () const override
 
void setTermStructure (YieldTermStructure *) override
 
inspectors
QuantLib::ext::shared_ptr< OvernightIndexedSwap > swap () const
 

Visitability

Natural settlementDays_
 
Period swapTenor_
 
QuantLib::ext::shared_ptr< OvernightIndex > overnightIndex_
 
DayCounter fixedDayCounter_
 
Calendar fixedCalendar_
 
Natural paymentLag_
 
bool endOfMonth_
 
Frequency paymentFrequency_
 
BusinessDayConvention fixedConvention_
 
BusinessDayConvention paymentAdjustment_
 
DateGeneration::Rule rule_
 
QuantLib::ext::shared_ptr< OvernightIndexedSwap > swap_
 
RelinkableHandle< YieldTermStructure > termStructureHandle_
 
Handle< YieldTermStructure > discountHandle_
 
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_
 
bool telescopicValueDates_
 
Pillar::Choice pillarChoice_
 
void accept (AcyclicVisitor &) override
 
void initializeDates () override
 

Detailed Description

Rate helper for bootstrapping using Overnight Indexed Swaps.

Definition at line 36 of file oisratehelper.hpp.

Constructor & Destructor Documentation

◆ OISRateHelper()

OISRateHelper ( Natural  settlementDays,
const Period &  swapTenor,
const Handle< Quote > &  fixedRate,
const QuantLib::ext::shared_ptr< OvernightIndex > &  overnightIndex,
const DayCounter &  fixedDayCounter,
const Calendar &  fixedCalendar,
Natural  paymentLag = 0,
bool  endOfMonth = false,
Frequency  paymentFrequency = Annual,
BusinessDayConvention  fixedConvention = Following,
BusinessDayConvention  paymentAdjustment = Following,
DateGeneration::Rule  rule = DateGeneration::Backward,
const Handle< YieldTermStructure > &  discountingCurve = Handle<YieldTermStructure>(),
bool  telescopicValueDates = false,
Pillar::Choice  pillar = Pillar::LastRelevantDate,
Date  customPillarDate = Date() 
)

Definition at line 28 of file oisratehelper.cpp.

35 : RelativeDateRateHelper(fixedRate), settlementDays_(settlementDays), swapTenor_(swapTenor),
36 overnightIndex_(overnightIndex), fixedDayCounter_(fixedDayCounter), fixedCalendar_(fixedCalendar),
37 paymentLag_(paymentLag), endOfMonth_(endOfMonth), paymentFrequency_(paymentFrequency),
38 fixedConvention_(fixedConvention), paymentAdjustment_(paymentAdjustment), rule_(rule),
39 discountHandle_(discountingCurve), telescopicValueDates_(telescopicValueDates), pillarChoice_(pillar) {
40
41 pillarDate_ = customPillarDate;
42
43 bool onIndexHasCurve = !overnightIndex_->forwardingTermStructure().empty();
44 bool haveDiscountCurve = !discountHandle_.empty();
45 QL_REQUIRE(!(onIndexHasCurve && haveDiscountCurve), "Have both curves nothing to solve for.");
46
47 if (!onIndexHasCurve) {
48 QuantLib::ext::shared_ptr<IborIndex> clonedIborIndex(overnightIndex_->clone(termStructureHandle_));
49 overnightIndex_ = QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(clonedIborIndex);
51 }
52
53 registerWith(overnightIndex_);
54 registerWith(discountHandle_);
56}
BusinessDayConvention paymentAdjustment_
BusinessDayConvention fixedConvention_
QuantLib::ext::shared_ptr< OvernightIndex > overnightIndex_
RelinkableHandle< YieldTermStructure > termStructureHandle_
Pillar::Choice pillarChoice_
Handle< YieldTermStructure > discountHandle_
DateGeneration::Rule rule_
void initializeDates() override
RelativeDateBootstrapHelper< YieldTermStructure > RelativeDateRateHelper
+ Here is the call graph for this function:

Member Function Documentation

◆ impliedQuote()

Real impliedQuote ( ) const
override

Definition at line 126 of file oisratehelper.cpp.

126 {
127 QL_REQUIRE(termStructure_ != 0, "term structure not set");
128 // we didn't register as observers - force calculation
129 swap_->deepUpdate();
130 return swap_->fairRate();
131}
QuantLib::ext::shared_ptr< OvernightIndexedSwap > swap_

◆ setTermStructure()

void setTermStructure ( YieldTermStructure *  t)
override

Definition at line 110 of file oisratehelper.cpp.

110 {
111 // do not set the relinkable handle as an observer
112 // force recalculation when needed
113 bool observer = false;
114
115 QuantLib::ext::shared_ptr<YieldTermStructure> temp(t, null_deleter());
116 termStructureHandle_.linkTo(temp, observer);
117
118 if (discountHandle_.empty())
119 discountRelinkableHandle_.linkTo(temp, observer);
120 else
122
123 RelativeDateRateHelper::setTermStructure(t);
124}
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_

◆ swap()

QuantLib::ext::shared_ptr< OvernightIndexedSwap > swap ( ) const

Definition at line 54 of file oisratehelper.hpp.

54{ return swap_; }

◆ accept()

void accept ( AcyclicVisitor &  v)
override

Definition at line 133 of file oisratehelper.cpp.

133 {
134 Visitor<OISRateHelper>* v1 = dynamic_cast<Visitor<OISRateHelper>*>(&v);
135 if (v1 != 0)
136 v1->visit(*this);
137 else
138 RateHelper::accept(v);
139}

◆ initializeDates()

void initializeDates ( )
overrideprotected

Definition at line 58 of file oisratehelper.cpp.

58 {
59
60 Calendar paymentCalendar_ = overnightIndex_->fixingCalendar();
61
62 swap_ = MakeOIS(swapTenor_, overnightIndex_, 0.0)
63 .withSettlementDays(settlementDays_)
64 .withFixedLegDayCount(fixedDayCounter_)
65 .withEndOfMonth(endOfMonth_)
66 .withPaymentFrequency(paymentFrequency_)
67 .withRule(rule_)
68 .withPaymentCalendar(paymentCalendar_)
69 .withPaymentAdjustment(paymentAdjustment_)
70 .withPaymentLag(paymentLag_)
71 .withDiscountingTermStructure(discountRelinkableHandle_)
72 .withTelescopicValueDates(telescopicValueDates_);
73 // TODO: patch QL?
74 //.withFixedAccrualConvention(fixedConvention_)
75 //..withFixedCalendar(fixedCalendar_)
76
77 earliestDate_ = swap_->startDate();
78 maturityDate_ = swap_->maturityDate();
79
80 Date lastPaymentDate = std::max(swap_->overnightLeg().back()->date(), swap_->fixedLeg().back()->date());
81 latestRelevantDate_ = std::max(maturityDate_, lastPaymentDate);
82
83 switch (pillarChoice_) {
84 case Pillar::MaturityDate:
85 pillarDate_ = maturityDate_;
86 break;
87 case Pillar::LastRelevantDate:
88 pillarDate_ = latestRelevantDate_;
89 break;
90 case Pillar::CustomDate:
91 // pillarDate_ already assigned at construction time
92 QL_REQUIRE(pillarDate_ >= earliestDate_, "pillar date (" << pillarDate_
93 << ") must be later "
94 "than or equal to the instrument's earliest date ("
95 << earliestDate_ << ")");
96 QL_REQUIRE(pillarDate_ <= latestRelevantDate_, "pillar date ("
97 << pillarDate_
98 << ") must be before "
99 "or equal to the instrument's latest relevant date ("
100 << latestRelevantDate_ << ")");
101 break;
102 default:
103 QL_FAIL("unknown Pillar::Choice(" << Integer(pillarChoice_) << ")");
104 }
105
106 // for backwards compatibility
107 latestDate_ = pillarDate_;
108}
+ Here is the caller graph for this function:

Member Data Documentation

◆ settlementDays_

Natural settlementDays_
protected

Definition at line 63 of file oisratehelper.hpp.

◆ swapTenor_

Period swapTenor_
protected

Definition at line 64 of file oisratehelper.hpp.

◆ overnightIndex_

QuantLib::ext::shared_ptr<OvernightIndex> overnightIndex_
protected

Definition at line 65 of file oisratehelper.hpp.

◆ fixedDayCounter_

DayCounter fixedDayCounter_
protected

Definition at line 66 of file oisratehelper.hpp.

◆ fixedCalendar_

Calendar fixedCalendar_
protected

Definition at line 67 of file oisratehelper.hpp.

◆ paymentLag_

Natural paymentLag_
protected

Definition at line 68 of file oisratehelper.hpp.

◆ endOfMonth_

bool endOfMonth_
protected

Definition at line 69 of file oisratehelper.hpp.

◆ paymentFrequency_

Frequency paymentFrequency_
protected

Definition at line 70 of file oisratehelper.hpp.

◆ fixedConvention_

BusinessDayConvention fixedConvention_
protected

Definition at line 71 of file oisratehelper.hpp.

◆ paymentAdjustment_

BusinessDayConvention paymentAdjustment_
protected

Definition at line 72 of file oisratehelper.hpp.

◆ rule_

DateGeneration::Rule rule_
protected

Definition at line 73 of file oisratehelper.hpp.

◆ swap_

QuantLib::ext::shared_ptr<OvernightIndexedSwap> swap_
protected

Definition at line 75 of file oisratehelper.hpp.

◆ termStructureHandle_

RelinkableHandle<YieldTermStructure> termStructureHandle_
protected

Definition at line 76 of file oisratehelper.hpp.

◆ discountHandle_

Handle<YieldTermStructure> discountHandle_
protected

Definition at line 77 of file oisratehelper.hpp.

◆ discountRelinkableHandle_

RelinkableHandle<YieldTermStructure> discountRelinkableHandle_
protected

Definition at line 78 of file oisratehelper.hpp.

◆ telescopicValueDates_

bool telescopicValueDates_
protected

Definition at line 79 of file oisratehelper.hpp.

◆ pillarChoice_

Pillar::Choice pillarChoice_
protected

Definition at line 80 of file oisratehelper.hpp.