 ZeroCurve - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Finance

 ZeroCurve
 create new zero-coupon curve Calling Sequence ZeroCurve(rate, opts) ZeroCurve(times, rates, opts) ZeroCurve(dates, rates, opts) Parameters

 rate - real constant, algebraic expression, or procedure; zero rate times - list or Vector; times (in years) rates - list or Vector; zero rates dates - list; dates opts - equations of the form option = value where option is one of compounding, daycounter, interpolation, or referencedate; specify options for the ZeroCurve command Options

 • 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(s).
 • daycounter = Actual360, Actual365Fixed, AFB, Bond, Euro, Historical, ISDA, ISMA, OneDay, Simple, Thirty360BondBasis, Thirty360EuroBondBasis, Thirty360European, Thirty360Italian, Thirty360USA, or a day counter data structure -- This option specifies the convention used to convert the amount of time between two dates to year fractions.
 • interpolation = BackwardFlat, Cubic, ForwardFlat, Linear, or LogLinear -- This option specifies the type of interpolation used to build a zero curve from a discrete set of rates. The LogLinear interpolation is used by default.
 • referencedate = date in any of the formats recognized by the Finance[ParseDate] command -- This option specifies the reference date (when the discount factor is equal to 1). Description

 • The ZeroCurve command creates a new zero-coupon curve represented as a module. This module can be passed to other commands of the Finance package that expect a yield term structure as one of the parameters; it can also be used as if it were a procedure. Assume for example that the module returned by ZeroCurve was assigned to the name R. Then for any positive constant t, $R\left(t\right)$ will return a zero rate for the maturity t based on the term structure R. If d is a date given in any of the formats recognized by the Finance[ParseDate] command, then the $R\left(d\right)$ command will return the zero rate for the corresponding maturity.
 • The ZeroCurve(rate, opts) command creates a zero-coupon curve based on the specified interest rate. The parameter rate can be either a real constant, a Maple procedure or an algebraic expression. If rate is a real constant, then the ZeroCurve command contracts a flat term structure based on the specified interest rate. If rate is a procedure, it should accept one parameter (the time) and return the corresponding rate as a floating-point number. Finally, if rate is an algebraic expression, it should depend on a single variable. This variable will be taken as time.
 • The ZeroCurve(times, rates, opts) and ZeroCurve(dates, rates, opts) commands create a term structure based on piecewise interpolation of specified zero rates. The parameters rates and times can be either a list or a Vector containing numeric values and must have the same number of elements. The parameter dates is a list of dates in one of the formats recognized by Finance[ParseDate].
 • By default all rates are assumed to be based on continuous compounding. The compounding option can be used to specify the desired compounding type for the given rates. If the value of the compounding option is different from Continuous, all the given rates will be converted to the corresponding continuous rates.
 • Objects created using the ZeroCurve command will be of Maple type YieldTermStructure. Examples

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

In this example, create a flat zero curve with reference date set to January 5, 2005.

 > $\mathrm{zerocurve1}≔\mathrm{ZeroCurve}\left(0.05,\mathrm{referencedate}="Jan-05-2006"\right):$
 > $\mathrm{zerocurve1}\left("Jan-05-2007"\right)$
 ${0.05000000000}$ (1)
 > $\mathrm{zerocurve1}\left(1.0\right)$
 ${0.05000000000}$ (2)

In this example, create a zero curve with the same parameters as above but assume that the given interest rate is based on monthly compounding.

 > $\mathrm{zerocurve2}≔\mathrm{ZeroCurve}\left(0.05,\mathrm{compounding}=\mathrm{Monthly},\mathrm{referencedate}="Jan-05-2005"\right):$

Note that in the previous example only the rates passed to the ZeroCurve constructor are assumed to be monthly compounded. Whenever we evaluate zerocurve2, the returned rate is always continuous.

 > $\mathrm{zerocurve2}\left("Jan-05-2005"\right)$
 ${0.04989612178}$ (3)
 > $\mathrm{zerocurve2}\left(1.0\right)$
 ${0.04989612178}$ (4)
 > $\mathrm{EquivalentRate}\left(\mathrm{zerocurve2}\left(1.0\right),\mathrm{Continuous},\mathrm{Monthly},1.0\right)$
 ${0.05000000000}$ (5)
 > $\mathrm{DiscountFactor}\left(\mathrm{zerocurve2},"Jan-05-2005"\right)$
 ${1.}$ (6)

