QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.40
Loading...
Searching...
No Matches
IndexedCashFlow Class Reference

Cash flow dependent on an index ratio. More...

#include <ql/cashflows/indexedcashflow.hpp>

Inheritance diagram for IndexedCashFlow:

Public Member Functions

 IndexedCashFlow (Real notional, ext::shared_ptr< Index > index, const Date &baseDate, const Date &fixingDate, const Date &paymentDate, bool growthOnly=false)
Event interface
Date date () const override
virtual Real notional () const
virtual Date baseDate () const
virtual Date fixingDate () const
virtual ext::shared_ptr< Indexindex () const
virtual bool growthOnly () const
virtual Real baseFixing () const
virtual Real indexFixing () const
CashFlow interface
Real amount () const override
 returns the amount of the cash flow
Visitability
void accept (AcyclicVisitor &) override
Public Member Functions inherited from CashFlow
bool hasOccurred (const Date &refDate=Date(), ext::optional< bool > includeRefDate=ext::nullopt) const override
 returns true if an event has already occurred before a date
virtual Date exCouponDate () const
 returns the date that the cash flow trades exCoupon
bool tradingExCoupon (const Date &refDate=Date()) const
 returns true if the cashflow is trading ex-coupon on the refDate
Public Member Functions inherited from Event
Public Member Functions inherited from Observable
 Observable (const Observable &)
Observableoperator= (const Observable &)
 Observable (Observable &&)=delete
Observableoperator= (Observable &&)=delete
void notifyObservers ()
Public Member Functions inherited from LazyObject
void update () override
bool isCalculated () const
void forwardFirstNotificationOnly ()
void alwaysForwardNotifications ()
void recalculate ()
void freeze ()
void unfreeze ()
Public Member Functions inherited from Observer
 Observer (const Observer &)
Observeroperator= (const Observer &)
std::pair< iterator, bool > registerWith (const ext::shared_ptr< Observable > &)
void registerWithObservables (const ext::shared_ptr< Observer > &)
Size unregisterWith (const ext::shared_ptr< Observable > &)
void unregisterWithAll ()
virtual void deepUpdate ()

LazyObject interface

Real amount_
void performCalculations () const override

Additional Inherited Members

Public Types inherited from Observer
typedef set_type::iterator iterator
virtual void calculate () const
bool calculated_ = false
bool frozen_ = false
bool alwaysForward_

Detailed Description

Cash flow dependent on an index ratio.

This cash flow is not a coupon, i.e., there's no accrual. The amount is either i(T)/i(0) or i(T)/i(0) - 1, depending on the growthOnly parameter.

We expect this to be used inside an instrument that does all the date adjustment etc., so this takes just dates and does not change them. growthOnly = false means i(T)/i(0), which is a bond-type setting. growthOnly = true means i(T)/i(0) - 1, which is a swap-type setting.

Member Function Documentation

◆ date()

Date date ( ) const
overridevirtual
Note
This is inherited from the event class

Implements CashFlow.

◆ baseDate()

virtual Date baseDate ( ) const
virtual

Reimplemented in CPICashFlow.

◆ baseFixing()

virtual Real baseFixing ( ) const
virtual

Reimplemented in CPICashFlow.

◆ amount()

Real amount ( ) const
overridevirtual

returns the amount of the cash flow

Note
The amount is not discounted, i.e., it is the actual amount paid at the cash flow date.

Implements CashFlow.

◆ accept()

void accept ( AcyclicVisitor & v)
overridevirtual

Reimplemented from CashFlow.

◆ performCalculations()

void performCalculations ( ) const
overridevirtual

This method must implement any calculations which must be (re)done in order to calculate the desired results.

Reimplemented from CashFlow.