主要内容

fitfunction

Custom fit interest-rate curve object to bond market data

描述

example

CurveObj= fitFunction(类型,Settle,FunctionHandle,乐器s,irfitoptionsobj)fits a bond to a custom fitting function.

example

CurveObj= fitFunction(___,名称,价值)添加可选的名称值对参数。

例子

全部收缩

This example shows how to usefitfunction自定义适合债券。

settle = repmat(datenum(datenum)('30-Apr-2008'),[6 1]);成熟= [datenum('07-Mar-2009'); datenum('07 -MAR-2011');...datenum('07-Mar-2013'); datenum('07-Sep-2016');...datenum('07-Mar-2025'); datenum('07 -MAR-2036')]; CleanPrice = [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 CleanPrice CouponRate]; CurveSettle = datenum('30-Apr-2008');OptOptions = optimoptions('lsqnonlin','展示','iter');functionHandle = @(t,theta)polyval(theta,t);custommodel = irfunctioncurve.fitfunction('零',曲线,...功能手,仪器,...IRFitOptions([.05 .05 .05],'FitType','price',...'OptOptions',OptOptions))
一阶迭代函数计算f(x)步骤最优性0 4 38036.7 4.92E+04 1 8 38036.7 10 4.92E+04 2 12 38036.7 2.5 4.92E+04 3 16 38036.7 0.625 4.925 4.92E 4.92E4.92e+04 5 24 30741.5 0.0390625 1.72e+05 6 28 30741.5 0.078125 1.72e+05 7 32 30741.5 0.0195312 1.72e+05 8 36 28713.6 0.00488281 2.33e+05 9 40 20323.3 0.00976562 9.47e+05 10 44 20323.3 0.0195312 9.47e+05 11 48 20323.3 0.00488281 9.47e+05 12 52 20323.3 0.0012207 9.47e+05 13 56 19698.8 0.000305176 1.08e+06 14 60 17493 0.000610352 7e+06 15 64 17493 0.0012207 7e+06 16 68 17493 0.000305176 7e+06 17 72 15455.17.62939E-05 2.25E+07 18 76 15455.1 0.000177499 2.25E+07 19 80 13317.1 3.8147E-05 3.18e-07+07 20 84 1284 12865.3 7.62939E-07.62939E-05 7.83E 7.83E 7.83E 7.83E 7.83E 22 22 22 22 2222988.6293EEM92 11747.6 0.000152588 1.45e+05 23 96 11720.9 0.000305176 2.33e+05 24 100 11667.2 0.000610352 1.48e+05 25 104 11558.6 0.0012207 3.55e+05 26 108 11335.5 0.00244141 1.57e+05 27 112 10863.8 0.00488281 6.36e+05 28 116 9797.140.00976562 2.53E+05 29 1206882.83 0.0195312 9.18e+05 30 124 6882.83 0.0373992 9.18e+05 31 128 3218.45 0.00934981 1.96e+06 32 132 612.703 0.0186996 3.01e+06 33 136 13.0998 0.0253882 3.05e+06 34 140 0.0762922 0.00154002 5.05e+04 35 144 0.0731652 3.61102E-06 29.9 36 148 0.0731652 6.32265E-08 0.08 0.063本地最小值。LSQNONLIN停止了,因为平方与其初始值的最终变化小于函数公差的值。
CustomModel = Type: Zero Settle: 733528 (30-Apr-2008) Compounding: 2 Basis: 0 (actual/actual)

输入参数

全部收缩

利率曲线的类型, specified by using a scalar character vector.

Data Types:char

结算日期的利率curve, specified using a scalar date character vector or serial date number.

Data Types:双倍的|char

使用函数句柄指定的定义利率曲线的函数句柄。该功能句柄需要两个数字向量(到期时间和功能系数的向量),并返回一个数字输出(利率或折现因子)。有关定义函数句柄的更多信息,请参见MATLAB®Programming Fundamentals documentation.

Data Types:function_handle

仪器,使用N-经过-4数据矩阵第一列是Settledate, the second column is到期, the third column is the clean price, and the fourth column is a优惠券比例for the bond.

Data Types:双倍的

IRFitOptions对象,使用先前创建的对象指定的对象使用IRFitOptions.

Data Types:object

Name-Value Arguments

将可选的参数对Name1=Value1,...,NameN=ValueN, 在哪里Name是the argument name and价值是相应的值。名称值参数必须在其他参数之后出现,但是对的顺序并不重要。

