QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | List of all members
IndexedCashFlow Class Reference

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

#include <indexedcashflow.hpp>

+ Inheritance diagram for IndexedCashFlow:
+ Collaboration 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 More...
 
Visitability
void accept (AcyclicVisitor &) override
 
- Public Member Functions inherited from CashFlow
 ~CashFlow () override=default
 
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 More...
 
virtual Date exCouponDate () const
 returns the date that the cash flow trades exCoupon More...
 
bool tradingExCoupon (const Date &refDate=Date()) const
 returns true if the cashflow is trading ex-coupon on the refDate More...
 
- Public Member Functions inherited from Event
 ~Event () override=default
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

LazyObject interface

Real amount_
 
Real notional_
 
ext::shared_ptr< Indexindex_
 
Date baseDate_
 
Date fixingDate_
 
Date paymentDate_
 
bool growthOnly_
 
void performCalculations () const override
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from LazyObject
virtual void calculate () const
 
- Protected Attributes inherited from LazyObject
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.

Definition at line 45 of file indexedcashflow.hpp.

Constructor & Destructor Documentation

◆ IndexedCashFlow()

IndexedCashFlow ( Real  notional,
ext::shared_ptr< Index index,
const Date baseDate,
const Date fixingDate,
const Date paymentDate,
bool  growthOnly = false 
)

Definition at line 26 of file indexedcashflow.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ date()

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

Implements CashFlow.

Definition at line 55 of file indexedcashflow.hpp.

◆ notional()

virtual Real notional ( ) const
virtual

Definition at line 57 of file indexedcashflow.hpp.

+ Here is the caller graph for this function:

◆ baseDate()

virtual Date baseDate ( ) const
virtual

Reimplemented in CPICashFlow.

Definition at line 58 of file indexedcashflow.hpp.

+ Here is the caller graph for this function:

◆ fixingDate()

virtual Date fixingDate ( ) const
virtual

Definition at line 59 of file indexedcashflow.hpp.

+ Here is the caller graph for this function:

◆ index()

virtual ext::shared_ptr< Index > index ( ) const
virtual

Definition at line 60 of file indexedcashflow.hpp.

+ Here is the caller graph for this function:

◆ growthOnly()

virtual bool growthOnly ( ) const
virtual

Definition at line 61 of file indexedcashflow.hpp.

+ Here is the caller graph for this function:

◆ baseFixing()

virtual Real baseFixing ( ) const
virtual

Reimplemented in CPICashFlow.

Definition at line 62 of file indexedcashflow.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ indexFixing()

virtual Real indexFixing ( ) const
virtual

Reimplemented in CPICashFlow.

Definition at line 63 of file indexedcashflow.hpp.

+ Here is the caller graph for this function:

◆ 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.

Definition at line 38 of file indexedcashflow.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ accept()

void accept ( AcyclicVisitor v)
overridevirtual

Reimplemented from CashFlow.

Reimplemented in ZeroInflationCashFlow.

Definition at line 88 of file indexedcashflow.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

Reimplemented in ZeroInflationCashFlow.

Definition at line 43 of file indexedcashflow.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ amount_

Real amount_
mutableprotected

Definition at line 77 of file indexedcashflow.hpp.

◆ notional_

Real notional_
private

Definition at line 79 of file indexedcashflow.hpp.

◆ index_

ext::shared_ptr<Index> index_
private

Definition at line 80 of file indexedcashflow.hpp.

◆ baseDate_

Date baseDate_
private

Definition at line 81 of file indexedcashflow.hpp.

◆ fixingDate_

Date fixingDate_
private

Definition at line 81 of file indexedcashflow.hpp.

◆ paymentDate_

Date paymentDate_
private

Definition at line 81 of file indexedcashflow.hpp.

◆ growthOnly_

bool growthOnly_
private

Definition at line 82 of file indexedcashflow.hpp.