Main Content

getForwardRates

Get forward rates for input dates for IRDataCurve

Description

example

F = getForwardRates(CurveObj,InpDates) computes discount factors for input dates for an IRDataCurve object. getForwardRates returns discrete forward rates for the intervals input into this function. For example, running the following code:

getForwardRates(irdc, {Date1, Date2, Date3}) 
gives three forwards rates and the three tenors are: [Settle, Date1], [Date1, Date2], and [Date2, Date3].

example

F = getForwardRates(___,Name,Value) adds optional name-value pair arguments.

Examples

collapse all

This example shows how to get forward rates for input dates for an IRDataCurve.

CurveSettle = datenum('2-Mar-2016');
Data = [2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100;
Dates = datemnth(CurveSettle,12*[1 2 3 5 7 10 20 30]);
irdc = IRDataCurve('Zero',CurveSettle,Dates,Data);
getForwardRates(irdc, CurveSettle+30:30:CurveSettle+720)
ans = 24×1

    0.0174
    0.0180
    0.0187
    0.0193
    0.0199
    0.0205
    0.0212
    0.0218
    0.0224
    0.0230
      ⋮

Use getForwardRates to compute the forward rate from the Settle date to 5 years from March 1, 2017 and then the forward rate for the period from 5 years to 10 years from March 1, 2017.

Data = [2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100;
Dates = daysadd(736755,[360 2*360 3*360 5*360 7*360 10*360 20*360 30*360],1);
irdc = IRDataCurve('Zero',today,Dates,Data);
getForwardRates(irdc,datemnth(irdc.Settle,12*[5 10]))
ans = 2×1

    0.0378
    0.0457

The first element (.0312) is the forward rate from the Settle to 5 years from March 1, 2017. The second rate (0.0458) is the forward rate for the period from 5 years to 10 years from March 1, 2017, in other words, the 5-year forward rate 5 years from March 1, 2017.

Use the following data to create an IRDataCurve object:

Data = [0.1 0.30 0.70 1.05 1.45 1.71 2.12 2.43 2.85 3.57]/100;
Settle = datenum('08-Aug-2016'); % Today's date
Dates = datemnth(Settle,[3 6 9 12*[1 2 3 5 7 10 20]]);
irdc = IRDataCurve('Zero',Settle,Dates,Data)
irdc = 
			 Type: Zero
		   Settle: 736550 (08-Aug-2016)
	  Compounding: 2
			Basis: 0 (actual/actual)
	 InterpMethod: linear
			Dates: [10x1 double]
			 Data: [10x1 double]

Compute the implied 6 month forward rates in 1 month, 2 months, and 3 months from the Settle date.

IntervalMonth = 6; % Interval for 6 month forward rates
FwdMonths = [1 2 3]'; % Starting in 1, 2, and 3 months from Settle
N = length(FwdMonths);
FwdRates_6M = zeros(N,1);

for k = 1:N
    FwdDates = datemnth(irdc.Settle, [FwdMonths(k) FwdMonths(k)+IntervalMonth]);
    f = getForwardRates(irdc,FwdDates);
    FwdRates_6M(k) = f(2);
end

[FwdMonths FwdRates_6M]
ans = 3×2

    1.0000    0.0050
    2.0000    0.0074
    3.0000    0.0101

Input Arguments

collapse all

Interest-rate curve object, specified by using IRDataCurve.

Data Types: object

Input dates, specified using MATLAB® date format. The input dates must be after the Settle date of IRDataCurve.

Data Types: double

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: F = getForwardRates(irdc, CurveSettle+30:30:CurveSettle+720)

Compounding frequency per-year for forward rates, specified as the comma-separated pair consisting of 'Compounding' and a scalar numeric using one of the supported values:

  • −1 = Continuous compounding

  • 0 = Simple interest (no compounding)

  • 1 = Annual compounding

  • 2 = Semiannual compounding

  • 3 = Compounding three times per year

  • 4 = Quarterly compounding

  • 6 = Bimonthly compounding

  • 12 = Monthly compounding

Data Types: double

Day count basis for the forward rates, specified as the comma-separated pair consisting of 'Basis' and 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 vector. getForwardRates returns forward rates corresponding to the periodicity of the dates input to getForwardRates. For example, where the dates are monthly, monthly forward rates are returned. The first element of the output is the forward rate from the Settle to one month, the second element is the forward rate from one month to two months, and so on.

Introduced in R2008b