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

Average OIS Rate Helper. More...

#include <qle/termstructures/averageoisratehelper.hpp>

+ Inheritance diagram for AverageOISRateHelper:
+ Collaboration diagram for AverageOISRateHelper:

Public Member Functions

 AverageOISRateHelper (const Handle< Quote > &fixedRate, const Period &spotLagTenor, const Period &swapTenor, const Period &fixedTenor, const DayCounter &fixedDayCounter, const Calendar &fixedCalendar, BusinessDayConvention fixedConvention, BusinessDayConvention fixedPaymentAdjustment, const QuantLib::ext::shared_ptr< OvernightIndex > &overnightIndex, const Period &onTenor, const Handle< Quote > &onSpread, Natural rateCutoff, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const bool telescopicValueDates=false)
 
RateHelper interface
Real impliedQuote () const override
 
void setTermStructure (YieldTermStructure *) override
 
AverageOISRateHelper inspectors
Spread onSpread () const
 
QuantLib::ext::shared_ptr< AverageOISaverageOIS () const
 

Visitability

QuantLib::ext::shared_ptr< AverageOISaverageOIS_
 
Period spotLagTenor_
 
Period swapTenor_
 
Period fixedTenor_
 
DayCounter fixedDayCounter_
 
Calendar fixedCalendar_
 
BusinessDayConvention fixedConvention_
 
BusinessDayConvention fixedPaymentAdjustment_
 
QuantLib::ext::shared_ptr< OvernightIndex > overnightIndex_
 
Period onTenor_
 
Handle< Quote > onSpread_
 
Natural rateCutoff_
 
RelinkableHandle< YieldTermStructure > termStructureHandle_
 
Handle< YieldTermStructure > discountHandle_
 
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_
 
bool telescopicValueDates_
 
void accept (AcyclicVisitor &) override
 
void initializeDates () override
 

Detailed Description

Average OIS Rate Helper.

Rate helper to facilitate the usage of an AverageOIS instrument in bootstrapping. This instrument pays a fixed leg vs. a leg that pays the arithmetic average of an ON index plus a spread.

    \ingroup termstructures

Definition at line 41 of file averageoisratehelper.hpp.

Constructor & Destructor Documentation

◆ AverageOISRateHelper()

AverageOISRateHelper ( const Handle< Quote > &  fixedRate,
const Period &  spotLagTenor,
const Period &  swapTenor,
const Period &  fixedTenor,
const DayCounter &  fixedDayCounter,
const Calendar &  fixedCalendar,
BusinessDayConvention  fixedConvention,
BusinessDayConvention  fixedPaymentAdjustment,
const QuantLib::ext::shared_ptr< OvernightIndex > &  overnightIndex,
const Period &  onTenor,
const Handle< Quote > &  onSpread,
Natural  rateCutoff,
const Handle< YieldTermStructure > &  discountCurve = Handle<YieldTermStructure>(),
const bool  telescopicValueDates = false 
)

Definition at line 25 of file averageoisratehelper.cpp.

37 : RelativeDateRateHelper(fixedRate), spotLagTenor_(spotLagTenor), swapTenor_(swapTenor), fixedTenor_(fixedTenor),
38 fixedDayCounter_(fixedDayCounter), fixedCalendar_(fixedCalendar), fixedConvention_(fixedConvention),
39 fixedPaymentAdjustment_(fixedPaymentAdjustment), overnightIndex_(overnightIndex), onTenor_(onTenor),
40 onSpread_(onSpread), rateCutoff_(rateCutoff), discountHandle_(discountCurve),
41 telescopicValueDates_(telescopicValueDates) {
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(onSpread_);
55 registerWith(discountHandle_);
57}
BusinessDayConvention fixedConvention_
QuantLib::ext::shared_ptr< OvernightIndex > overnightIndex_
RelinkableHandle< YieldTermStructure > termStructureHandle_
BusinessDayConvention fixedPaymentAdjustment_
Handle< YieldTermStructure > discountHandle_
RelativeDateBootstrapHelper< YieldTermStructure > RelativeDateRateHelper
+ Here is the call graph for this function:

Member Function Documentation

◆ impliedQuote()

Real impliedQuote ( ) const
override

Definition at line 75 of file averageoisratehelper.cpp.

75 {
76
77 QL_REQUIRE(termStructure_ != 0, "term structure not set");
78 averageOIS_->deepUpdate();
79
80 // Calculate the fair fixed rate after accounting for the
81 // spread in the spread quote. Recall, the spread quote was
82 // intentionally not added to instrument averageOIS_.
83 static const Spread basisPoint = 1.0e-4;
84 Real onLegNPV = averageOIS_->overnightLegNPV();
85 Spread onSpread = onSpread_.empty() ? 0.0 : onSpread_->value();
86 Real spreadNPV = averageOIS_->overnightLegBPS() * onSpread / basisPoint;
87 Real onLegNPVwithSpread = onLegNPV + spreadNPV;
88 Real result = -onLegNPVwithSpread / (averageOIS_->fixedLegBPS() / basisPoint);
89 return result;
90}
QuantLib::ext::shared_ptr< AverageOIS > averageOIS_
+ Here is the call graph for this function:

