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

Base class for cash flows. More...

#include <ql/cashflow.hpp>

Inheritance diagram for CashFlow:

Public Member Functions

Event interface
Date date () const override=0
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
LazyObject interface
void performCalculations () const override
CashFlow interface
virtual Real amount () const =0
 returns the amount of the cash flow
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
Visitability
void accept (AcyclicVisitor &) override
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 ()

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

Base class for cash flows.

This class is purely virtual and acts as a base class for the actual cash flow implementations.

Member Function Documentation

◆ date()

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

Implements Event.

Implemented in Coupon, Dividend, IndexedCashFlow, and SimpleCashFlow.

◆ hasOccurred()

bool hasOccurred ( const Date & refDate = Date(),
ext::optional< bool > includeRefDate = ext::nullopt ) const
overridevirtual

returns true if an event has already occurred before a date

overloads Event::hasOccurred in order to take Settings::includeTodaysCashflows in account

Reimplemented from Event.

◆ performCalculations()

void performCalculations ( ) const
overridevirtual

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

Implements LazyObject.

Reimplemented in DigitalCoupon, FixedRateCoupon, FloatingRateCoupon, IndexedCashFlow, and InflationCoupon.

◆ amount()

virtual Real amount ( ) const
pure virtual

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.

Implemented in Dividend, FixedDividend, FixedRateCoupon, FloatingRateCoupon, FractionalDividend, IndexedCashFlow, InflationCoupon, and SimpleCashFlow.

◆ exCouponDate()

virtual Date exCouponDate ( ) const
virtual

returns the date that the cash flow trades exCoupon

Reimplemented in Coupon.

◆ accept()

void accept ( AcyclicVisitor & )
overridevirtual

Reimplemented from Event.