## Interest-Rate Term Conversions

Interest-rate evolution is typically represented by a set of interest rates, including the beginning and end of the periods the rates apply to. For zero rates, the start dates are typically at the valuation date, with the rates extending from that valuation date until their respective maturity dates.

### Spot Curve to Forward Curve Conversion

Frequently, given a set of rates including their start and end
dates, you may be interested in finding the rates applicable to different
terms (periods). This problem is addressed by the function `ratetimes`

. This function interpolates
the interest rates given a change in the original terms. The syntax
for calling `ratetimes`

is

[Rates, EndTimes, StartTimes] = ratetimes(Compounding, RefRates, RefEndDates, RefStartDates, EndDates, StartDates, ValuationDate);

where:

`Compounding`

represents the frequency at which the zero rates are compounded when annualized.`RefRates`

is a vector of initial interest rates representing the interest rates applicable to the initial time intervals.`RefEndDates`

is a vector of dates representing the end of the interest rate terms (period) applicable to`RefRates`

.`RefStartDates`

is a vector of dates representing the beginning of the interest rate terms applicable to`RefRates`

.`EndDates`

represent the maturity dates for which the interest rates are interpolated.`StartDates`

represent the starting dates for which the interest rates are interpolated.`ValuationDate`

is the date of observation, from which the`StartTimes`

and`EndTimes`

are calculated. This date represents time = 0.

The input arguments to this function can be separated into two groups:

The initial or reference interest rates, including the terms for which they are valid

Terms for which the new interest rates are calculated

As an example, consider the rate table specified in Calculating Discount Factors from Rates.

From | To | Rate |
---|---|---|

15 Feb 2000 | 15 Aug 2000 | 0.05 |

15 Feb 2000 | 15 Feb 2001 | 0.056 |

15 Feb 2000 | 15 Aug 2001 | 0.06 |

15 Feb 2000 | 15 Feb 2002 | 0.065 |

15 Feb 2000 | 15 Aug 2002 | 0.075 |

Assuming that the valuation date is February 15, 2000, these
rates represent zero-coupon bond rates with maturities specified in
the second column. Use the function `ratetimes`

to
calculate the forward rates at the beginning of all periods implied
in the table. Assume a compounding value of 2.

% Reference Rates. RefStartDates = ['15-Feb-2000']; RefEndDates = ['15-Aug-2000'; '15-Feb-2001'; '15-Aug-2001';... '15-Feb-2002'; '15-Aug-2002']; Compounding = 2; ValuationDate = ['15-Feb-2000']; RefRates = [0.05; 0.056; 0.06; 0.065; 0.075]; % New Terms. StartDates = ['15-Feb-2000'; '15-Aug-2000'; '15-Feb-2001';... '15-Aug-2001'; '15-Feb-2002']; EndDates = ['15-Aug-2000'; '15-Feb-2001'; '15-Aug-2001';... '15-Feb-2002'; '15-Aug-2002']; % Find the new rates. Rates = ratetimes(Compounding, RefRates, RefEndDates,... RefStartDates, EndDates, StartDates, ValuationDate)

Rates = 0.0500 0.0620 0.0680 0.0801 0.1155

Place these values in a table like the previous one. Observe the evolution of the forward rates based on the initial zero-coupon rates.

From | To | Rate |
---|---|---|

15 Feb 2000 | 15 Aug 2000 | 0.0500 |

15 Aug 2000 | 15 Feb 2001 | 0.0620 |

15 Feb 2001 | 15 Aug 2001 | 0.0680 |

15 Aug 2001 | 15 Feb 2002 | 0.0801 |

15 Feb 2002 | 15 Aug 2002 | 0.1155 |

### Alternative Syntax (`ratetimes`

)

The `ratetimes`

function
can provide the additional output arguments `StartTimes`

and `EndTimes`

,
which represent the time factor equivalents to the `StartDates`

and `EndDates`

vectors.
The `ratetimes`

function uses
time factors for interpolating the rates. These time factors are calculated
from the start and end dates, and the valuation date, which are passed
as input arguments. `ratetimes`

can
also use time factors directly, assuming time = 0 as the valuation
date. This alternate syntax is:

