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

#include <qle/indexes/bmaindexwrapper.hpp>

+ Inheritance diagram for BMAIndexWrapper:
+ Collaboration diagram for BMAIndexWrapper:

Public Member Functions

 BMAIndexWrapper (const QuantLib::ext::shared_ptr< QuantLib::BMAIndex > &bma)
 
 BMAIndexWrapper (const QuantLib::ext::shared_ptr< QuantLib::BMAIndex > &bma, const Handle< YieldTermStructure > &h)
 
std::string name () const override
 
bool isValidFixingDate (const Date &date) const override
 
Handle< YieldTermStructure > forwardingTermStructure () const
 
Date maturityDate (const Date &valueDate) const override
 
Schedule fixingSchedule (const Date &start, const Date &end)
 
Rate forecastFixing (const Date &fixingDate) const override
 
Date adjustedFixingDate (const Date &fixingDate) const
 
Rate pastFixing (const Date &fixingDate) const override
 
QuantLib::ext::shared_ptr< IborIndex > clone (const Handle< YieldTermStructure > &h) const override
 
QuantLib::ext::shared_ptr< QuantLib::BMAIndex > bma () const
 
 operator QuantLib::BMAIndex & ()
 
 operator QuantLib::BMAIndex * ()
 

Private Attributes

QuantLib::ext::shared_ptr< QuantLib::BMAIndex > bma_
 

Detailed Description

Wrapper that adapts the quantlib BMAIndex into a class inheriting from IborIndex The purpose of this is twofold: 1) we can use Market::iborIndex() to retrieve a BMA index 2) we can set up an IborCoupon using this index wrapper to approximate an AveragedBMACoupon at places where a pricer only supports an IborCoupon, e.g. for cap/floors or swaptions on BMA underlyings To make 2) work we tweak the implementations of isValidFixingDate(), maturityDate() and pastFixing() to make sure an Ibor coupon on this index class will behave gracefully.

Definition at line 44 of file bmaindexwrapper.hpp.

Constructor & Destructor Documentation

◆ BMAIndexWrapper() [1/2]

BMAIndexWrapper ( const QuantLib::ext::shared_ptr< QuantLib::BMAIndex > &  bma)

Definition at line 48 of file bmaindexwrapper.hpp.

49 : IborIndex(bma->name(), bma->tenor(), bma->fixingDays(), bma->currency(), bma->fixingCalendar(),
50 ModifiedFollowing, false, bma->dayCounter(), bma->forwardingTermStructure()),
51 bma_(bma) {}
QuantLib::ext::shared_ptr< QuantLib::BMAIndex > bma() const
QuantLib::ext::shared_ptr< QuantLib::BMAIndex > bma_

◆ BMAIndexWrapper() [2/2]

BMAIndexWrapper ( const QuantLib::ext::shared_ptr< QuantLib::BMAIndex > &  bma,
const Handle< YieldTermStructure > &  h 
)

Definition at line 53 of file bmaindexwrapper.hpp.

54 : IborIndex(bma->name(), bma->tenor(), bma->fixingDays(), bma->currency(), bma->fixingCalendar(),
55 ModifiedFollowing, false, bma->dayCounter(), h),
56 bma_(new BMAIndex(h)) {}

Member Function Documentation

◆ name()

std::string name ( ) const
override

Definition at line 59 of file bmaindexwrapper.hpp.

59{ return bma_->name(); }
+ Here is the caller graph for this function:

◆ isValidFixingDate()

bool isValidFixingDate ( const Date &  date) const
override

Definition at line 60 of file bmaindexwrapper.hpp.

60 {
61 // this is not the original BMA behaviour!
62 return fixingCalendar().isBusinessDay(date);
63 }

◆ forwardingTermStructure()

Handle< YieldTermStructure > forwardingTermStructure ( ) const

Definition at line 64 of file bmaindexwrapper.hpp.

64{ return bma_->forwardingTermStructure(); }

◆ maturityDate()

Date maturityDate ( const Date &  valueDate) const
override

Definition at line 65 of file bmaindexwrapper.hpp.

65 {
66 Date d = bma_->maturityDate(valueDate);
67 // make sure that d > valueDate to avoid problems in IborCoupon, this is not the original
68 // BMAIndex behaviour!
69 return std::max<Date>(d, valueDate + 1);
70 }
+ Here is the caller graph for this function:

◆ fixingSchedule()

Schedule fixingSchedule ( const Date &  start,
const Date &  end 
)

Definition at line 71 of file bmaindexwrapper.hpp.

71{ return bma_->fixingSchedule(start, end); }

◆ forecastFixing()

Rate forecastFixing ( const Date &  fixingDate) const
override

Definition at line 72 of file bmaindexwrapper.hpp.

72 {
73 QL_REQUIRE(!termStructure_.empty(), "null term structure set to this instance of " << name());
74 Date start = fixingCalendar().advance(fixingDate, 1, Days);
75 Date end = maturityDate(start);
76 return termStructure_->forwardRate(start, end, dayCounter_, Simple);
77 }
Date maturityDate(const Date &valueDate) const override
std::string name() const override
+ Here is the call graph for this function:

◆ adjustedFixingDate()

Date adjustedFixingDate ( const Date &  fixingDate) const

Definition at line 79 of file bmaindexwrapper.hpp.

79 {
80 Date tmp = fixingDate;
81 while (!bma_->isValidFixingDate(tmp) && tmp > Date::minDate())
82 tmp--;
83 return tmp;
84 }
QuantLib::Date fixingDate(const QuantLib::Date &d, const QuantLib::Period obsLag, const QuantLib::Frequency freq, bool interpolated)
Definition: inflation.cpp:183
+ Here is the caller graph for this function:

◆ pastFixing()

Rate pastFixing ( const Date &  fixingDate) const
override

Definition at line 85 of file bmaindexwrapper.hpp.

85 {
86 // we allow for fixing dates that are not valid BMA fixing dates, so we need to make sure that we
87 // read a past fixing from a valid BMA fixing date
88 return bma_->fixing(adjustedFixingDate(fixingDate));
89 }
Date adjustedFixingDate(const Date &fixingDate) const
+ Here is the call graph for this function:

◆ clone()

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

Definition at line 90 of file bmaindexwrapper.hpp.

90 {
91 return QuantLib::ext::shared_ptr<BMAIndexWrapper>(new BMAIndexWrapper(bma(), h));
92 }
BMAIndexWrapper(const QuantLib::ext::shared_ptr< QuantLib::BMAIndex > &bma)
+ Here is the call graph for this function:

◆ bma()

QuantLib::ext::shared_ptr< QuantLib::BMAIndex > bma ( ) const

Definition at line 95 of file bmaindexwrapper.hpp.

95{ return bma_; }
+ Here is the caller graph for this function:

◆ operator QuantLib::BMAIndex &()

operator QuantLib::BMAIndex & ( )

Definition at line 97 of file bmaindexwrapper.hpp.

97{ return *bma_; }

◆ operator QuantLib::BMAIndex *()

operator QuantLib::BMAIndex * ( )

Definition at line 98 of file bmaindexwrapper.hpp.

98{ return &*bma_; }

Member Data Documentation

◆ bma_

QuantLib::ext::shared_ptr<QuantLib::BMAIndex> bma_
private

Definition at line 101 of file bmaindexwrapper.hpp.