Products & Services Solutions Academia Support User Community Company

Learn more about Fixed-Income Toolbox   

fitSvensson - Fit Svensson function to bond market data

Class

@IRFunctionCurve

Syntax

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

Arguments

Type

Type of interest-rate curve for a bond: zero or forward.

Settle

Scalar or column vector of settlement dates.

Instruments

N-by-4 data matrix for Instruments where the first column is Settle date, the second column is Maturity, the third column is dirty price, and the fourth column is a CouponRate for the bond.

Compounding

(Optional) Compounding value for an IRFunctionCurve object:

  • -1

  • 1

  • 2 (default)

  • 3

  • 4

  • 6

  • 12

Basis

(Optional) Day-count basis of the interest-rate curve. 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)

  • 13 = BUS/252

IRFitOptionsObj

(Optional) Object constructed from IRFitOptions.

Instrument Parameters

For each bond Instrument, you can specify the following additional instrument parameters as parameter/value pairs by prepending the word Instrument to the parameter field. For example, prepending InstrumentBasis distinguishes a bond instrument's Basis value from the curve's Basis value.

CouponRate

(Optional) Decimal number indicating the annual percentage rate used to determine the coupons payable on a bond.

Period

(Optional) Coupons per year of the bond. A vector of integers. Allowed values are 0, 1, 2 (default), 3, 4, 6, and 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)

  • 13 = BUS/252

EndMonthRule

(Optional) End-of-month rule. A vector. This rule applies only when Maturity is an end-of-month date for a month having 30 or fewer days. 0 = ignore rule, meaning that a bond's coupon payment date is always the same numerical day of the month. 1 = set rule on (default), meaning that a bond's coupon payment date is always the last actual day of the month.

IssueDate

(Optional) Date when an instrument was issued.

FirstCouponDate

(Optional) Date when a bond makes its first coupon payment. When FirstCouponDate and LastCouponDate are both specified, FirstCouponDate takes precedence in determining the coupon payment structure.

LastCouponDate

(Optional) Last coupon date of a bond before the maturity date. In the absence of a specified FirstCouponDate, a specified LastCouponDate determines the coupon structure of the bond. The coupon structure of a bond is truncated at the LastCouponDate regardless of where it falls and will be followed only by the bond's maturity cash flow date.

Face

(Optional) Face or par value. Default = 100.

Description

CurveObj = IRFunctionCurve.fitSvensson(Type, Settle, Instruments, 'Parameter1', Value1, 'Parameter2', Value2, ...) fits the Svensson function to bond market data. You must enter the optional arguments for Basis, Compounding, and IRFitOptionsObj as parameter/value pairs.

Examples

Settle = repmat(datenum('30-Apr-2008'),[6 1]);
Maturity = [datenum('07-Mar-2009');datenum('07-Mar-2011');...
datenum('07-Mar-2013');datenum('07-Sep-2016');...
datenum('07-Mar-2025');datenum('07-Mar-2036')];

DirtyPrice = [100.1;100.1;100.8;96.6;103.3;96.3];
CouponRate = [0.0400;0.0425;0.0450;0.0400;0.0500;0.0425];
Instruments = [Settle Maturity DirtyPrice CouponRate];
PlottingPoints = datenum('07-Mar-2009'):180:datenum('07-Mar-2036');
Yield = bndyield(DirtyPrice,CouponRate,Settle,Maturity);

SvenssonModel = IRFunctionCurve.fitSvensson('Zero',datenum('30-Apr-2008'),Instruments);

To create a plot:

plot(PlottingPoints,SvenssonModel.getParYields(PlottingPoints),'g')
hold on
scatter(Maturity,Yield,'black')

See Also

@IRFitOptions, @IRFunctionCurve

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

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