```
[Rates, EndTimes, StartTimes] = ratetimes(Compounding,
RefRates, RefEndTimes, RefStartTimes, EndTimes, StartTimes);
```

Use this alternate version of `ratetimes`

to
find the forward rates again. In this case, you must first find the
time factors of the reference curve. Use `date2time`

for
this.

RefEndTimes = date2time(ValuationDate, RefEndDates, Compounding)

RefEndTimes = 1 2 3 4 5

RefStartTimes = date2time(ValuationDate, RefStartDates,... Compounding)

RefStartTimes = 0

These are the expected values, given semiannual discounts (as denoted by a value of
`2`

in the variable `Compounding`

), end dates
separated by six-month periods, and the valuation date equal to the date marking
beginning of the first period (time factor = `0`

).

Now call `ratetimes`

with
the alternate syntax.

[Rates, EndTimes, StartTimes] = ratetimes(Compounding,... RefRates, RefEndTimes, RefStartTimes, EndTimes, StartTimes);

Rates = 0.0500 0.0620 0.0680 0.0801 0.1155

`EndTimes`

and `StartTimes`

have,
as expected, the same values they had as input arguments.

Times = [StartTimes, EndTimes]

Times = 0 1 1 2 2 3 3 4 4 5

## See Also

`instbond`

| `instcap`

| `instcf`

| `instfixed`

| `instfloat`

| `instfloor`

| `instoptbnd`

| `instoptembnd`

| `instoptfloat`

| `instoptemfloat`

| `instrangefloat`

| `instswap`

| `instswaption`

| `intenvset`

| `bondbyzero`

| `cfbyzero`

| `fixedbyzero`

| `floatbyzero`

| `intenvprice`

| `intenvsens`

| `swapbyzero`

| `floatmargin`

| `floatdiscmargin`

| `hjmtimespec`

| `hjmtree`

| `hjmvolspec`

| `bondbyhjm`

| `capbyhjm`

| `cfbyhjm`

| `fixedbyhjm`

| `floatbyhjm`

| `floorbyhjm`

| `hjmprice`

| `hjmsens`

| `mmktbyhjm`

| `oasbyhjm`

| `optbndbyhjm`

| `optfloatbyhjm`

| `optembndbyhjm`

| `optemfloatbyhjm`

| `rangefloatbyhjm`

| `swapbyhjm`

| `swaptionbyhjm`

| `bdttimespec`

| `bdttree`

| `bdtvolspec`

| `bdtprice`

| `bdtsens`

| `bondbybdt`

| `capbybdt`

| `cfbybdt`

| `fixedbybdt`

| `floatbybdt`

| `floorbybdt`

| `mmktbybdt`

| `oasbybdt`

| `optbndbybdt`

| `optfloatbybdt`

| `optembndbybdt`

| `optemfloatbybdt`

| `rangefloatbybdt`

| `swapbybdt`

| `swaptionbybdt`

| `hwtimespec`

| `hwtree`

| `hwvolspec`

| `bondbyhw`

| `capbyhw`

| `cfbyhw`

| `fixedbyhw`

| `floatbyhw`

| `floorbyhw`

| `hwcalbycap`

| `hwcalbyfloor`

| `hwprice`

| `hwsens`

| `oasbyhw`

| `optbndbyhw`

| `optfloatbyhw`

| `optembndbyhw`

| `optemfloatbyhw`

| `rangefloatbyhw`

| `swapbyhw`

| `swaptionbyhw`

| `bktimespec`

| `bktree`

| `bkvolspec`

| `bkprice`

| `bksens`

| `bondbybk`

| `capbybk`

| `cfbybk`

| `fixedbybk`

| `floatbybk`

| `floorbybk`

| `oasbybk`

| `optbndbybk`

| `optfloatbybk`

| `optembndbybk`

| `optemfloatbybk`

| `rangefloatbybk`

| `swapbybk`

| `swaptionbybk`

| `capbyblk`

| `floorbyblk`

| `swaptionbyblk`

## Related Examples

- Modeling the Interest-Rate Term Structure
- Pricing Using Interest-Rate Term Structure
- Pricing Using Interest-Rate Term Structure
- Pricing Using Interest-Rate Tree Models
- Graphical Representation of Trees