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

#include <qle/cashflows/durationadjustedcmscoupon.hpp>

+ Inheritance diagram for DurationAdjustedCmsCoupon:
+ Collaboration diagram for DurationAdjustedCmsCoupon:

Public Member Functions

 DurationAdjustedCmsCoupon (const Date &paymentDate, Real nominal, const Date &startDate, const Date &endDate, Natural fixingDays, const QuantLib::ext::shared_ptr< SwapIndex > &index, Size duration=0, Real gearing=1.0, Spread spread=0.0, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date(), const DayCounter &dayCounter=DayCounter(), bool isInArrears=false, const Date &exCouponDate=Date())
 
const QuantLib::ext::shared_ptr< SwapIndex > & swapIndex () const
 
Size duration () const
 
Real durationAdjustment () const
 
Rate indexFixing () const override
 
void accept (AcyclicVisitor &) override
 

Private Attributes

QuantLib::ext::shared_ptr< SwapIndex > swapIndex_
 
Size duration_
 

Detailed Description

Definition at line 34 of file durationadjustedcmscoupon.hpp.

Constructor & Destructor Documentation

◆ DurationAdjustedCmsCoupon()

DurationAdjustedCmsCoupon ( const Date &  paymentDate,
Real  nominal,
const Date &  startDate,
const Date &  endDate,
Natural  fixingDays,
const QuantLib::ext::shared_ptr< SwapIndex > &  index,
Size  duration = 0,
Real  gearing = 1.0,
Spread  spread = 0.0,
const Date &  refPeriodStart = Date(),
const Date &  refPeriodEnd = Date(),
const DayCounter &  dayCounter = DayCounter(),
bool  isInArrears = false,
const Date &  exCouponDate = Date() 
)

Definition at line 27 of file durationadjustedcmscoupon.cpp.

33 : FloatingRateCoupon(paymentDate, nominal, startDate, endDate, fixingDays, swapIndex, gearing, spread,
34 refPeriodStart, refPeriodEnd, dayCounter, isInArrears, exCouponDate),
const QuantLib::ext::shared_ptr< SwapIndex > & swapIndex() const
QuantLib::ext::shared_ptr< SwapIndex > swapIndex_

Member Function Documentation

◆ swapIndex()

const QuantLib::ext::shared_ptr< SwapIndex > & swapIndex ( ) const

Definition at line 44 of file durationadjustedcmscoupon.hpp.

44{ return swapIndex_; }
+ Here is the caller graph for this function:

◆ duration()

Size duration ( ) const

Definition at line 37 of file durationadjustedcmscoupon.cpp.

37{ return duration_; }
+ Here is the caller graph for this function:

◆ durationAdjustment()

Real durationAdjustment ( ) const

Definition at line 38 of file durationadjustedcmscoupon.cpp.

38 {
39 if (duration_ == 0) {
40 return 1.0;
41 } else {
42 Real swapRate = swapIndex_->fixing(fixingDate());
43 Real tmp = 0.0;
44 for (Size i = 0; i < duration_; ++i) {
45 tmp += 1.0 / std::pow(1.0 + swapRate, static_cast<Real>(i + 1));
46 }
47 return tmp;
48 }
49}
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:

◆ indexFixing()

Rate indexFixing ( ) const
override

Definition at line 51 of file durationadjustedcmscoupon.cpp.

51{ return FloatingRateCoupon::indexFixing() * durationAdjustment(); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ accept()

void accept ( AcyclicVisitor &  v)
override

Definition at line 53 of file durationadjustedcmscoupon.cpp.

53 {
54 Visitor<DurationAdjustedCmsCoupon>* v1 = dynamic_cast<Visitor<DurationAdjustedCmsCoupon>*>(&v);
55 if (v1 != 0)
56 v1->visit(*this);
57 else
58 FloatingRateCoupon::accept(v);
59}

Member Data Documentation

◆ swapIndex_

QuantLib::ext::shared_ptr<SwapIndex> swapIndex_
private

Definition at line 51 of file durationadjustedcmscoupon.hpp.

◆ duration_

Size duration_
private

Definition at line 52 of file durationadjustedcmscoupon.hpp.