Finance - Maple Programming Help

Home : Support : Online Help : Mathematics : Finance : Interest Rates : Finance/DiscountCurve

Finance

 DiscountCurve
 create new zero curve based on the specified discount factors

 Calling Sequence DiscountCurve(rate, opts) DiscountCurve(times, rates, opts) DiscountCurve(dates, rates, opts)

Parameters

 rate - real constant, algebraic expression, or a procedure; discount factor times - list or Vector of non-negative constants; times (in years) rates - list or Vector of non-negative constants; discount factors dates - list of dates in one of the formats recognized by the ParseDate command; dates opts - equations of the form option = value where option is one of daycounter, interpolation, or referencedate; specify options for the DiscountCurve 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 discount factor(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 discount curve from a discrete set of discount factors. The LogLinear interpolation is used by default.
 • referencedate = date in any of the formats recognized by the ParseDate command -- This option specifies the reference date (when the discount factor is equal to 1).

Description

 • The DiscountCurve command creates a new yield curve based on the specified discount factors; the resulting curve is 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 DiscountCurve was assigned to the name R. Then for any positive constant t, $R\left(t\right)$ will return a discount factor for the maturity t based on the term structure R. If d is a date given in any of the formats recognized by the ParseDate command, then the $R\left(d\right)$ command will return the discount factor for the corresponding maturity.
 • The DiscountCurve(rate, opts) command creates a zero 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 DiscountCurve 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 DiscountCurve(times, rates, opts) and DiscountCurve(dates, rates, opts) commands create a term structure based on piecewise interpolation of specified discount factors. 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 ParseDate.
 • Objects created using the DiscountCurve command will be of Maple type YieldTermStructure.

Examples

 > with(Finance):
 > SetEvaluationDate("November 25, 2006"):

In this example create a discount curve based on a piecewise interpolation of discount rates. Use the linear interpolation.

 > discountfactors := [1., 0.995, 0.989, 0.981, 0.975, 0.964, 0.944, 0.930, 0.914, 0.886, 0.860, 0.842, 0.832, 0.831, 0.827, 0.823, 0.815, 0.795, 0.778, 0.770]:
 > times := [.25, .50, .75, 1.0, 1.2, 1.5, 1.8, 2.0, 2.2, 2.5, 2.8, 3.0, 3.2, 3.5, 3.8, 4.0, 4.2, 4.5, 4.8, 5.0]:
 > discountcurve := DiscountCurve(times, discountfactors):
 > ZeroRate(discountcurve, .5);
 ${0.01002508365}$ (1)
 > ForwardRate(discountcurve, .5);
 ${0.02419362214}$ (2)
 > DiscountFactor(discountcurve, .5);
 ${0.9950000000}$ (3)
 ${\mathrm{date2}}{≔}{"May 25, 2007"}$ (4)
 > time2 := YearFraction(date2);
 ${\mathrm{time2}}{≔}{0.4958904110}$ (5)
 > discountcurve(date2);
 ${0.9950819893}$ (6)
 > discountcurve(time2);
 ${0.9950819893}$ (7)

Construct discount curves based on different types of interpolation of the given rates.

 > discountcurve2 := DiscountCurve(times, discountfactors, interpolation = BackwardFlat):
 > discountcurve3 := DiscountCurve(times, discountfactors, interpolation = ForwardFlat):
 > discountcurve4 := DiscountCurve(times, discountfactors, interpolation = Cubic):
 > plot([discountcurve, discountcurve2, discountcurve3, discountcurve4], 0..5, color = [red, blue, green, cyan], thickness = 2, axes = BOXED, gridlines = true);

Construct a discount yield term structure based on a Maple function.

 > f := CurveFitting:-Spline(times, discountfactors, t, degree = 4);
 ${f}{≔}\left\{\begin{array}{cc}{-}{0.01189941604}{}{{t}}^{{4}}{+}{0.01189941604}{}{{t}}^{{3}}{-}{0.004462281015}{}{{t}}^{{2}}{-}{0.01905099728}{}{t}{+}{1.004902195}& {t}{<}{0.3750000000}\\ {-}{0.03172492545}{}{{t}}^{{4}}{+}{0.04163768016}{}{{t}}^{{3}}{-}{0.02119005458}{}{{t}}^{{2}}{-}{0.01486905389}{}{t}{+}{1.004510138}& {t}{<}{0.6250000000}\\ {0.1039594708}{}{{t}}^{{4}}{-}{0.2975733104}{}{{t}}^{{3}}{+}{0.2968202491}{}{{t}}^{{2}}{-}{0.1473733471}{}{t}{+}{1.025213935}& {t}{<}{0.8750000000}\\ {-}{0.08853890118}{}{{t}}^{{4}}{+}{0.3761709898}{}{{t}}^{{3}}{-}{0.5874691433}{}{{t}}^{{2}}{+}{0.3684621307}{}{t}{+}{0.9123749242}& {t}{<}{1.100000000}\\ {-}{0.1197353883}{}{{t}}^{{4}}{+}{0.5134355333}{}{{t}}^{{3}}{-}{0.813955640}{}{{t}}^{{2}}{+}{0.5345522282}{}{t}{+}{0.8667001473}& {t}{<}{1.350000000}\\ {0.2499934793}{}{{t}}^{{4}}{-}{1.483100351}{}{{t}}^{{3}}{+}{3.229029530}{}{{t}}^{{2}}{-}{3.104134427}{}{t}{+}{2.094756886}& {t}{<}{1.650000000}\\ {-}{0.2653533436}{}{{t}}^{{4}}{+}{1.918188680}{}{{t}}^{{3}}{-}{5.189160821}{}{{t}}^{{2}}{+}{6.155874957}{}{t}{-}{1.724996984}& {t}{<}{1.900000000}\\ {0.0787759053}{}{{t}}^{{4}}{-}{0.6971936111}{}{{t}}^{{3}}{+}{2.264678708}{}{{t}}^{{2}}{-}{3.285655115}{}{t}{+}{2.759729805}& {t}{<}{2.100000000}\\ {0.1910343021}{}{{t}}^{{4}}{-}{1.640164145}{}{{t}}^{{3}}{+}{5.235035885}{}{{t}}^{{2}}{-}{7.444155159}{}{t}{+}{4.942942325}& {t}{<}{2.350000000}\\ {-}{0.2857346683}{}{{t}}^{{4}}{+}{2.841464179}{}{{t}}^{{3}}{-}{10.56270395}{}{{t}}^{{2}}{+}{17.30563722}{}{t}{-}{9.59756069}& {t}{<}{2.650000000}\\ {0.5174704068}{}{{t}}^{{4}}{-}{5.672509617}{}{{t}}^{{3}}{+}{23.28034189}{}{{t}}^{{2}}{-}{42.48374377}{}{t}{+}{30.01290422}& {t}{<}{2.900000000}\\ {-}{0.4144089660}{}{{t}}^{{4}}{+}{5.137291107}{}{{t}}^{{3}}{-}{23.74229127}{}{{t}}^{{2}}{+}{48.42668042}{}{t}{-}{35.89715344}& {t}{<}{3.100000000}\\ {-}{0.2814239993}{}{{t}}^{{4}}{+}{3.488277521}{}{{t}}^{{3}}{-}{16.07437810}{}{{t}}^{{2}}{+}{32.57965988}{}{t}{-}{23.61571253}& {t}{<}{3.350000000}\\ {0.3604175437}{}{{t}}^{{4}}{-}{5.112399153}{}{{t}}^{{3}}{+}{27.14402216}{}{{t}}^{{2}}{-}{63.94143401}{}{t}{+}{57.22070354}& {t}{<}{3.650000000}\\ {-}{0.2866325131}{}{{t}}^{{4}}{+}{4.334531678}{}{{t}}^{{3}}{-}{24.57792413}{}{{t}}^{{2}}{+}{61.91530196}{}{t}{-}{57.62356812}& {t}{<}{3.900000000}\\ {0.1353767710}{}{{t}}^{{4}}{-}{2.248813156}{}{{t}}^{{3}}{+}{13.93464317}{}{{t}}^{{2}}{-}{38.21737304}{}{t}{+}{40.00579001}& {t}{<}{4.100000000}\\ {0.1815123228}{}{{t}}^{{4}}{-}{3.005436205}{}{{t}}^{{3}}{+}{18.58787492}{}{{t}}^{{2}}{-}{50.93620650}{}{t}{+}{53.04259433}& {t}{<}{4.350000000}\\ {-}{0.1245093110}{}{{t}}^{{4}}{+}{2.319340223}{}{{t}}^{{3}}{-}{16.15629127}{}{{t}}^{{2}}{+}{49.82187548}{}{t}{-}{56.53181988}& {t}{<}{4.650000000}\\ {-}{0.09220898271}{}{{t}}^{{4}}{+}{1.718554117}{}{{t}}^{{3}}{-}{11.96580818}{}{{t}}^{{2}}{+}{36.83137790}{}{t}{-}{41.43036638}& {t}{<}{4.900000000}\\ {0.2218548599}{}{{t}}^{{4}}{-}{4.437097198}{}{{t}}^{{3}}{+}{33.27822899}{}{{t}}^{{2}}{-}{110.9658102}{}{t}{+}{139.6211887}& {\mathrm{otherwise}}\end{array}\right\$ (8)
 > discountcurve5 := DiscountCurve(f):
 > plot([discountcurve, discountcurve5], 0..2, color = [red, blue], thickness = 2, axes = BOXED, gridlines = true);

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[DiscountCurve] command was introduced in Maple 15.