Before R2021a, use commas to separate each name and value, and encloseNamein quotes.

例子:CurveObj= IRFunctionCurve.fitFunction('Zero',CurveSettle,functionHandle,Instruments,IRFitOptions([.05 .05 .05],'FitType','price','OptOptions',OptOptions))

Name-Value Pair Arguments for All Bond Instruments

全部收缩

复合frequency per-year for theIRFunctionCurveobject, specified as the comma-separated pair consisting of“复合”和a scalar numeric using one of the supported values:

  • −1= Continuous compounding

  • 0= Simple interest (no compounding)

  • 1=年度复合

  • 2=半年度复合

  • 3=每年复合三次

  • 4=季度复合

  • 6= Bimonthly compounding

  • 12=每月复合

Data Types:双倍的

Day count basis of the bond, specified as the comma-separated pair consisting of'基础'和标量整数。

  • 0-实际/实际/实际

  • 1 - 30/360(SIA)

  • 2 - 实际/360

  • 3 - 实际/365

  • 4 - 30/360(PSA)

  • 5 - 30/360(ISDA)

  • 6 — 30/360 (European)

  • 7 — actual/365 (Japanese)

  • 8 - 实际/实际(ICMA)

  • 9 - 实际/360(ICMA)

  • 10 — actual/365 (ICMA)

  • 11 - 30/360E(ICMA)

  • 12 — actual/365 (ISDA)

  • 13 - 巴士/252

有关更多信息,请参阅基础.

Data Types:双倍的

Name-Value Pair Arguments for Each Bond Instrument

全部收缩

债券每年的优惠券,指定为逗号分隔对“仪器period'和a scalar numeric value.

Data Types:双倍的

Day count basis of the bond, specified as the comma-separated pair consisting of“仪器基金”和标量整数。

  • 0-实际/实际/实际

  • 1 - 30/360(SIA)

  • 2 - 实际/360

  • 3 - 实际/365

  • 4 - 30/360(PSA)

  • 5 - 30/360(ISDA)

  • 6 — 30/360 (European)

  • 7 — actual/365 (Japanese)

  • 8 - 实际/实际(ICMA)

  • 9 - 实际/360(ICMA)

  • 10 — actual/365 (ICMA)

  • 11 - 30/360E(ICMA)

  • 12 — actual/365 (ISDA)

  • 13 - 巴士/252

Note

仪器节目区分债券仪器基础value from the interest-rate curve's基础value.

有关更多信息,请参阅基础.

Data Types:双倍的

月底规则, specified as the comma-separated pair consisting of'InstrumentEndMonthRule'和a logical value. This rule applies only when到期是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=setrule on (default), meaning that a bond's coupon payment date is always the last actual day of the month.

Data Types:logical

仪器发行日期,指定为逗号分隔对'InstrumentIssueDate'和标量日期字符向量或序列日期编号。

Data Types:char|双倍的

债券进行第一张优惠券付款的日期(债券有不规则的第一张优惠券时期),指定为逗号分隔对“仪器firstcoupdate”和标量日期字符向量或序列日期编号。什么时候乐器FirstCouponDate乐器LastCouponDate都指定,乐器FirstCouponDatetakes precedence in determining the coupon payment structure. If you do not specify a乐器FirstCouponDate,现金流付款日期由其他投入确定。

Data Types:char|双倍的

到期日之前的债券的最后一张优惠券日期(当债券的最后一票期不规则时使用),指定为逗号分隔的一对'InstrumentLastCouponDate'和标量日期字符向量或序列日期编号。在没有指定的情况下乐器FirstCouponDate,指定乐器LastCouponDatedetermines the coupon structure of the bond. The coupon structure of a bond is truncated at the乐器LastCouponDate,无论它在哪里掉落,仅此后才是债券的成熟现金流日期。如果您不指定乐器LastCouponDate,现金流付款日期由其他投入确定。

Data Types:char|双倍的

面值或标准价值, specified as the comma-separated pair consisting of'InstrumentFace'和标量数字。

Data Types:双倍的

Note

什么时候using乐器名称值对,您可以通过指定债券指定简单的兴趣乐器Periodvalue as0. If仪器节目乐器Period未为债券指定,使用以下默认值:仪器节目0(法案/法案)和乐器Period2.

Output Arguments

全部收缩

Curve model, returned as a structure.

Version History

Introduced in R2008b