Main Content

forwardrates

Calculate forward rates for ratecurve object

Description

example

outRates = forwardrates(obj,startDates,endDates) calculates forward rates for the ratecurve object (obj) based on the startDates and endDates.

example

outRates = forwardrates(___,inpComp,inpBasis) optionally specifies the input compounding frequency (inpComp) and the input day-count basis (inpBasis) in addition to any of the input argument combinations in the previous syntax.

Examples

collapse all

Create a ratecurve object using ratecurve.

Settle = datetime(2019,9,15);
Type = 'zero';
ZeroTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])]';
ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]';
ZeroDates = Settle + ZeroTimes;
 
myRC = ratecurve('zero',Settle,ZeroDates,ZeroRates,'Compounding',2,'Basis',5,'InterpMethod',"pchip",'ShortExtrapMethod',"linear",'LongExtrapMethod',"pchip")
myRC = 
  ratecurve with properties:

                 Type: "zero"
          Compounding: 2
                Basis: 5
                Dates: [10x1 datetime]
                Rates: [10x1 double]
               Settle: 15-Sep-2019
         InterpMethod: "pchip"
    ShortExtrapMethod: "linear"
     LongExtrapMethod: "pchip"

Compute the forward rates using forwardrates.

outRates = forwardrates(myRC,datetime(2019,12,15),datetime(2021,9,15),6,7)
outRates = 0.0062

Input Arguments

collapse all

ratecurve object, specified using a previously created ratecurve 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

For more information, see Basis.

Data Types: double

Output Arguments

collapse all

Forward rates, returned as a numeric.

Version History

Introduced in R2020a

expand all