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

helper class building a sequence of capped/floored cmb coupons More...

#include <qle/cashflows/cmbcoupon.hpp>

+ Collaboration diagram for CmbLeg:

Public Member Functions

 CmbLeg (Schedule schedule, std::vector< ext::shared_ptr< ConstantMaturityBondIndex > > bondIndices)
 
CmbLegwithNotionals (Real notional)
 
CmbLegwithNotionals (const std::vector< Real > &notionals)
 
CmbLegwithPaymentDayCounter (const DayCounter &)
 
CmbLegwithPaymentCalendar (const Calendar &cal)
 
CmbLegwithPaymentAdjustment (BusinessDayConvention)
 
CmbLegwithFixingDays (Natural fixingDays)
 
CmbLegwithFixingDays (const std::vector< Natural > &fixingDays)
 
CmbLegwithGearings (Real gearing)
 
CmbLegwithGearings (const std::vector< Real > &gearings)
 
CmbLegwithSpreads (Spread spread)
 
CmbLegwithSpreads (const std::vector< Spread > &spreads)
 
CmbLegwithCaps (Rate cap)
 
CmbLegwithCaps (const std::vector< Rate > &caps)
 
CmbLegwithFloors (Rate floor)
 
CmbLegwithFloors (const std::vector< Rate > &floors)
 
CmbLeginArrears (bool flag=true)
 
CmbLegwithZeroPayments (bool flag=true)
 
CmbLegwithExCouponPeriod (const Period &, const Calendar &, BusinessDayConvention, bool endOfMonth)
 
 operator Leg () const
 

Private Attributes

Schedule schedule_
 
std::vector< ext::shared_ptr< ConstantMaturityBondIndex > > bondIndices_
 
std::vector< Real > notionals_
 
DayCounter paymentDayCounter_
 
BusinessDayConvention paymentAdjustment_
 
Calendar paymentCalendar_
 
std::vector< Natural > fixingDays_
 
std::vector< Real > gearings_
 
std::vector< Spread > spreads_
 
std::vector< Rate > caps_
 
std::vector< Rate > floors_
 
bool inArrears_
 
bool zeroPayments_
 
Period exCouponPeriod_
 
Calendar exCouponCalendar_
 
BusinessDayConvention exCouponAdjustment_
 
bool exCouponEndOfMonth_
 

Detailed Description

helper class building a sequence of capped/floored cmb coupons

Definition at line 87 of file cmbcoupon.hpp.

Constructor & Destructor Documentation

◆ CmbLeg()

CmbLeg ( Schedule  schedule,
std::vector< ext::shared_ptr< ConstantMaturityBondIndex > >  bondIndices 
)

Definition at line 92 of file cmbcoupon.cpp.

93 : schedule_(std::move(schedule)), bondIndices_(bondIndices),
94 paymentAdjustment_(Following), inArrears_(false), zeroPayments_(false) {
95 QL_REQUIRE(bondIndices_.size() == schedule_.size() - 1, "vector size mismatch between schedule ("
96 << schedule_.size() << ") and bond indices ("
97 << bondIndices_.size() << ")");
98}
Schedule schedule_
Definition: cmbcoupon.hpp:113
BusinessDayConvention paymentAdjustment_
Definition: cmbcoupon.hpp:117
std::vector< ext::shared_ptr< ConstantMaturityBondIndex > > bondIndices_
Definition: cmbcoupon.hpp:114

Member Function Documentation

◆ withNotionals() [1/2]

CmbLeg & withNotionals ( Real  notional)

Definition at line 100 of file cmbcoupon.cpp.

100 {
101 notionals_ = std::vector<Real>(1, notional);
102 return *this;
103}
std::vector< Real > notionals_
Definition: cmbcoupon.hpp:115

◆ withNotionals() [2/2]

CmbLeg & withNotionals ( const std::vector< Real > &  notionals)

Definition at line 105 of file cmbcoupon.cpp.

105 {
106 notionals_ = notionals;
107 return *this;
108}

◆ withPaymentDayCounter()

