rate2disc

Discount factors from interest rates

Syntax

``Disc = rate2disc(Compounding,Rates,EndTimes,StartTimes)``
``[Disc,EndTimes,StartTimes] = rate2disc(Compounding,Rates,EndTimes,StartTimes,ValuationDate,Basis,EndMonthRule)``

Description

example

````Disc = rate2disc(Compounding,Rates,EndTimes,StartTimes)` computes discount factors from interest rates where interval points are input as times in periodic units. The `rate2disc` function computes the discounts over a series of `NPOINTS` time intervals given the annualized yield over those intervals. `NCURVES` different rate curves can be translated at once if they have the same time structure. The time intervals can represent a zero curve or a forward curve.The output `Disc` is an `NPOINTS`-by-`NCURVES` column vector of discount factors in decimal form representing the value at time `StartTimes` of a unit cash flow received at time `EndTimes`.```

example

````[Disc,EndTimes,StartTimes] = rate2disc(Compounding,Rates,EndTimes,StartTimes,ValuationDate,Basis,EndMonthRule)` computes discount factors from interest rates where `ValuationDate` is passed and interval points are input as dates. You can specify the investment intervals either with input times or with input dates. Entering `ValuationDate` invokes the date interpretation; omitting `ValuationDate` invokes the default time interpretations.```

Examples

collapse all

This example shows the two uses of `rate2disc`.

Interval Points Are Input as Times in Periodic Units

Compute discounts from a zero curve at 6 months, 12 months, and 24 months. The times to the cash flows are `1`, `2`, and `4`. Use `rate2disc` to compute the present value (at time 0) of the cash flows.

```Compounding = 2; Rates = [0.05; 0.06; 0.065]; EndTimes = [1; 2; 4]; Disc = rate2disc(Compounding, Rates, EndTimes)```
```Disc = 3×1 0.9756 0.9426 0.8799 ```

Interval Points Are Input as Dates

Compute discounts from a zero curve at 6 months, 12 months, and 24 months. Use dates to specify the ending time horizon.

```Compounding = 2; Rates = [0.05; 0.06; 0.065]; EndDates = ['10/15/97'; '04/15/98'; '04/15/99']; ValuationDate = '4/15/97'; Disc = rate2disc(Compounding, Rates, EndDates, [], ValuationDate)```
```Disc = 3×1 0.9756 0.9426 0.8799 ```

Input Arguments

collapse all

Compounding rate for which the input zero rates are compounded when annualized, specified as one of the following scalar integers. Compounding determines the formula for the discount factors (`Disc`):

• If `Compounding` = `0` for simple interest:

• `Disc = 1/(1 + Z * T)`, where `T` is time in years and simple interest assumes annual times ```F = 1```.

• If `Compounding` = `1`, `2`, `3`, `4`, `6`, `12`:

• `Disc = (1 + Z/F)^(-T)`, where `F` is the compounding frequency, `Z` is the zero rate, and `T` is the time in periodic units, for example, `T = F` is one year.

• If `Compounding` = `365`:

• `Disc = (1 + Z/F)^(-T)`, where `F` is the number of days in the basis year and `T` is a number of days elapsed computed by basis.

• If `Compounding` = `-1`:

• `Disc = exp(-T*Z)`, where `T` is time in years.

Data Types: `double`

Rates, specified as a number of points (`NPOINTS`) by number of curves (`NCURVES`) matrix of rates in decimal form. `Rates` are the yields over investment intervals from `StartTimes`, when the cash flow is valued, to `EndTimes`, when the cash flow is received. For example, 5% is `0.05` in `Rates`.

Data Types: `double`

End times, specified as a scalar or an `NPOINTS`-by-`1` column vector using serial date numbers or date character vectors, or with times in periodic units ending the interval to discount over. When `EndTimes` is not a date, the value for `EndTimes` is `T` computed from SIA semi-annual time factors, `Tsemi`, by the formula ```T = Tsemi/2 * F```, where `F` is the compounding frequency. `F` is set to `1` for continuous compounding.

Note

When `ValuationDate` is not passed, `EndTimes` is interpreted as times. If `Compounding` = `365` (daily), `EndTimes` is measured in days.

Data Types: `double` | `char`

Start times, specified a scalar or an `NPOINTS`-by-`1` column vector using serial date numbers or date character vectors, or with times in periodic units starting the interval to discount over. `StartDates` must be earlier than `EndDates`. When `StarTimes` is not a date, the value for `StartTimes` is `T` computed from SIA semi-annual time factors, `Tsemi`, by the formula `T = Tsemi/2 * F`, where `F` is the compounding frequency. `F` is set to `1` for continuous compounding.

Note

When `ValuationDate` is not passed, `StartTimes` is interpreted as times. If `Compounding` = `365` (daily), `StartTimes` is measured in days.

Data Types: `double` | `char`

Observation date of the investment horizons entered in `StartTimes` and `EndTimes`, specified as scalar serial date number or date character vector.

Note

You can specify the investment intervals either with input times or with input dates. Entering `ValuationDate` invokes the date interpretation; omitting `ValuationDate` invokes the default time interpretations.

Data Types: `double` | `char`

Day-count basis of the instrument when using dates for `StartTimes` and `EndTimes`, specified as a scalar or an `NINST`-by-`1` vector of integers..

• 0 = actual/actual

• 1 = 30/360 (SIA)

• 2 = actual/360

• 3 = actual/365

• 4 = 30/360 (PSA)

• 5 = 30/360 (ISDA)

• 6 = 30/360 (European)

• 7 = actual/365 (Japanese)

• 8 = actual/actual (ICMA)

• 9 = actual/360 (ICMA)

• 10 = actual/365 (ICMA)

• 11 = 30/360E (ICMA)

• 12 = actual/365 (ISDA)

• 13 = BUS/252

Data Types: `double`

End-of-month rule flag when using dates for `StartTimes` and `EndTimes`, specified as a scalar or an `NINST`-by-`1` vector of nonnegative integers. This rule applies only when `Maturity` is an end-of-month date for a month having 30 or fewer days.

• `0` = Ignore rule, meaning that a bond coupon payment date is always the same numerical day of the month.

• `1` = Set rule on, meaning that a bond coupon payment date is always the last actual day of the month.

Data Types: `double`

Output Arguments

collapse all

Discount factors, returned as an `NPOINTS`-by-`NCURVES` column vector of in decimal form representing the value at time `StartTimes` of a unit cash flow received at time `EndTimes`.

Times ending the interval to discount over, returned as an `NPOINTS`-by-`1` column vector, measured in periodic units.

Times starting the interval to discount over, returned as an `NPOINTS`-by-`1` column vector, measured in periodic units.

Version History

Introduced before R2006a