# forwardrates

Calculate forward rates for `parametercurve` object

## Syntax

``outRates = forwardrates(obj,startDates,endDates)``
``outRates = forwardrates(___,inpComp,inpBasis)``

## Description

example

````outRates = forwardrates(obj,startDates,endDates)` computes forward rates for the `parametercurve` object (`obj`) based on `startDates` and `endDates`.```

example

````outRates = forwardrates(___,inpComp,inpBasis)` specifies options in addition to any of the input argument combinations in the previous syntax.```

## Examples

collapse all

Create a `parametercurve` object using `parametercurve`.

`PCobj = parametercurve('zero',datetime(2019,9,15),@(t)polyval([-0.0001 0.003 0.02],t),'Compounding',4,'Basis',5,'Parameters',[-0.0001 0.003 0.02])`
```PCobj = parametercurve with properties: Type: "zero" Settle: 15-Sep-2019 Compounding: 4 Basis: 5 FunctionHandle: @(t)polyval([-0.0001,0.003,0.02],t) Parameters: [-1.0000e-04 0.0030 0.0200] ```

Compute the forward rates using `forwardrates`.

```CurveSettle = datetime(2019,9,15); outRates = forwardrates(PCobj,datetime(2019,12,15),datetime(2020,9,15),6,7)```
```outRates = 0.0236 ```

## Input Arguments

collapse all

`parametercurve` object, specified as a previously created `parametercurve` object.

Data Types: `object`

Start dates of the interval to discount over, specified as a scalar or an `NPOINTS`-by-`1` vector using a datetime array, string array, or date character vectors. `startDates` must be earlier than `endDates`.

To support existing code, `forwardrates` also accepts serial date numbers as inputs, but they are not recommended.

Maturity dates ending the interval to discount over, specified as a scalar or an `NPOINTS`-by-`1` vector using a datetime array, string array, or date character vectors.

To support existing code, `forwardrates` also accepts serial date numbers as inputs, but they are not recommended.

(Optional) Input compounding frequency, specified as a scalar numeric using one of the supported values: `–1`, `0`, `1`, `2`, `3`, `4`, `6`, or `12`.

Data Types: `double`

(Optional) Input day-count basis, specified as a scalar integer.

• 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`

## Output Arguments

collapse all

Forward rates, returned as a numeric.

## Version History

Introduced in R2020a

expand all