CmbLeg & withPaymentDayCounter ( const DayCounter &  dayCounter)

Definition at line 110 of file cmbcoupon.cpp.

110 {
111 paymentDayCounter_ = dayCounter;
112 return *this;
113}
DayCounter paymentDayCounter_
Definition: cmbcoupon.hpp:116

◆ withPaymentCalendar()

CmbLeg & withPaymentCalendar ( const Calendar &  cal)

Definition at line 180 of file cmbcoupon.cpp.

180 {
181 paymentCalendar_ = cal;
182 return *this;
183}
Calendar paymentCalendar_
Definition: cmbcoupon.hpp:118

◆ withPaymentAdjustment()

CmbLeg & withPaymentAdjustment ( BusinessDayConvention  convention)

Definition at line 115 of file cmbcoupon.cpp.

115 {
116 paymentAdjustment_ = convention;
117 return *this;
118}

◆ withFixingDays() [1/2]

CmbLeg & withFixingDays ( Natural  fixingDays)

Definition at line 120 of file cmbcoupon.cpp.

120 {
121 fixingDays_ = std::vector<Natural>(1, fixingDays);
122 return *this;
123}
std::vector< Natural > fixingDays_
Definition: cmbcoupon.hpp:119

◆ withFixingDays() [2/2]

CmbLeg & withFixingDays ( const std::vector< Natural > &  fixingDays)

Definition at line 125 of file cmbcoupon.cpp.

125 {
126 fixingDays_ = fixingDays;
127 return *this;
128}

◆ withGearings() [1/2]

CmbLeg & withGearings ( Real  gearing)

Definition at line 130 of file cmbcoupon.cpp.

130 {
131 gearings_ = std::vector<Real>(1, gearing);
132 return *this;
133}
std::vector< Real > gearings_
Definition: cmbcoupon.hpp:120

◆ withGearings() [2/2]

CmbLeg & withGearings ( const std::vector< Real > &  gearings)

Definition at line 135 of file cmbcoupon.cpp.

135 {
136 gearings_ = gearings;
137 return *this;
138}

◆ withSpreads() [1/2]

CmbLeg & withSpreads ( Spread  spread)

Definition at line 140 of file cmbcoupon.cpp.

140 {
141 spreads_ = std::vector<Spread>(1, spread);
142 return *this;
143}
std::vector< Spread > spreads_
Definition: cmbcoupon.hpp:121

◆ withSpreads() [2/2]

CmbLeg & withSpreads ( const std::vector< Spread > &  spreads)

Definition at line 145 of file cmbcoupon.cpp.

145 {
146 spreads_ = spreads;
147 return *this;
148}

◆ withCaps() [1/2]

CmbLeg & withCaps ( Rate  cap)

Definition at line 150 of file cmbcoupon.cpp.

150 {
151 caps_ = std::vector<Rate>(1, cap);
152 return *this;
153}
std::vector< Rate > caps_
Definition: cmbcoupon.hpp:122

◆ withCaps() [2/2]

CmbLeg & withCaps ( const std::vector< Rate > &  caps)

Definition at line 155 of file cmbcoupon.cpp.

155 {
156 caps_ = caps;
157 return *this;
158}

◆ withFloors() [1/2]

CmbLeg & withFloors ( Rate  floor)

Definition at line 160 of file cmbcoupon.cpp.

160 {
161 floors_ = std::vector<Rate>(1, floor);
162 return *this;
163}
std::vector< Rate > floors_
Definition: cmbcoupon.hpp:122

◆ withFloors() [2/2]

CmbLeg & withFloors ( const std::vector< Rate > &  floors)

Definition at line 165 of file cmbcoupon.cpp.

165 {
166 floors_ = floors;
167 return *this;
168}

◆ inArrears()

CmbLeg & inArrears ( bool  flag = true)

Definition at line 170 of file cmbcoupon.cpp.

170 {
171 inArrears_ = flag;
172 return *this;
173}

◆ withZeroPayments()

CmbLeg & withZeroPayments ( bool  flag = true)

