 Finance - Maple Programming Help

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

Finance

 DirtyPrice
 calculate the dirty price of a bond

 Calling Sequence DirtyPrice(bond, yield, compounding, opts)

Parameters

 bond - fixed- or floating-rate bond data structure; bond yield - non-negative constant; desired yield compounding - Simple, Continuous, Compounded, or SimpleThenCompounded; the underlying compounding type opts - equations of the form option = value where option is evaluationdate; specify options for the DirtyPrice command

Options

 • evaluationdate = a string containing a date specification in a format recognized by ParseDate or a Date data structure -- This option specifies the evaluation date. By default this is set to the global evaluation date (see EvaluationDate).

Description

 • The DirtyPrice command computes the dirty price of a bond, given its yield. Dirty price does include any accrued interest that has accumulated since the last coupon payment. The dirty price of a bond is the same as the net present value of a bond (see NetPresentValue). See the CleanPrice command to calculate the clean price of a bond, which does not include any accrued interest.
 • The parameter bond is either a fixed coupon bond or floating rate bond. The parameter yield is the desired yield.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$
 > $\mathrm{SetEvaluationDate}\left("November 25, 2006"\right):$
 > $\mathrm{EvaluationDate}\left(\right)$
 ${"November 25, 2006"}$ (1)
 > $\mathrm{Settings}\left(\left[\mathrm{daycounter}=\mathrm{Historical},\mathrm{settlementdays}=0,\mathrm{businessdayconvention}=\mathrm{Unadjusted}\right]\right)$
 $\left[{\mathrm{daycounter}}{=}{\mathrm{Historical}}{,}{\mathrm{settlementdays}}{=}{0}{,}{\mathrm{businessdayconvention}}{=}{\mathrm{Unadjusted}}\right]$ (2)

Consider a zero-coupon bond with face value 100 maturing in one year.

 > $\mathrm{bond1}≔\mathrm{ZeroCouponBond}\left(100,5,\mathrm{Years}\right):$
 > $\mathrm{price1}≔\mathrm{DirtyPrice}\left(\mathrm{bond1},0.05,\mathrm{Compounded}\right)$
 ${\mathrm{price1}}{≔}{78.35261665}$ (3)
 > $\mathrm{yield1}≔\mathrm{YieldFromDirtyPrice}\left(\mathrm{bond1},\mathrm{price1}\right)$
 ${\mathrm{yield1}}{≔}{0.04879016417}$ (4)
 > $\mathrm{EquivalentRate}\left(\mathrm{yield1},\mathrm{Continuous},\mathrm{Annual}\right)$
 ${0.05000000000}$ (5)
 > $\mathrm{yield1}≔\mathrm{YieldFromDirtyPrice}\left(\mathrm{bond1},\mathrm{price1},\mathrm{Compounded}\right)$
 ${\mathrm{yield1}}{≔}{0.05000000006}$ (6)

For bonds the DirtyPrice is equivalent to the NetPresentValue command when the discount rate is constant and equal to the yield. Similarly, the InternalRateOfReturn command is equivalent to the YieldFromDirtyPrice command.

 > $\mathrm{price1}≔\mathrm{DirtyPrice}\left(\mathrm{bond1},0.05\right)$
 ${\mathrm{price1}}{≔}{77.88007831}$ (7)
 > $\mathrm{price1}≔\mathrm{NetPresentValue}\left(\mathrm{bond1},0.05\right)$
 ${\mathrm{price1}}{≔}{77.88007831}$ (8)
 > $\mathrm{InternalRateOfReturn}\left(\mathrm{bond1},\mathrm{price1}\right)$
 ${0.04999999999}$ (9)
 > $\mathrm{YieldFromDirtyPrice}\left(\mathrm{bond1},\mathrm{price1}\right)$
 ${0.05000000001}$ (10)

Consider a 3-year bond with face value of 100 that pays a fixed coupon of 3 percent issued on March 15, 2005.

 > $\mathrm{principal2}≔100:$
 > $\mathrm{coupon2}≔0.03:$
 > $\mathrm{rate2}≔0.05:$

