getForwardRates

Get forward rates for input dates for IRFunctionCurve

Syntax

F = getForwardRates(CurveObj,InpDates)
F = getForwardRates(CurveObj,InpDates,Name,Value)

Arguments

CurveObj

Interest-rate curve object that is constructed using IRFunctionCurve.

InpDates

Vector of input dates using MATLAB® date format. The input dates must be after the settle date.

Compounding

(Optional) Scalar that sets the compounding frequency per year for the forward rates are:

  • −1 = Continuous compounding

  • 1 = Annual compounding

  • 2 = Semiannual compounding (default)

  • 3 = Compounding three times per year

  • 4 = Quarterly compounding

  • 6 = Bimonthly compounding

  • 12 = Monthly compounding

Basis

(Optional) Day-count basis for the forward rates:

  • 0 = actual/actual (default)

  • 1 = 30/360 (SIA)

  • 2 = actual/360

  • 3 = actual/365

  • 4 = 30/360 (BMA)

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

Description

F = getForwardRates(CurveObj,InpDates,Name,Value) returns forward rates for the input dates. You must enter the optional arguments for Basis and Compounding as 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.

Examples

collapse all

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

irfc = IRFunctionCurve('Forward',today,@(t) polyval([-0.0001 0.003 0.02],t));
getForwardRates(irfc, today+30:30:today+720)
ans = 24×1

    0.0202
    0.0205
    0.0207
    0.0210
    0.0212
    0.0215
    0.0217
    0.0219
    0.0222
    0.0224
      ⋮

This example shows how to compute the implied 2-year forward rates in 1 year, 2 years, 5 years, and 10 years from the Settle date by using the getForwardRates method.

Use the following data for an IRFunctionCurve object that is created when using the fitSvensson method.

Settle = datenum('15-Apr-2014');
Maturity = datemnth(Settle,12*[1 2 3 5 7 10 20 30]');

CleanPrice = [100.1 100.1 100.2 99.0 101.8 99.2 101.7 100.2]';
CouponRate = [0.0200 0.0275 0.035 0.042 0.0475 0.0525 0.055 0.052]';
Instruments = [repmat(Settle,size(Maturity)) Maturity CleanPrice CouponRate];

SvenssonModel = IRFunctionCurve.fitSvensson('Zero',Settle,Instruments);

Compute the implied 2-year forward rates in 1 year, 2 years, 5 years, and 10 years from the Settle date.

IntervalMonth = 12.*2;         % Interval months for 2-year forward rates
FwdMonths = 12.*[1 2 5 10]';   % Starting in 1, 2, 5, and 10 years from Settle
N = length(FwdMonths);
FwdRates_2Y = zeros(N,1);

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

[FwdMonths FwdRates_2Y]
ans = 4×2

   12.0000    0.0418
   24.0000    0.0504
   60.0000    0.0620
  120.0000    0.0629

Introduced in R2008b