Definition at line 175 of file cmbcoupon.cpp.

175 {
176 zeroPayments_ = flag;
177 return *this;
178}

◆ withExCouponPeriod()

CmbLeg & withExCouponPeriod ( const Period &  period,
const Calendar &  cal,
BusinessDayConvention  convention,
bool  endOfMonth 
)

Definition at line 185 of file cmbcoupon.cpp.

188 {
189 exCouponPeriod_ = period;
190 exCouponCalendar_ = cal;
191 exCouponAdjustment_ = convention;
192 exCouponEndOfMonth_ = endOfMonth;
193 return *this;
194}
BusinessDayConvention exCouponAdjustment_
Definition: cmbcoupon.hpp:126
bool exCouponEndOfMonth_
Definition: cmbcoupon.hpp:127
Period exCouponPeriod_
Definition: cmbcoupon.hpp:124
Calendar exCouponCalendar_
Definition: cmbcoupon.hpp:125

◆ operator Leg()

operator Leg ( ) const

Definition at line 196 of file cmbcoupon.cpp.

196 {
197 Leg leg;
198 for (Size i = 0; i < schedule_.size() - 1; i++) {
199 Date paymentDate = paymentCalendar_.adjust(schedule_[i + 1], paymentAdjustment_);
200 QuantLib::ext::shared_ptr<CmbCoupon> coupon
201 = QuantLib::ext::make_shared<CmbCoupon>(paymentDate, notionals_[i], schedule_[i], schedule_[i + 1],
202 fixingDays_[i], bondIndices_[i], gearings_[i], spreads_[i], Date(), Date(),
204 auto pricer = QuantLib::ext::make_shared<CmbCouponPricer>();
205 coupon->setPricer(pricer);
206 leg.push_back(coupon);
207 }
208 return leg;
209}

Member Data Documentation

◆ schedule_

Schedule schedule_
private

Definition at line 113 of file cmbcoupon.hpp.

◆ bondIndices_

std::vector<ext::shared_ptr<ConstantMaturityBondIndex> > bondIndices_
private

Definition at line 114 of file cmbcoupon.hpp.

◆ notionals_

std::vector<Real> notionals_
private

Definition at line 115 of file cmbcoupon.hpp.

◆ paymentDayCounter_

DayCounter paymentDayCounter_
private

Definition at line 116 of file cmbcoupon.hpp.

◆ paymentAdjustment_

BusinessDayConvention paymentAdjustment_
private

Definition at line 117 of file cmbcoupon.hpp.

◆ paymentCalendar_

Calendar paymentCalendar_
private

Definition at line 118 of file cmbcoupon.hpp.

◆ fixingDays_

std::vector<Natural> fixingDays_
private

Definition at line 119 of file cmbcoupon.hpp.

◆ gearings_

std::vector<Real> gearings_
private

Definition at line 120 of file cmbcoupon.hpp.

◆ spreads_

std::vector<Spread> spreads_
private

Definition at line 121 of file cmbcoupon.hpp.

◆ caps_

std::vector<Rate> caps_
private

Definition at line 122 of file cmbcoupon.hpp.

◆ floors_

std::vector<Rate> floors_
private

Definition at line 122 of file cmbcoupon.hpp.

◆ inArrears_

bool inArrears_
private

Definition at line 123 of file cmbcoupon.hpp.

◆ zeroPayments_

bool zeroPayments_
private

Definition at line 123 of file cmbcoupon.hpp.

◆ exCouponPeriod_

Period exCouponPeriod_
private

Definition at line 124 of file cmbcoupon.hpp.

◆ exCouponCalendar_

Calendar exCouponCalendar_
private

Definition at line 125 of file cmbcoupon.hpp.

◆ exCouponAdjustment_

BusinessDayConvention exCouponAdjustment_
private

Definition at line 126 of file cmbcoupon.hpp.

◆ exCouponEndOfMonth_

bool exCouponEndOfMonth_
private

Definition at line 127 of file cmbcoupon.hpp.