Reset the default day counter to be Thirty360European.

 > $\mathrm{Settings}\left(\mathrm{daycounter}=\mathrm{Thirty360European}\right):$
 > $\mathrm{Settings}\left(\mathrm{daycounter}\right)$
 ${\mathrm{Thirty360European}}$ (11)
 > $\mathrm{bond2}≔\mathrm{FixedCouponBond}\left(\mathrm{principal2},3,\mathrm{Years},\mathrm{coupon2},\mathrm{issuedate}="March 15, 2005"\right):$

Calculate the purchase price of the bond using five different methods. Note that by default all rates are assumed to be based on continuous compounding.

 > $\mathrm{DirtyPrice}\left(\mathrm{bond2},\mathrm{rate2}\right)$
 ${99.44565692}$ (12)
 > $\mathrm{discount2}≔\mathrm{ForwardCurve}\left(\mathrm{rate2}\right):$
 > $\mathrm{NetPresentValue}\left(\mathrm{bond2},\mathrm{discount2}\right)$
 ${99.44565692}$ (13)
 > $\mathrm{cashflows2}≔\mathrm{CashFlows}\left(\mathrm{bond2}\right)$
 ${\mathrm{cashflows2}}{≔}\left[{\mathrm{3. on \text{'}March 15, 2007\text{'}}}{,}{\mathrm{3. on \text{'}March 15, 2008\text{'}}}{,}{\mathrm{100. on \text{'}March 15, 2008\text{'}}}\right]$ (14)
 > $\mathrm{NetPresentValue}\left(\mathrm{cashflows2},\mathrm{discount2}\right)$
 ${99.44565692}$ (15)
 > $3\mathrm{DiscountFactor}\left(\mathrm{discount2},"March 15, 2007"\right)+103\mathrm{DiscountFactor}\left(\mathrm{discount2},"March 15, 2008"\right)$
 ${99.44565692}$ (16)
 > $3\mathrm{exp}\left(-0.05\mathrm{YearFraction}\left("March 15, 2007"\right)\right)+103\mathrm{exp}\left(-0.05\mathrm{YearFraction}\left("March 15, 2008"\right)\right)$
 ${99.44565692}$ (17)

Here is the same bond using a different business day convention and day counter.

 > $\mathrm{bond3}≔\mathrm{FixedCouponBond}\left(\mathrm{principal2},3,\mathrm{Years},\mathrm{coupon2},\mathrm{issuedate}="March 15, 2005",\mathrm{convention}=\mathrm{Following},\mathrm{daycounter}=\mathrm{Historical}\right):$
 > $\mathrm{discount3}≔\mathrm{ForwardCurve}\left(\mathrm{rate2},\mathrm{daycounter}=\mathrm{Historical}\right):$
 > $\mathrm{NetPresentValue}\left(\mathrm{bond3},\mathrm{discount3}\right)$
 ${99.46206804}$ (18)

Note that the NetPresentValue command will adjust the evaluation date according to the underlying business day convention.

 > $\mathrm{discount4}≔\mathrm{ForwardCurve}\left(\mathrm{rate2},\mathrm{daycounter}=\mathrm{Historical},\mathrm{referencedate}=\mathrm{AdjustDate}\left(\mathrm{EvaluationDate}\left(\right),\mathrm{convention}=\mathrm{Following}\right)\right)$
 ${\mathrm{discount4}}{≔}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (19)
 > $\mathrm{DirtyPrice}\left(\mathrm{bond3},\mathrm{rate2},\mathrm{evaluationdate}=\mathrm{AdjustDate}\left(\mathrm{EvaluationDate}\left(\right),\mathrm{convention}=\mathrm{Following}\right)\right)$
 ${99.46206804}$ (20)
 > $\mathrm{cashflows3}≔\mathrm{CashFlows}\left(\mathrm{bond3}\right)$
 ${\mathrm{cashflows3}}{≔}\left[{\mathrm{3. on \text{'}March 15, 2007\text{'}}}{,}{\mathrm{3.006557377 on \text{'}March 15, 2008\text{'}}}{,}{\mathrm{100. on \text{'}March 15, 2008\text{'}}}\right]$ (21)
 > $\mathrm{NetPresentValue}\left(\mathrm{cashflows3},\mathrm{discount4}\right)$
 ${99.46206804}$ (22)
 > $\mathrm{add}\left(t\left[\mathrm{amount}\right]\mathrm{DiscountFactor}\left(\mathrm{discount4},t\left[\mathrm{date}\right]\right),t\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{cashflows3}\right)$
 ${99.46206804}$ (23)

Compatibility

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