Main Content

IRDataCurve

Construct interest-rate curve object from dates and data

Description

Build an IRDataCurve object using IRDataCurve.

After creating an IRDataCurve object, you can use the associated object functions:

Object FunctionDescription
getForwardRates

Returns forward rates for input dates.

getZeroRates

Returns zero rates for input dates.

getDiscountFactors

Returns discount factors for input dates.

getParYields

Returns par yields for input dates.

toRateSpec

Converts to be a RateSpec object; this structure is identical to the RateSpec produced by the function intenvset.

bootstrap

Bootstraps an interest rate curve from market data.

For more detailed information on this workflow, see Interest-Rate Curve Objects and Workflow.

Creation

Description

example

IRDataCurve_obj = IRDataCurve(Type,Settle,Dates,Data) sets properties and creates an IRDataCurve object.

example

IRDataCurve_obj = IRDataCurve(___,Name,Value) sets optional properties using name-value pairs and any of the arguments in the previous syntax. For example, IRDataCurve_obj = IRDataCurve('Zero',CurveSettle,Dates,Data,'Compounding',4,'Basis',4) creates an IRDataCurve 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, serial date number, date character vector, or date string.

Data Types: double | char | string | datetime

Dates corresponding to the rate data, specified as a vector of serial date numbers, cell array of date character vectors, datetime object, or string array.

Data Types: double | char | cell | datetime | string

Interest-rate data for curve object, specified as a numeric vector.

Data Types: double

Name-Value Pair 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: IRDataCurve_obj = IRDataCurve('Zero',CurveSettle,Dates,Data,'Compounding',4,'Basis',4)

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.

Note

Simple interest can be specified by setting the Compounding value as 0 and is supported for “zero” and “discount” curve types only (not supported for “forward” curves).

Data Types: double

Day count basis of interest-rate curve, 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

Interpolation method, specified as the comma-separated pair consisting of 'InterpMethod' and a character vector or string for one of the following values:

  • 'linear' — Linear interpolation (default)

  • 'constant' — Piecewise constant interpolation.

  • 'pchip' — Piecewise cubic Hermite interpolation.

  • 'spline' — Cubic spline interpolation

Data Types: char | string

Properties

expand all

This property is read-only.

Instrument type, returned as a string.

Data Types: string

This property is read-only.

Settlement date, returned as a datetime.

Data Types: datetime

This property is read-only.

Dates corresponding to rate data, returned as a numeric vector.

Data Types: double

This property is read-only.

Interest-rate data for the curve object, returned as a numeric vector.

Data Types: double

This property is read-only.

Compounding frequency for curve, returned as a scalar numeric.

Data Types: double

This property is read-only.

Day count basis, returned as a scalar integer.

Data Types: double

This property is read-only.

Interpolation method, returned as a scalar character vector.

Data Types: char

Object Functions

getForwardRatesGet forward rates for input dates for IRDataCurve
getZeroRatesGet zero rates for input dates for IRDataCurve
getDiscountFactorsGet discount factors for input dates for IRDataCurve
getParYieldsGet par yields for input dates for IRDataCurve
toRateSpecConvert IRDataCurve object to RateSpec
bootstrapBootstrap interest-rate curve from market data

Examples

collapse all

This example shows how to create an IRDataCurve object for an interest-rate curve.

Define the type of interest-rate curve, Settle date, Dates, and Data.

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]);

Use IRDataCurve to create an IRDataCurve object.

irdc = IRDataCurve('Zero',CurveSettle,Dates,Data,'Compounding',4,'Basis',4)
irdc = 
			 Type: Zero
		   Settle: 736391 (02-Mar-2016)
	  Compounding: 4
			Basis: 4 (30/360 (PSA))
	 InterpMethod: linear
			Dates: [8x1 double]
			 Data: [8x1 double]

Introduced in R2008b