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

#include <qle/termstructures/immfraratehelper.hpp>

+ Inheritance diagram for ImmFraRateHelper:
+ Collaboration diagram for ImmFraRateHelper:

Public Member Functions

 ImmFraRateHelper (const Handle< Quote > &rate, const Size imm1, const Size imm2, const QuantLib::ext::shared_ptr< IborIndex > &iborIndex, Pillar::Choice pillar=Pillar::LastRelevantDate, Date customPillarDate=Date())
 
RateHelper interface
Real impliedQuote () const override
 
void setTermStructure (YieldTermStructure *) override
 

Visitability

Date fixingDate_
 
Size imm1_
 
Size imm2_
 
Pillar::Choice pillarChoice_
 
QuantLib::ext::shared_ptr< IborIndex > iborIndex_
 
RelinkableHandle< YieldTermStructure > termStructureHandle_
 
void accept (AcyclicVisitor &) override
 
void initializeDates () override
 

Detailed Description

Rate helper for bootstrapping over FRA rates

Definition at line 38 of file immfraratehelper.hpp.

Constructor & Destructor Documentation

◆ ImmFraRateHelper()

ImmFraRateHelper ( const Handle< Quote > &  rate,
const Size  imm1,
const Size  imm2,
const QuantLib::ext::shared_ptr< IborIndex > &  iborIndex,
Pillar::Choice  pillar = Pillar::LastRelevantDate,
Date  customPillarDate = Date() 
)

Definition at line 34 of file immfraratehelper.cpp.

37 : RelativeDateRateHelper(rate), imm1_(imm1), imm2_(imm2), pillarChoice_(pillarChoice) {
38 // take fixing into account
40 // see above
41 iborIndex_->unregisterWith(termStructureHandle_);
42 registerWith(iborIndex_);
43 pillarDate_ = customPillarDate;
45}
RelinkableHandle< YieldTermStructure > termStructureHandle_
QuantLib::ext::shared_ptr< IborIndex > iborIndex_
RelativeDateBootstrapHelper< YieldTermStructure > RelativeDateRateHelper
+ Here is the call graph for this function:

Member Function Documentation

◆ impliedQuote()

Real impliedQuote ( ) const
override

Definition at line 47 of file immfraratehelper.cpp.

47 {
48 QL_REQUIRE(termStructure_ != 0, "term structure not set");
49 return iborIndex_->fixing(fixingDate_, true);
50}

◆ setTermStructure()

void setTermStructure ( YieldTermStructure *  t)
override

Definition at line 52 of file immfraratehelper.cpp.

52 {
53 // do not set the relinkable handle as an observer -
54 // force recalculation when needed---the index is not lazy
55 bool observer = false;
56
57 QuantLib::ext::shared_ptr<YieldTermStructure> temp(t, null_deleter());
58 termStructureHandle_.linkTo(temp, observer);
59
60 RelativeDateRateHelper::setTermStructure(t);
61}

◆ accept()

void accept ( AcyclicVisitor &  v)
override

Definition at line 103 of file immfraratehelper.cpp.

103 {
104 Visitor<ImmFraRateHelper>* v1 = dynamic_cast<Visitor<ImmFraRateHelper>*>(&v);
105 if (v1 != 0)
106 v1->visit(*this);
107 else
108 RateHelper::accept(v);
109}

◆ initializeDates()

void initializeDates ( )
overrideprivate

Definition at line 63 of file immfraratehelper.cpp.

63 {
64 // if the evaluation date is not a business day
65 // then move to the next business day
66 Date referenceDate = iborIndex_->fixingCalendar().adjust(evaluationDate_);
67 Date spotDate = iborIndex_->fixingCalendar().advance(referenceDate, iborIndex_->fixingDays() * Days);
68
69 earliestDate_ = iborIndex_->fixingCalendar().adjust(getImmDate(spotDate, imm1_));
70 maturityDate_ = iborIndex_->fixingCalendar().adjust(getImmDate(spotDate, imm2_));
71
72 // latest relevant date is calculated from earliestDate_ instead
73 latestRelevantDate_ = iborIndex_->maturityDate(earliestDate_);
74
75 switch (pillarChoice_) {
76 case Pillar::MaturityDate:
77 pillarDate_ = maturityDate_;
78 break;
79 case Pillar::LastRelevantDate:
80 pillarDate_ = latestRelevantDate_;
81 break;
82 case Pillar::CustomDate:
83 // pillarDate_ already assigned at construction time
84 QL_REQUIRE(pillarDate_ >= earliestDate_, "pillar date (" << pillarDate_
85 << ") must be later "
86 "than or equal to the instrument's earliest date ("
87 << earliestDate_ << ")");
88 QL_REQUIRE(pillarDate_ <= latestRelevantDate_, "pillar date ("
89 << pillarDate_
90 << ") must be before "
91 "or equal to the instrument's latest relevant date ("
92 << latestRelevantDate_ << ")");
93 break;
94 default:
95 QL_FAIL("unknown Pillar::Choice(" << Integer(pillarChoice_) << ")");
96 }
97
98 latestDate_ = pillarDate_; // backward compatibility
99
100 fixingDate_ = iborIndex_->fixingDate(earliestDate_);
101}
Date getImmDate(Date asof, Size i)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ fixingDate_

Date fixingDate_
private

Definition at line 56 of file immfraratehelper.hpp.

◆ imm1_

Size imm1_
private

Definition at line 57 of file immfraratehelper.hpp.

◆ imm2_

Size imm2_
private

Definition at line 57 of file immfraratehelper.hpp.

◆ pillarChoice_

Pillar::Choice pillarChoice_
private

Definition at line 58 of file immfraratehelper.hpp.

◆ iborIndex_

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

Definition at line 59 of file immfraratehelper.hpp.

◆ termStructureHandle_

RelinkableHandle<YieldTermStructure> termStructureHandle_
private

Definition at line 60 of file immfraratehelper.hpp.