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

#include <qle/termstructures/brlcdiratehelper.hpp>

+ Inheritance diagram for BRLCdiRateHelper:
+ Collaboration diagram for BRLCdiRateHelper:

Public Member Functions

 BRLCdiRateHelper (const QuantLib::Period &swapTenor, const QuantLib::Handle< QuantLib::Quote > &fixedRate, const QuantLib::ext::shared_ptr< BRLCdi > &brlCdiIndex, const QuantLib::Handle< QuantLib::YieldTermStructure > &discountingCurve=QuantLib::Handle< QuantLib::YieldTermStructure >(), bool telescopicValueDates=false)
 
inspectors
QuantLib::ext::shared_ptr< BRLCdiSwapswap () const
 
RateHelper interface
QuantLib::Real impliedQuote () const override
 
void setTermStructure (QuantLib::YieldTermStructure *) override
 

Visitability

QuantLib::Period swapTenor_
 
QuantLib::ext::shared_ptr< BRLCdibrlCdiIndex_
 
QuantLib::ext::shared_ptr< BRLCdiSwapswap_
 
bool telescopicValueDates_
 
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > termStructureHandle_
 
QuantLib::Handle< QuantLib::YieldTermStructure > discountHandle_
 
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > discountRelinkableHandle_
 
void accept (QuantLib::AcyclicVisitor &) override
 
void initializeDates () override
 

Detailed Description

Tenor based rate helper for bootstrapping using standard BRL CDI swaps

Definition at line 36 of file brlcdiratehelper.hpp.

Constructor & Destructor Documentation

◆ BRLCdiRateHelper()

BRLCdiRateHelper ( const QuantLib::Period &  swapTenor,
const QuantLib::Handle< QuantLib::Quote > &  fixedRate,
const QuantLib::ext::shared_ptr< BRLCdi > &  brlCdiIndex,
const QuantLib::Handle< QuantLib::YieldTermStructure > &  discountingCurve = QuantLib::Handle<QuantLib::YieldTermStructure>(),
bool  telescopicValueDates = false 
)

Definition at line 28 of file brlcdiratehelper.cpp.

31 : RelativeDateRateHelper(fixedRate), swapTenor_(swapTenor), brlCdiIndex_(brlCdiIndex),
32 telescopicValueDates_(telescopicValueDates), discountHandle_(discountingCurve) {
33
34 bool onIndexHasCurve = !brlCdiIndex_->forwardingTermStructure().empty();
35 bool haveDiscountCurve = !discountHandle_.empty();
36 QL_REQUIRE(!(onIndexHasCurve && haveDiscountCurve), "Have both curves nothing to solve for.");
37
38 if (!onIndexHasCurve) {
39 QuantLib::ext::shared_ptr<IborIndex> clonedIborIndex(brlCdiIndex_->clone(termStructureHandle_));
40 brlCdiIndex_ = QuantLib::ext::dynamic_pointer_cast<BRLCdi>(clonedIborIndex);
41 brlCdiIndex_->unregisterWith(termStructureHandle_);
42 }
43
44 registerWith(brlCdiIndex_);
45 registerWith(discountHandle_);
47}
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > termStructureHandle_
QuantLib::ext::shared_ptr< BRLCdi > brlCdiIndex_
QuantLib::Handle< QuantLib::YieldTermStructure > discountHandle_
RelativeDateBootstrapHelper< YieldTermStructure > RelativeDateRateHelper
+ Here is the call graph for this function:

Member Function Documentation

◆ swap()

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

Definition at line 46 of file brlcdiratehelper.hpp.

46{ return swap_; }
QuantLib::ext::shared_ptr< BRLCdiSwap > swap_

◆ impliedQuote()

Real impliedQuote ( ) const
override

Definition at line 91 of file brlcdiratehelper.cpp.

91 {
92 QL_REQUIRE(termStructure_ != 0, "BRLCdiRateHelper's term structure not set");
93 swap_->deepUpdate();
94 return swap_->fairRate();
95}

◆ setTermStructure()

void setTermStructure ( QuantLib::YieldTermStructure *  t)
override

Definition at line 77 of file brlcdiratehelper.cpp.

77 {
78
79 bool observer = false;
80 QuantLib::ext::shared_ptr<YieldTermStructure> temp(t, null_deleter());
81 termStructureHandle_.linkTo(temp, observer);
82
83 if (discountHandle_.empty())
84 discountRelinkableHandle_.linkTo(temp, observer);
85 else
87
88 RelativeDateRateHelper::setTermStructure(t);
89}
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > discountRelinkableHandle_

◆ accept()

void accept ( QuantLib::AcyclicVisitor &  )
override

Definition at line 97 of file brlcdiratehelper.cpp.

97 {
98 if (Visitor<BRLCdiRateHelper>* v1 = dynamic_cast<Visitor<BRLCdiRateHelper>*>(&v))
99 v1->visit(*this);
100 else
101 RateHelper::accept(v);
102}

◆ initializeDates()

void initializeDates ( )
overrideprotected

Definition at line 49 of file brlcdiratehelper.cpp.

49 {
50
51 // Use the overnight index's calendar for all business day adjustments
52 Calendar calendar = brlCdiIndex_->fixingCalendar();
53
54 // Adjust reference date to next good business day if necessary
55 Date referenceDate = Settings::instance().evaluationDate();
56 referenceDate = calendar.adjust(referenceDate);
57
58 // Determine the start date
59 Date startDate = calendar.advance(referenceDate, 2 * Days);
60 startDate = calendar.adjust(startDate, Following);
61
62 // Determine the end date
63 Date endDate = startDate + swapTenor_;
64
65 // Create the BRL CDI swap
66 swap_ = QuantLib::ext::make_shared<BRLCdiSwap>(OvernightIndexedSwap::Payer, 1.0, startDate, endDate, 0.01, brlCdiIndex_,
68
69 // Set the pricing engine
70 swap_->setPricingEngine(QuantLib::ext::make_shared<DiscountingSwapEngine>(discountRelinkableHandle_));
71
72 // Update earliest and latest dates
73 earliestDate_ = swap_->startDate();
74 latestDate_ = swap_->maturityDate();
75}
+ Here is the caller graph for this function:

Member Data Documentation

◆ swapTenor_

QuantLib::Period swapTenor_
protected

Definition at line 63 of file brlcdiratehelper.hpp.

◆ brlCdiIndex_

QuantLib::ext::shared_ptr<BRLCdi> brlCdiIndex_
protected

Definition at line 64 of file brlcdiratehelper.hpp.

◆ swap_

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

Definition at line 65 of file brlcdiratehelper.hpp.

◆ telescopicValueDates_

bool telescopicValueDates_
protected

Definition at line 66 of file brlcdiratehelper.hpp.

◆ termStructureHandle_

QuantLib::RelinkableHandle<QuantLib::YieldTermStructure> termStructureHandle_
protected

Definition at line 68 of file brlcdiratehelper.hpp.

◆ discountHandle_

QuantLib::Handle<QuantLib::YieldTermStructure> discountHandle_
protected

Definition at line 69 of file brlcdiratehelper.hpp.

◆ discountRelinkableHandle_

QuantLib::RelinkableHandle<QuantLib::YieldTermStructure> discountRelinkableHandle_
protected

Definition at line 70 of file brlcdiratehelper.hpp.