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.

Note

The ratecurve object was introduced in R2020a as part of a new object-based framework in the Financial Instruments Toolbox™ which supports end-to-end workflows in instrument modeling and analysis. For more information, see Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments. While IRDataCurve can be used for building and analyzing yield curves, ratecurve provides that functionality, but it is also seamlessly integrated with instrument pricing functionality. For example, the ratecurve can be used to price instruments (Discount) and the irbootstrap function takes as inputs an array of instrument objects.

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, string, or date character vector.

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

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

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

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

Data Types: double

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: 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 = datetime(2016,3,2);
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]

Version History

Introduced in R2008b

expand all