IRFunctionCurve - Construct interest-rate curve object from function handle or function by fitting to market data using object methods

Class

@IRFunctionCurve

Syntax

CurveObj = IRFunctionCurve(Type, Settle, FunctionHandle)
CurveObj = IRFunctionCurve(Type, Settle, FunctionHandle, 
'Parameter1', Value1, 'Parameter2', Value2, ...)

Arguments

Type

Type of interest-rate curve: zero, forward, or discount.

Settle

Scalar or column vector of settlement dates.

FunctionHandle

Function handle that defines the interest-rate curve. The function handle requires one numeric input (time-to-maturity) and returns one numeric output (interest rate or discount factor). For more information on defining a function handle, see the MATLAB Programming Fundamentals documentation.

Compounding

(Optional) Compounding value for the bond:

  • -1

  • 1

  • 2 (default)

  • 3

  • 4

  • 6

  • 12

Basis

(Optional) Day-count basis of the bond. A vector of integers.

  • 0 = actual/actual (default)

  • 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 (ISMA)

  • 9 = actual/360 (ISMA)

  • 10 = actual/365 (ISMA)

  • 11 = 30/360E (ISMA)

  • 12 = actual/365 (ISDA)

Description

CurveObj = IRFunctionCurve(Type, Settle, FunctionHandle, 'Parameter1', Value1, 'Parameter2', Value2, ...) constructs an interest-rate curve object directly by specifying a function handle. You must enter the optional arguments for Basis and Compounding as parameter/value pairs.

After you use the IRFunctionCurve constructor to create an IRFunctionCurve object, you can fit the bond using the following methods.

MethodDescription
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 RateSpec structure is identical to the RateSpec produced by the Financial Derivatives Toolbox function intenvset.

Alternatively, you can construct an IRFunctionCurve object using the following static methods.

Static MethodDescription
fitNelsonSiegel

Fits a Nelson-Siegel function to market data.

fitSvensson

Fits a Svensson function to market data.

fitSmoothingSpline

Fits a smoothing spline function to market data.

fitFunction

Fits a custom function to market data.

Examples

irfc = IRFunctionCurve('Forward',today,@(t) polyval([-0.0001 0.003 0.02],t))

irfc = 

  Properties:
    FunctionHandle: @(t)polyval([-0.0001,0.003,0.02],t)
              Type: 'Forward'
            Settle: 733599
       Compounding: 2
             Basis: 0

See Also

@IRCurve

  


 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS