# previousCouponRate (3) - Linux Manuals

## previousCouponRate: cashflow-analysis functions

## NAME

QuantLib::CashFlows - cashflow-analysis functions

## SYNOPSIS

#include <ql/cashflows/cashflows.hpp>

### Static Public Member Functions

static Leg::const_iterator **previousCashFlow** (const Leg &leg, **Date** refDate=**Date**())

static Leg::const_iterator **nextCashFlow** (const Leg &leg, **Date** refDate=**Date**())

static **Rate** **previousCouponRate** (const Leg &leg, const **Date** &refDate=**Date**())

static **Rate** **nextCouponRate** (const Leg &leg, const **Date** &refDate=**Date**())

static **Date** **startDate** (const Leg &leg)

static **Date** **maturityDate** (const Leg &leg)

static **Real** **npv** (const Leg &leg, const **YieldTermStructure** &discountCurve, **Date** settlementDate=**Date**(), const **Date** &npvDate=**Date**(), **Natural** exDividendDays=0)

*NPV of the cash flows. *

static **Real** **npv** (const Leg &leg, const **InterestRate** &, **Date** settlementDate=**Date**())

*NPV of the cash flows. *

static **Real** **bps** (const Leg &leg, const **YieldTermStructure** &discountCurve, **Date** settlementDate=**Date**(), const **Date** &npvDate=**Date**(), **Natural** exDividendDays=0)

*Basis-point sensitivity of the cash flows. *

static **Real** **bps** (const Leg &leg, const **InterestRate** &, **Date** settlementDate=**Date**())

*Basis-point sensitivity of the cash flows. *

static **Rate** **atmRate** (const Leg &leg, const **YieldTermStructure** &discountCurve, const **Date** &settlementDate=**Date**(), const **Date** &npvDate=**Date**(), **Natural** exDividendDays=0, **Real** npv=**Null**< **Real** >())

*At-the-money rate of the cash flows. *

static **Rate** **irr** (const Leg &leg, **Real** marketPrice, const **DayCounter** &dayCounter, Compounding compounding, **Frequency** frequency=NoFrequency, **Date** settlementDate=**Date**(), **Real** accuracy=1.0e-10, Size maxIterations=100, Rate guess=0.05)

*Internal rate of return. *

static **Time** **duration** (const Leg &leg, const **InterestRate** &y, Duration::Type type=Duration::Modified, **Date** settlementDate=**Date**())

*Cash-flow duration. *

static **Real** **convexity** (const Leg &leg, const **InterestRate** &y, **Date** settlementDate=**Date**())

*Cash-flow convexity. *

static **Real** **basisPointValue** (const Leg &leg, const **InterestRate** &y, **Date** settlementDate=**Date**())

*Basis-point value. *

static **Real** **yieldValueBasisPoint** (const Leg &leg, const **InterestRate** &y, **Date** settlementDate=**Date**())

*Yield value of a basis point. *

## Detailed Description

cashflow-analysis functions

**Possible enhancements**

- add tests

## Member Function Documentation

### static **Real** npv (const Leg & leg, const **YieldTermStructure** & discountCurve, **Date** settlementDate = **Date**(), const **Date** & npvDate = **Date**(), **Natural** exDividendDays = 0) [static]

NPV of the cash flows.

The NPV is the sum of the cash flows, each discounted according to the given term structure.

### static **Real** npv (const Leg & leg, const **InterestRate** &, **Date** settlementDate = **Date**()) [static]

NPV of the cash flows.

The NPV is the sum of the cash flows, each discounted according to the given constant interest rate. The result is affected by the choice of the interest-rate compounding and the relative frequency and day counter.

### static **Real** bps (const Leg & leg, const **YieldTermStructure** & discountCurve, **Date** settlementDate = **Date**(), const **Date** & npvDate = **Date**(), **Natural** exDividendDays = 0) [static]

Basis-point sensitivity of the cash flows.

The result is the change in NPV due to a uniform 1-basis-point change in the rate paid by the cash flows. The change for each coupon is discounted according to the given term structure.

### static **Real** bps (const Leg & leg, const **InterestRate** &, **Date** settlementDate = **Date**()) [static]

Basis-point sensitivity of the cash flows.

The result is the change in NPV due to a uniform 1-basis-point change in the rate paid by the cash flows. The change for each coupon is discounted according to the given constant interest rate. The result is affected by the choice of the interest-rate compounding and the relative frequency and day counter.

### static **Rate** atmRate (const Leg & leg, const **YieldTermStructure** & discountCurve, const **Date** & settlementDate = **Date**(), const **Date** & npvDate = **Date**(), **Natural** exDividendDays = 0, **Real** npv = **Null**< **Real** >()) [static]

At-the-money rate of the cash flows.

The result is the fixed rate for which a fixed rate cash flow vector, equivalent to the input vector, has the required NPV according to the given term structure. If the required NPV is not given, the input cash flow vector's NPV is used instead.

### static **Rate** irr (const Leg & leg, **Real** marketPrice, const **DayCounter** & dayCounter, Compounding compounding, **Frequency** frequency = NoFrequency, **Date** settlementDate = **Date**(), **Real** accuracy = 1.0e-10, Size maxIterations = 100, **Rate** guess = 0.05) [static]

Internal rate of return.

The IRR is the interest rate at which the NPV of the cash flows equals the given market price. The function verifies the theoretical existance of an IRR and numerically establishes the IRR to the desired precision.

### static **Time** duration (const Leg & leg, const **InterestRate** & y, Duration::Type type = Duration::Modified, **Date** settlementDate = **Date**()) [static]

Cash-flow duration.

The simple duration of a string of cash flows is defined as [ D_{mathrm{simple}} = ac{um t_i c_i B(t_i)}{um c_i B(t_i)} ] where $ c_i $ is the amount of the $ i $-th cash flow, $ t_i $ is its payment time, and $ B(t_i) $ is the corresponding discount according to the passed yield.

The modified duration is defined as [ D_{mathrm{modified}} = -ac{1}{P} ac{

artial P}{

artial y} ] where $ P $ is the present value of the cash flows according to the given IRR $ y $.

The Macaulay duration is defined for a compounded IRR as [ D_{mathrm{Macaulay}} =

d}} ] where $ y $ is the IRR and $ N $ is the number of cash flows per year.

### static **Real** convexity (const Leg & leg, const **InterestRate** & y, **Date** settlementDate = **Date**()) [static]

Cash-flow convexity.

The convexity of a string of cash flows is defined as [ C = ac{1}{P} ac{

artial^2 P}{

artial y^2} ] where $ P $ is the present value of the cash flows according to the given IRR $ y $.

### static **Real** basisPointValue (const Leg & leg, const **InterestRate** & y, **Date** settlementDate = **Date**()) [static]

Basis-point value.

Obtained by setting dy = 0.0001 in the 2nd-order Taylor series expansion.

### static **Real** yieldValueBasisPoint (const Leg & leg, const **InterestRate** & y, **Date** settlementDate = **Date**()) [static]

Yield value of a basis point.

The yield value of a one basis point change in price is the derivative of the yield with respect to the price multiplied by 0.01

## Author

Generated automatically by Doxygen for QuantLib from the source code.