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

BRL-CDI index. More...

#include <qle/indexes/ibor/brlcdi.hpp>

+ Inheritance diagram for BRLCdi:
+ Collaboration diagram for BRLCdi:

Public Member Functions

 BRLCdi (const QuantLib::Handle< QuantLib::YieldTermStructure > &h=QuantLib::Handle< QuantLib::YieldTermStructure >())
 
InterestRateIndex interface
QuantLib::Rate forecastFixing (const QuantLib::Date &fixingDate) const override
 
IborIndex interface
QuantLib::ext::shared_ptr< IborIndex > clone (const QuantLib::Handle< QuantLib::YieldTermStructure > &h) const override
 

Detailed Description

BRL-CDI index.

Definition at line 36 of file brlcdi.hpp.

Constructor & Destructor Documentation

◆ BRLCdi()

BRLCdi ( const QuantLib::Handle< QuantLib::YieldTermStructure > &  h = QuantLib::Handle<QuantLib::YieldTermStructure>())

Definition at line 38 of file brlcdi.hpp.

39 : QuantLib::OvernightIndex("BRL-CDI", 0, QuantLib::BRLCurrency(),
40 QuantLib::Brazil(QuantLib::Brazil::Settlement), QuantLib::Business252(), h) {}

Member Function Documentation

◆ forecastFixing()

Rate forecastFixing ( const QuantLib::Date &  fixingDate) const
override

Definition at line 26 of file brlcdi.cpp.

26 {
27
28 Date startDate = valueDate(fixingDate);
29 Date endDate = maturityDate(startDate);
30 Time dcf = dayCounter_.yearFraction(startDate, endDate);
31
32 // Some checks
33 QL_REQUIRE(dcf > 0.0, "Cannot calculate " << name() << " forward rate between " << startDate << " and " << endDate
34 << ": non positive time (" << dcf << ") using " << dayCounter_.name()
35 << " daycounter");
36
37 QL_REQUIRE(!termStructure_.empty(),
38 "Cannot calculate " << name() << " forward rate because term structure is empty");
39
40 // For BRL CDI, we want:
41 // DI(t, t_s, t_e) = \left[ \frac{P(t, t_s)}{P(t, t_e)} \right] ^ {\frac{1}{\tau(t_s, t_e)}} - 1
42 DiscountFactor discountStart = termStructure_->discount(startDate);
43 DiscountFactor discountEnd = termStructure_->discount(endDate);
44 return pow(discountStart / discountEnd, 1.0 / dcf) - 1.0;
45}
CompiledFormula pow(CompiledFormula x, const CompiledFormula &y)
+ Here is the call graph for this function:

◆ clone()

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

Definition at line 47 of file brlcdi.cpp.

47 {
48 return QuantLib::ext::make_shared<BRLCdi>(h);
49}