Main Content

parametercurve

Create parametercurve object for storing interest-rate curve function

Since R2020a

Description

Build a parametercurve object using parametercurve.

After creating a parametercurve object, you can use the associated object functions discountfactors, zerorates, forwardrates, fitNelsonSiegel, and fitSvensson.

For more detailed information on this workflow, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.

For more information on the available instruments, models, and pricing methods, see Choose Instruments, Models, and Pricers.

Creation

Description

example

parametercurve_obj = parametercurve(Type,Settle,FunctionHandle) creates a parametercurve object.

example

parametercurve_obj = parametercurve(___,Name,Value) sets properties using name-value pairs and any of the arguments in the previous syntax. For example, parametercurve_obj = parametercurve('zero',datetime(2017,1,30),@(t)polyval([-0.0001 0.003 0.02],t),'Compounding',4,'Basis',5,'Parameters',[-0.0001 0.003 0.02]) creates a parametercurve object for a zero curve. You can specify multiple name-value pair arguments.

Input Arguments

expand all

Type of interest-rate curve, specified as a scalar string or character vector for one of the supported types.

Data Types: char | string

Settlement date for the curve, specified as a scalar datetime, string, or date character vector.

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

Dates corresponding to the rate data, specified as a function handle. The function handle requires one numeric input (time-to-maturity) and returns one numeric output (interest rate or discount factor). For more information on creating a function handle, see Create Function Handle.

Data Types: function_handle

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: parametercurve_obj = parametercurve('zero',datetime(2017,1,30),@(t)polyval([-0.0001 0.003 0.02],t),'Compounding',4,'Basis',5,'Parameters',[-0.0001 0.003 0.02])

Compounding frequency for the curve, specified as the comma-separated pair consisting of 'Compounding' and a scalar numeric using the supported values: –1, 0, 1, 2, 3, 4, 6, or 12.

Data Types: double

Day count basis, 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

Curve parameters, specified as the comma-separated pair consisting of 'Parameters' and a numeric value.

Data Types: double

Properties

expand all

Instrument type, returned as a string.

Data Types: string

Settlement date, returned as a datetime.

Data Types: datetime

Function handle that defines the interest-rate curve, returned as a scalar function handle.

Data Types: function_handle

Compounding frequency for curve, returned as a scalar numeric.

Data Types: double

Day count basis, returned as a scalar integer.

Data Types: double

Curve parameters, returned as a numeric value.

Data Types: double

Object Functions

discountfactorsCalculate discount factors for parametercurve object
zeroratesCalculate zero rates for parametercurve object
forwardratesCalculate forward rates for parametercurve object
fitNelsonSiegelFit Nelson-Siegel model to bond market data
fitSvenssonFit Svensson model to bond market data

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]

Version History

Introduced in R2020a

expand all