Main Content

zerorates

Calculate zero rates for ratecurve object

Since R2020a

Description

example

outRates = zerorates(obj,inpDates) computes zero rates for the ratecurve object (obj) based on inpDates.

example

outRates = zerorates(___,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 zero rates using zerorates.

CurveSettle = datetime(2019,9,15);
outRates = zerorates(myRC,CurveSettle+30:30:CurveSettle+720)
outRates = 1×24

    0.0049    0.0050    0.0050    0.0051    0.0051    0.0052    0.0052    0.0053    0.0053    0.0054    0.0054    0.0055    0.0055    0.0056    0.0056    0.0057    0.0057    0.0058    0.0058    0.0059    0.0059    0.0060    0.0060    0.0061

Input Arguments

collapse all

ratecurve object, specified using a previously created ratecurve object.

In addition, you can use a parametercurve object. Also, you can create a parametercurve object using fitNelsonSiegel, fitSvensson, or fitSmithWilson.

Data Types: object

Input dates, specified as a scalar or an NPOINTS-by-1 vector using a datetime array, string array, or date character vectors.

To support existing code, zerorates 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

Zero rates, returned as a numeric.

Version History

Introduced in R2020a

expand all