Cash Flow Analysis Overview - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Finance : Cash Flow Analysis : Cash Flow Analysis Overview

Constructing and Analyzing Cash Flows Using the Finance Package

 

Overview

Constructing Cash Flows

Performing Sensitivity Analysis

See Also

Overview

The Financial Modeling package provides a number of tools for constructing cash flows and for performing basic sensitivity analysis. Here is the list of related commands.

 

BasisPointSensitivity

-

calculate the basis point sensitivity of future cash flows

CashFlows

-

return the set of cash flows for a bond or a swap

Convexity

-

calculate the convexity of a set of cash flows

Duration

-

calculate the duration of a set of cash flows

FixedRateCoupon

-

construct a fixed-rate coupon on a term structure

InArrearIndexedCoupon

-

construct an in-arrear indexed coupon

InternalRateOfReturn

-

calculate the internal rate of return of a set of cash flows or a bond

ParCoupon

-

construct a coupon at par on a term structure

SimpleCashFlow

-

construct a simple cash flow at a given date

NetPresentValue

-

return the net present value of future cash flows

UpFrontIndexedCoupon

-

construct an up-front indexed coupon on a term structure

 

Constructing Cash Flows

First construct a simple cash flow that pays 100 on the first business day three months from now. Set the global evaluation date to November 17, 2006.

 

restart;withFinance:

SetEvaluationDateNovember 17, 2006;

December 8, 2006

(2.1)

payment_date:=AdvanceDate3,Months,NewYork,convention=Following;

payment_date:=February 20, 2007

(2.2)

cash_flow1SimpleCashFlow100,payment_date;

cash_flow1:=100. on February 20, 2007

(2.3)

Every cash flow is represented by a module with two exports: amount and date. The first one holds the amount to be paid. The second one holds the payment date.

 

cash_flow1amount;

100.

(2.4)

cash_flow1date;

date

(2.5)

evalcash_flow1date;

moduleoptionrecord;exportweekDay,monthDay,month,year,format;end module

(2.6)

FormatDatecash_flow1date;

February 20, 2007

(2.7)

 

You can calculate the net present value of this cash flow using any given discount rate.

 

NetPresentValuecash_flow1,0.03;

99.22221858

(2.8)

 

This is the value of our cash flow on November 17, 2006, which is the global evaluation date. You can use different dates by using appropriate term structures or by specifying the reference date explicitly.

 

NetPresentValuecash_flow1,0.03,referencedate=January 18, 2006;

96.78169326

(2.9)

 

You can also construct cash flows that represent fixed- and floating-rate coupon payments.

 

accrual_start_date:=AdvanceDate7,Months;

accrual_start_date:=June 17, 2007

(2.10)

accrual_end_date:=AdvanceDateaccrual_start_date,3,Months;

accrual_end_date:=September 17, 2007

(2.11)

cash_flow2:=FixedRateCoupon100,0.03,accrual_start_date,accrual_end_date;

cash_flow2:=.7561643836 on September 17, 2007

(2.12)

cash_flow2amount;

0.756164383561643838

(2.13)

FormatDatecash_flow2date;

September 17, 2007

(2.14)

NetPresentValuecash_flow2,0.05;

0.7253214642

(2.15)

 

Next construct a floating-rate coupon payment.

 

R:=BenchmarkRate1,Months,CADLIBOR,0.05;

R:=moduleend module

(2.16)

r:=SquareRootDiffusion0.045,0.05,0.2,0.03;

r:=_X

(2.17)

A:=SamplePathrt,t=0..5,timesteps=100;

PathPlotA,axes=BOXED,gridlines=true,thickness=3;

start_history:=AdvanceDate101,Days;

start_history:=August 8, 2006

(2.18)

LoadHistoryR,start_history,A;

RSeptember 15, 2006;

0.05804387158

(2.19)

RJanuary 10, 2007;

0.04941992695

(2.20)

RNovember 7, 2007;

0.04941992695

(2.21)

cash_flow3:=InArrearIndexedCoupon100,R,start_history,AdvanceDatestart_history,2,Years;

cash_flow3:=10.00751462 on August 8, 2008

(2.22)

NetPresentValuecash_flow3,0.05;

9.180826599

(2.23)

NetPresentValuecash_flow1,cash_flow2,cash_flow3,0.05;

108.6132094

(2.24)

Performing Sensitivity Analysis

Consider the set of cash flows defined previously.

 

cash_flows:=cash_flow1,cash_flow2,cash_flow3;

cash_flows:=cash_flow1,cash_flow2,cash_flow3

(3.1)

 

You can calculate the convexity of our set of cash flows using the 5% and the 4% rate.

 

Convexitycash_flows,0.05;

0.3175386474

(3.2)

Convexitycash_flows,0.04;

0.3208599232

(3.3)

 

Another sensitivity measure is the basis point sensitivity.

 

 

BasisPointSensitivitycash_flows,0.05;

210.4591831

(3.4)

BasisPointSensitivitycash_flows,0.04;

213.9014542

(3.5)

You can also compute 3 different types of duration at different market prices.

 

 

Durationcash_flows,0.05;

0.3878554142

(3.6)

 

You can use the internal rate of return of your set of cash flows to compute the Macaulay duration.

 

ir:=InternalRateOfReturncash_flows,106;

ir:=0.1136419342

(3.7)

 

Durationcash_flows, ir;

0.3776184776

(3.8)

 

 

 

See Also

Calendars worksheet, Term Structures worksheet, Stochastic Processes worksheet, Day Counters worksheet, Lattice Methods worksheet