Finance
Duration
calculate the duration of a set of cash flows or bonds
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
Duration(cashflows, rate, opts)
Duration(bond, rate, opts)
cashflows
-
cash flow data structure or a list of cash flow data structures; cash flows
bond
fixed- or floating-rate bond data structure; bond
rate
non-negative real number; interest rate
opts
equations of the form option = value where option is one of evaluation, compounding, or daycounter; specify options for the Duration command
compounding = Simple, Continuous, Annual, Semiannual, EveryFourthMonth, Quarterly, Bimonthly, Monthly, SimpleThenAnnual, SimpleThenSemiannual, SimpleThenEveryFourthMonth, SimpleThenQuarterly, SimpleThenBimonthly, or SimpleThenMonthly -- This option specifies the compounding type for the given interest rate.
daycounter = Actual360, Actual365Fixed, AFB, Bond, Euro, Historical, ISDA, ISMA, OneDay, Simple, Thirty360BondBasis, Thirty360EuroBondBasis, Thirty360European, Thirty360Italian, Thirty360USA, or a day counter data structure created using the DayCounter constructor -- This option provides a day counter that will be used to represent the period between two dates as a fraction of the year. The default day count convention can be set using the Settings command.
evaluationdate = a string containing a date specification in a format recognized by ParseDate or a Date data structure -- This option specifies the evaluation date. This is set to the global evaluation date by default (see EvaluationDate).
The Duration command calculates the duration of a set of cash flows or a portfolio of bonds.
For a set of cash flows C⁡t the simple duration is defined as
∑t⁡t⁢C⁡t⁢Pt∑t⁡C⁡t⁢Pt
where Pt is the discount at time t implied by the given interest rate. There are at least two ways to calculate Pt. One can either use a yield term structure or an internal rate of return of the set of cash flows. In the latter case one would obtain the Macaulay duration.
A bond's duration is defined in a similar way. It can also be interpreted as the weighted first derivative of the price:
ⅆⅆrB⁡rB⁡r
Duration is useful as a measure of sensitivity of a bond's or cash flows' price to interest rate movements.
The parameter cashflows is a cash flow data structure or a list of cash flow data structures.
The parameter bond must be a fixed- or floating-rate bond data structure.
with⁡Finance:
SetEvaluationDate⁡January 1, 2005:
paymentdate≔January 1, 2007
cashflow1≔seq⁡SimpleCashFlow⁡100,AdvanceDate⁡paymentdate,i,Years,i=1..10
cashflow1≔100. on January 1, 2008,100. on January 1, 2009,100. on January 1, 2010,100. on January 1, 2011,100. on January 1, 2012,100. on January 1, 2013,100. on January 1, 2014,100. on January 1, 2015,100. on January 1, 2016,100. on January 1, 2017
Duration⁡cashflow1,0.03,evaluationdate=January 1, 2005
7.252874161
Duration⁡cashflow1,0.03,evaluationdate=January 1, 2004
8.252874161
Here is another example.
nominalamt≔100
rate≔0.05
startdate≔January 1, 2006
cashflow2≔seq⁡FixedRateCoupon⁡nominalamt,rate,startdate,AdvanceDate⁡startdate,i,Years,i=1..10
cashflow2≔5. on January 1, 2007,10. on January 1, 2008,15. on January 1, 2009,20. on January 1, 2010,25. on January 1, 2011,30. on January 1, 2012,35. on January 1, 2013,40. on January 1, 2014,45. on January 1, 2015,50. on January 1, 2016
Compute the value of this cash flow on January 1, 2005.
Duration⁡cashflow2,0.03,evaluationdate=January 1, 2005
7.816330091
Compute the Macaulay duration for the previous cash flow.
irr≔InternalRateOfReturn⁡cashflow2,15
irr≔0.4458188048
Duration⁡cashflow2,irr
5.076090247
Here is an example using bonds.
bond≔FixedCouponBond⁡100,5,Years,0.05
bond ≔ moduleend module
cflows≔CashFlows⁡bond
cflows≔5. on 'January 1, 2006',5. on 'January 1, 2007',5. on 'January 1, 2008',5. on 'January 1, 2009',5. on 'January 1, 2010',100. on 'January 1, 2010'
Duration⁡bond,0.03,evaluationdate=January 5, 2000
9.556636250
Duration⁡cflows,0.03,evaluationdate=January 5, 2000
The Finance[Duration] command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
See Also
Finance[CompoundFactor]
Finance[Convexity]
Finance[DiscountFactor]
Finance[FixedRateCoupon]
Finance[InArrearIndexedCoupon]
Finance[NetPresentValue]
Finance[ParCoupon]
Finance[SimpleCashFlow]
Finance[UpFrontIndexedCoupon]
Finance[ZeroCurve]
Download Help Document