In this example, create a zero curve based on a piecewise interpolation of zero rates. Use the default interpolation.

 > $\mathrm{rates}≔\left[0.02,0.01,0.04,0.06,0.07\right]:$
 > $\mathrm{times}≔\left[0.,0.5,1.0,1.5,2.0\right]:$
 > $\mathrm{zerocurve3}≔\mathrm{ZeroCurve}\left(\mathrm{times},\mathrm{rates}\right):$
 > $\mathrm{zerocurve3}\left(0.5\right)$
 ${0.01000000000}$ (7)
 > $\mathrm{zerocurve3}\left(1.0\right)$
 ${0.04000000000}$ (8)
 > $\mathrm{zerocurve3}\left(1.25\right)$
 ${0.04898979486}$ (9)
 > $\mathrm{zerocurve4}≔\mathrm{ZeroCurve}\left(\mathrm{times},\mathrm{rates},\mathrm{interpolation}=\mathrm{BackwardFlat}\right):$
 > $\mathrm{zerocurve5}≔\mathrm{ZeroCurve}\left(\mathrm{times},\mathrm{rates},\mathrm{interpolation}=\mathrm{Linear}\right):$
 > $\mathrm{zerocurve6}≔\mathrm{ZeroCurve}\left(\mathrm{times},\mathrm{rates},\mathrm{interpolation}=\mathrm{ForwardFlat}\right):$
 > $\mathrm{zerocurve7}≔\mathrm{ZeroCurve}\left(\mathrm{times},\mathrm{rates},\mathrm{interpolation}=\mathrm{Cubic}\right):$
 > $\mathrm{plot}\left(\left[\mathrm{zerocurve3},\mathrm{zerocurve4},\mathrm{zerocurve5},\mathrm{zerocurve6},\mathrm{zerocurve7}\right],0..2,\mathrm{color}=\left[\mathrm{red},\mathrm{blue},\mathrm{green},\mathrm{yellow},\mathrm{cyan}\right],\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right)$ Construct a zero yield term structure based on a Maple function.

 > $f≔\mathrm{CurveFitting}:-\mathrm{Spline}\left(\mathrm{times},\mathrm{rates},t,\mathrm{degree}=4\right)$
 ${f}{≔}\left\{\begin{array}{cc}{0.1631507971}{}{{t}}^{{4}}{+}{0.02}{-}{0.03776323341}{}{t}& {t}{<}{0.2500000000}\\ {-}{0.1735680803}{}{{t}}^{{4}}{+}{0.3367188774}{}{{t}}^{{3}}{-}{0.1262695790}{}{{t}}^{{2}}{-}{0.01671830357}{}{t}{+}{0.01868469189}& {t}{<}{0.7500000000}\\ {0.1214446482}{}{{t}}^{{4}}{-}{0.5483193081}{}{{t}}^{{3}}{+}{0.8693983798}{}{{t}}^{{2}}{-}{0.5145522824}{}{t}{+}{0.1120285630}& {t}{<}{1.250000000}\\ {-}{0.02763974508}{}{{t}}^{{4}}{+}{0.1971026584}{}{{t}}^{{3}}{-}{0.5282678071}{}{{t}}^{{2}}{+}{0.6501695396}{}{t}{-}{0.2519470064}& {t}{<}{1.750000000}\\ {-}{0.003624442908}{}{{t}}^{{4}}{+}{0.02899554326}{}{{t}}^{{3}}{-}{0.08698662976}{}{{t}}^{{2}}{+}{0.1353414990}{}{t}{-}{0.02670973855}& {\mathrm{otherwise}}\end{array}\right\$ (10)
 > $\mathrm{zerocurve4}≔\mathrm{ZeroCurve}\left(f\right):$
 > $\mathrm{plot}\left(\left[\mathrm{zerocurve3},\mathrm{zerocurve4},\mathrm{zerocurve7}\right],0..2,\mathrm{color}=\left[\mathrm{red},\mathrm{blue},\mathrm{cyan}\right],\mathrm{thickness}=2,\mathrm{axes}=\mathrm{BOXED},\mathrm{gridlines}=\mathrm{true}\right)$  References

 Brigo, D., Mercurio, F., Interest Rate Models: Theory and Practice. New York: Springer-Verlag, 2001.
 Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003. Compatibility

 • The Finance[ZeroCurve] command was introduced in Maple 15.
 • For more information on Maple 15 changes, see Updates in Maple 15.

 See Also