Finance - Maple Programming Help

Home : Support : Online Help : Mathematics : Finance : Cash Flow Analysis : Finance/CashFlows

Finance

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

 Calling Sequence CashFlows(instrument, date)

Parameters

 instrument - swap or bond; financial instrument date - a string containing a date specification in a format recognized by ParseDate or a date data structure; date

Description

 • The CashFlows command returns the set of cash flows for a swap or a bond to occur after the given date.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$

First set the global evaluation date.

 > $\mathrm{SetEvaluationDate}\left("January 02, 2006"\right):$
 > $\mathrm{EvaluationDate}\left(\right)$
 ${"January 2, 2006"}$ (1)

Consider two payment schedules. The first one consists of payments of 5% of the nominal every month between January 3, 2007 and January 3, 2010. The second one consists of payments of 3% of the nominal every quarter between January 3, 2006 and January 3, 2010.

 > $\mathrm{Schedule1}≔\mathrm{Schedule}\left("January 03, 2007","January 03, 2010",\mathrm{Monthly}\right)$
 ${\mathrm{Schedule1}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2)
 > $\mathrm{Schedule2}≔\mathrm{Schedule}\left("January 03, 2006","January 03, 2010",\mathrm{Quarterly}\right)$
 ${\mathrm{Schedule2}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (3)
 > $\mathrm{Rate1}≔0.05$
 ${\mathrm{Rate1}}{≔}{0.05}$ (4)
 > $\mathrm{Rate2}≔\mathrm{BenchmarkRate}\left(0.03\right)$
 ${\mathrm{Rate2}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (5)

Consider two simple swaps that exchange the first set of payments for the second set.

 > $\mathrm{Swap1}≔\mathrm{InterestRateSwap}\left(1000,\mathrm{Rate1},\mathrm{Schedule1},\mathrm{Rate2},\mathrm{Schedule2},0.03\right)$
 ${\mathrm{Swap1}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (6)
 > $\mathrm{Swap2}≔\mathrm{InterestRateSwap}\left(1000,\mathrm{Rate2},\mathrm{Schedule2},\mathrm{Rate1},\mathrm{Schedule1},0.03\right)$
 ${\mathrm{Swap2}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (7)

Here is the set of cash flows for the paying leg of each swap.

 > $\mathrm{PayingLeg1}≔\mathrm{CashFlows}\left(\mathrm{Swap1},\mathrm{paying}\right)$
 ${\mathrm{PayingLeg1}}{≔}\left[{\mathrm{4.246575342 on \text{'}February 3, 2007\text{'}}}{,}{\mathrm{3.835616438 on \text{'}March 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}April 3, 2007\text{'}}}{,}{\mathrm{4.109589041 on \text{'}May 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}June 3, 2007\text{'}}}{,}{\mathrm{4.109589041 on \text{'}July 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}August 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}September 3, 2007\text{'}}}{,}{\mathrm{4.109589041 on \text{'}October 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}November 3, 2007\text{'}}}{,}{\mathrm{4.109589041 on \text{'}December 3, 2007\text{'}}}{,}{\mathrm{4.245826783 on \text{'}January 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}February 3, 2008\text{'}}}{,}{\mathrm{3.961748634 on \text{'}March 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}April 3, 2008\text{'}}}{,}{\mathrm{4.098360656 on \text{'}May 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}June 3, 2008\text{'}}}{,}{\mathrm{4.098360656 on \text{'}July 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}August 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}September 3, 2008\text{'}}}{,}{\mathrm{4.098360656 on \text{'}October 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}November 3, 2008\text{'}}}{,}{\mathrm{4.098360656 on \text{'}December 3, 2008\text{'}}}{,}{\mathrm{4.235721237 on \text{'}January 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}February 3, 2009\text{'}}}{,}{\mathrm{3.835616438 on \text{'}March 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}April 3, 2009\text{'}}}{,}{\mathrm{4.109589041 on \text{'}May 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}June 3, 2009\text{'}}}{,}{\mathrm{4.109589041 on \text{'}July 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}August 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}September 3, 2009\text{'}}}{,}{\mathrm{4.109589041 on \text{'}October 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}November 3, 2009\text{'}}}{,}{\mathrm{4.109589041 on \text{'}December 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}January 3, 2010\text{'}}}\right]$ (8)
 > $\mathrm{PayingLeg2}≔\mathrm{CashFlows}\left(\mathrm{Swap2},\mathrm{paying}\right)$
 ${\mathrm{PayingLeg2}}{≔}\left[{\mathrm{14.82194787 on \text{'}April 3, 2006\text{'}}}{,}{\mathrm{14.98694508 on \text{'}July 3, 2006\text{'}}}{,}{\mathrm{15.15194910 on \text{'}October 3, 2006\text{'}}}{,}{\mathrm{15.15194910 on \text{'}January 3, 2007\text{'}}}{,}{\mathrm{14.82194787 on \text{'}April 3, 2007\text{'}}}{,}{\mathrm{14.98694508 on \text{'}July 3, 2007\text{'}}}{,}{\mathrm{15.15194910 on \text{'}October 3, 2007\text{'}}}{,}{\mathrm{15.15127369 on \text{'}January 3, 2008\text{'}}}{,}{\mathrm{14.94592054 on \text{'}April 3, 2008\text{'}}}{,}{\mathrm{14.94592054 on \text{'}July 3, 2008\text{'}}}{,}{\mathrm{15.11047204 on \text{'}October 3, 2008\text{'}}}{,}{\mathrm{15.11114744 on \text{'}January 3, 2009\text{'}}}{,}{\mathrm{14.82194787 on \text{'}April 3, 2009\text{'}}}{,}{\mathrm{14.98694508 on \text{'}July 3, 2009\text{'}}}{,}{\mathrm{15.15194910 on \text{'}October 3, 2009\text{'}}}{,}{\mathrm{15.15194910 on \text{'}January 3, 2010\text{'}}}\right]$ (9)

Here is the set of cash flows for the receiving leg.

 > $\mathrm{ReceivingLeg1}≔\mathrm{CashFlows}\left(\mathrm{Swap1},\mathrm{receiving}\right)$
 ${\mathrm{ReceivingLeg1}}{≔}\left[{\mathrm{14.82194787 on \text{'}April 3, 2006\text{'}}}{,}{\mathrm{14.98694508 on \text{'}July 3, 2006\text{'}}}{,}{\mathrm{15.15194910 on \text{'}October 3, 2006\text{'}}}{,}{\mathrm{15.15194910 on \text{'}January 3, 2007\text{'}}}{,}{\mathrm{14.82194787 on \text{'}April 3, 2007\text{'}}}{,}{\mathrm{14.98694508 on \text{'}July 3, 2007\text{'}}}{,}{\mathrm{15.15194910 on \text{'}October 3, 2007\text{'}}}{,}{\mathrm{15.15127369 on \text{'}January 3, 2008\text{'}}}{,}{\mathrm{14.94592054 on \text{'}April 3, 2008\text{'}}}{,}{\mathrm{14.94592054 on \text{'}July 3, 2008\text{'}}}{,}{\mathrm{15.11047204 on \text{'}October 3, 2008\text{'}}}{,}{\mathrm{15.11114744 on \text{'}January 3, 2009\text{'}}}{,}{\mathrm{14.82194787 on \text{'}April 3, 2009\text{'}}}{,}{\mathrm{14.98694508 on \text{'}July 3, 2009\text{'}}}{,}{\mathrm{15.15194910 on \text{'}October 3, 2009\text{'}}}{,}{\mathrm{15.15194910 on \text{'}January 3, 2010\text{'}}}\right]$ (10)
 > $\mathrm{ReceivingLeg2}≔\mathrm{CashFlows}\left(\mathrm{Swap2},\mathrm{receiving}\right)$
 ${\mathrm{ReceivingLeg2}}{≔}\left[{\mathrm{4.246575342 on \text{'}February 3, 2007\text{'}}}{,}{\mathrm{3.835616438 on \text{'}March 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}April 3, 2007\text{'}}}{,}{\mathrm{4.109589041 on \text{'}May 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}June 3, 2007\text{'}}}{,}{\mathrm{4.109589041 on \text{'}July 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}August 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}September 3, 2007\text{'}}}{,}{\mathrm{4.109589041 on \text{'}October 3, 2007\text{'}}}{,}{\mathrm{4.246575342 on \text{'}November 3, 2007\text{'}}}{,}{\mathrm{4.109589041 on \text{'}December 3, 2007\text{'}}}{,}{\mathrm{4.245826783 on \text{'}January 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}February 3, 2008\text{'}}}{,}{\mathrm{3.961748634 on \text{'}March 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}April 3, 2008\text{'}}}{,}{\mathrm{4.098360656 on \text{'}May 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}June 3, 2008\text{'}}}{,}{\mathrm{4.098360656 on \text{'}July 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}August 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}September 3, 2008\text{'}}}{,}{\mathrm{4.098360656 on \text{'}October 3, 2008\text{'}}}{,}{\mathrm{4.234972678 on \text{'}November 3, 2008\text{'}}}{,}{\mathrm{4.098360656 on \text{'}December 3, 2008\text{'}}}{,}{\mathrm{4.235721237 on \text{'}January 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}February 3, 2009\text{'}}}{,}{\mathrm{3.835616438 on \text{'}March 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}April 3, 2009\text{'}}}{,}{\mathrm{4.109589041 on \text{'}May 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}June 3, 2009\text{'}}}{,}{\mathrm{4.109589041 on \text{'}July 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}August 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}September 3, 2009\text{'}}}{,}{\mathrm{4.109589041 on \text{'}October 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}November 3, 2009\text{'}}}{,}{\mathrm{4.109589041 on \text{'}December 3, 2009\text{'}}}{,}{\mathrm{4.246575342 on \text{'}January 3, 2010\text{'}}}\right]$ (11)
 > $\mathrm{map}\left(t→{t}_{':-\mathrm{amount}'},\mathrm{PayingLeg1}\right)$
 $\left[{4.246575342}{,}{3.835616438}{,}{4.246575342}{,}{4.109589041}{,}{4.246575342}{,}{4.109589041}{,}{4.246575342}{,}{4.246575342}{,}{4.109589041}{,}{4.246575342}{,}{4.109589041}{,}{4.245826783}{,}{4.234972678}{,}{3.961748634}{,}{4.234972678}{,}{4.098360656}{,}{4.234972678}{,}{4.098360656}{,}{4.234972678}{,}{4.234972678}{,}{4.098360656}{,}{4.234972678}{,}{4.098360656}{,}{4.235721237}{,}{4.246575342}{,}{3.835616438}{,}{4.246575342}{,}{4.109589041}{,}{4.246575342}{,}{4.109589041}{,}{4.246575342}{,}{4.246575342}{,}{4.109589041}{,}{4.246575342}{,}{4.109589041}{,}{4.246575342}\right]$ (12)
 > $\mathrm{map}\left(t→{t}_{':-\mathrm{amount}'},\mathrm{PayingLeg2}\right)$
 $\left[{14.82194787}{,}{14.98694508}{,}{15.15194910}{,}{15.15194910}{,}{14.82194787}{,}{14.98694508}{,}{15.15194910}{,}{15.15127369}{,}{14.94592054}{,}{14.94592054}{,}{15.11047204}{,}{15.11114744}{,}{14.82194787}{,}{14.98694508}{,}{15.15194910}{,}{15.15194910}\right]$ (13)

Compatibility

 • The Finance[CashFlows] command was introduced in Maple 15.