◆ setTermStructure()

void setTermStructure ( YieldTermStructure *  t)
override

Definition at line 92 of file averageoisratehelper.cpp.

92 {
93
94 bool observer = false;
95 QuantLib::ext::shared_ptr<YieldTermStructure> temp(t, null_deleter());
96 termStructureHandle_.linkTo(temp, observer);
97
98 if (discountHandle_.empty())
99 discountRelinkableHandle_.linkTo(temp, observer);
100 else
102
103 RelativeDateRateHelper::setTermStructure(t);
104}
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_

◆ onSpread()

Spread onSpread ( ) const

Definition at line 106 of file averageoisratehelper.cpp.

106{ return onSpread_.empty() ? 0.0 : onSpread_->value(); }
+ Here is the caller graph for this function:

◆ averageOIS()

QuantLib::ext::shared_ptr< AverageOIS > averageOIS ( ) const

Definition at line 108 of file averageoisratehelper.cpp.

108{ return averageOIS_; }

◆ accept()

void accept ( AcyclicVisitor &  v)
override

Definition at line 110 of file averageoisratehelper.cpp.

110 {
111
112 Visitor<AverageOISRateHelper>* v1 = dynamic_cast<Visitor<AverageOISRateHelper>*>(&v);
113 if (v1 != 0)
114 v1->visit(*this);
115 else
116 RateHelper::accept(v);
117}

◆ initializeDates()

void initializeDates ( )
overrideprotected

Definition at line 59 of file averageoisratehelper.cpp.

59 {
60
63 .withFixedCalendar(fixedCalendar_)
64 .withFixedConvention(fixedConvention_)
65 .withFixedTerminationDateConvention(fixedConvention_)
66 .withFixedPaymentAdjustment(fixedPaymentAdjustment_)
67 .withRateCutoff(rateCutoff_)
68 .withDiscountingTermStructure(discountRelinkableHandle_)
69 .withTelescopicValueDates(telescopicValueDates_);
70
71 earliestDate_ = averageOIS_->startDate();
72 latestDate_ = averageOIS_->maturityDate();
73}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ averageOIS_

QuantLib::ext::shared_ptr<AverageOIS> averageOIS_
protected

Definition at line 70 of file averageoisratehelper.hpp.

◆ spotLagTenor_

Period spotLagTenor_
protected

Definition at line 72 of file averageoisratehelper.hpp.

◆ swapTenor_

Period swapTenor_
protected

Definition at line 73 of file averageoisratehelper.hpp.

◆ fixedTenor_

Period fixedTenor_
protected

Definition at line 75 of file averageoisratehelper.hpp.

◆ fixedDayCounter_

DayCounter fixedDayCounter_
protected

Definition at line 76 of file averageoisratehelper.hpp.

◆ fixedCalendar_

Calendar fixedCalendar_
protected

Definition at line 77 of file averageoisratehelper.hpp.

◆ fixedConvention_

BusinessDayConvention fixedConvention_
protected

Definition at line 78 of file averageoisratehelper.hpp.

◆ fixedPaymentAdjustment_

BusinessDayConvention fixedPaymentAdjustment_
protected

Definition at line 79 of file averageoisratehelper.hpp.

◆ overnightIndex_

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

Definition at line 81 of file averageoisratehelper.hpp.

◆ onTenor_

Period onTenor_
protected

Definition at line 82 of file averageoisratehelper.hpp.

◆ onSpread_

Handle<Quote> onSpread_
protected

Definition at line 83 of file averageoisratehelper.hpp.

◆ rateCutoff_

Natural rateCutoff_
protected

Definition at line 84 of file averageoisratehelper.hpp.

◆ termStructureHandle_

RelinkableHandle<YieldTermStructure> termStructureHandle_
protected

Definition at line 86 of file averageoisratehelper.hpp.

◆ discountHandle_

Handle<YieldTermStructure> discountHandle_
protected

Definition at line 87 of file averageoisratehelper.hpp.

◆ discountRelinkableHandle_

RelinkableHandle<YieldTermStructure> discountRelinkableHandle_
protected

Definition at line 88 of file averageoisratehelper.hpp.

◆ telescopicValueDates_

bool telescopicValueDates_
protected

Definition at line 89 of file averageoisratehelper.hpp.