主要内容

irbootstrap

从市场数据引导利率曲线

描述

例子

外曲= irbootstrap (BootInstruments,解决)利率期限结构创建一个数据结构来存储数据。的外曲输出是一个ratecurve对象。

例子

外曲= irbootstrap (___,名称,值)指定选项使用一个或多个名称-值对参数除了任何输入参数组合在前面的语法。例如,外曲= irbootstrap (BootInstruments,解决“类型”,“零”,“复合”,2,‘基础’,5,“InterpMethod”,“立方”)接连的零线BootInstruments

例子

全部折叠

定义存款和交换参数

解决= datetime (2018 3 21);DepRates = [。0050769 .0054934 .0061432 .0072388 .0093263]'; DepTimes = [1 2 3 6 12]'; DepDates = datemnth(Settle,DepTimes); nDeposits = length(DepTimes); SwapRates = [.0112597 0;.0128489 0;.0138917 0;.0146135 0;.0151175 0;.0155184 0;。0158536 0;。0161435 0]; SwapTimes = (2:9)'; SwapDates = datemnth(Settle,12*SwapTimes); nSwaps = length(SwapTimes); nInst = nDeposits + nSwaps;

创建一个向量的市场交换工具

使用fininstrument创建一个向量的市场存款交换仪的对象。

BootInstruments (nInst, 1) = fininstrument.FinInstrument;2 = 1:长度(DepDates) BootInstruments (ii) = fininstrument (“存款”,“成熟”DepDates (ii),“速度”DepRates (ii));结束2 = 1:长度(SwapDates) BootInstruments (ii + nDeposits) = fininstrument (“交换”,“成熟”SwapDates (ii),“LegRate”,(SwapRates (ii) 0]);结束

创建ratecurve对象零利率曲线

使用irbootstrap创建一个ratecurve对象的零利率曲线。

ZeroCurve = irbootstrap (BootInstruments解决)
ZeroCurve = ratecurve属性:类型:“零”组合:1基础:0日期:x1 datetime [13]: [13 x1双]解决:21 - 3月- 2018 InterpMethod:“线性”ShortExtrapMethod:“下一个”LongExtrapMethod:“以前”

这个例子显示了如何创建一个ratecurve对象使用irbootstrap存款交换仪器和一个DiscountCurve贴现现金流。

解决= datetime (2021 4 15);crvDates =解决+ [calmonths ([1 2 3 6]) calyears ([1 2 3 5 7 10 20 30])) ';crvRates = [0.0004 0.0004 0.0005 0.0006 0.0008 0.0018 0.0037 0.0088 0.013 0.0165 0.022 0.0233) ';DiscountCurve = ratecurve (“零”、结算、crvDates crvRates);DepRates = (0.002 - 0.0021 0.0023 - 0.0024 .0028) ';DepDates =解决+ calmonths ([1 2 3 6 12]”);SwapRates = (0.0041 0; 0.0057 0; 0.017 0; 0.0193 0; 0.024 0; 0.027 0];SwapTimes = (2 3 5 10 20 30) ';SwapDates = datemnth(定居,12 * SwapTimes);BootInstruments = [fininstrument (“存款”,“成熟”DepDates,“速度”,DepRates);fininstrument (“交换”,“成熟”SwapDates,“LegRate”SwapRates)];ZeroCurve = irbootstrap (BootInstruments,结算,“DiscountCurve”DiscountCurve)
ZeroCurve = ratecurve属性:类型:“零”组合:1基础:0日期:x1 datetime [11]: [11 x1双]解决:15 - 4月- 2021 InterpMethod:“线性”ShortExtrapMethod:“下一个”LongExtrapMethod:“以前”

创建一个BootInstruments变量作为输入参数irbootstrap创建一个ratecurve对象。的BootInstruments变量OISFuture仪器对象月SOFR期货和三个月SOFR期货,和一个OvernightIndexedSwap仪对象。

创建工具

使用fininstrument创建一个OISFuture为一个月SOFR期货工具对象。

解决= datetime(2021年3、4);HFDates = datetime (2021 3 1) + caldays (0:3)”;HistFixing =时间表(HFDates [0.02; 0.04; 0.04; 0.02]);%以下数据:https://www.cmegroup.com/trading/interest-rates/stir/one-month-sofr_quotes_globex.htmlPrices_1M = (99.97 99.96 99.95) ';Maturity_1M = lbusdate(2021年,[3 4 5]的[][],“datetime”);StartDate_1M = fbusdate(2021年,[3 4 5]的[][],“datetime”);FutInstruments_1M = fininstrument (“OISFuture”,“成熟”Maturity_1M,“QuotedPrice”Prices_1M,“StartDate可以”StartDate_1M,“方法”,“平均”,“HistoricalFixing”HistFixing,“名字”,“1 monthsofrfuture”)
FutInstruments_1M =3×1对象3 x1 OISFuture数组属性:QuotedPrice方法基础StartDate可以成熟名义BusinessDayConvention假期ProjectionCurve HistoricalFixing名字

使用fininstrument创建一个OISFuture为三个月SOFR期货工具对象。

%以下数据:https://www.cmegroup.com/trading/interest-rates/stir/three-month-sofr_quotes_globex.htmlPrices_3M = (99.92 - 99.895 99.84 - 99.74) ';Dates_3M_Maturity = thirdwednesday ([6 9 12 3], (2021 2021 2021 2022),“datetime”);Dates_3M_Start = thirdwednesday([3 6 9 12]“, 2021年,“datetime”);FutInstruments_3M = fininstrument (“OISFuture”,“成熟”Dates_3M_Maturity,“QuotedPrice”Prices_3M,“StartDate可以”Dates_3M_Start,“HistoricalFixing”HistFixing,“名字”,“3 monthsofrfuture”);

使用fininstrument创建一个OvernightIndexedSwap仪对象。

SOFRSwapRates = [。0023 0;。0064 0;。013 0;。017 0;。0175 0]; SOFRSwapTimes = [3 5 10 20 30]; SOFRSwapDates = datemnth(Settle,12*SOFRSwapTimes)'; SOFRSwapInstruments = fininstrument(“OvernightIndexedSwap”,“成熟”SOFRSwapDates,“LegRate”SOFRSwapRates,“名字”,“overnight_swap_instrument”)
SOFRSwapInstruments =5×1对象5 x1 OvernightIndexedSwap数组属性:LegRate LegType重置基础名义HistoricalFixing ResetOffset ProjectionCurve BusinessDayConvention假期EndMonthRule StartDate可以成熟的名字

定义BootInstruments三种类型的仪器。

BootInstruments = [FutInstruments_1M; FutInstruments_3M; SOFRSwapInstruments]
BootInstruments =12×1对象12 x1异构FinInstrument (OISFuture OvernightIndexedSwap)数组属性:名称

创建ratecurve对象

使用irbootstrap创建一个ratecurve对象。

SOFRCurve = irbootstrap (BootInstruments解决)
SOFRCurve = ratecurve属性:类型:“零”组合:1基础:0日期:x1 datetime [12]: [12 x1双]解决:04 - mar - 2021 InterpMethod:“线性”ShortExtrapMethod:“下一个”LongExtrapMethod:“以前”

创建BootInstruments为多个存款、STIRFuture,交换工具,然后使用irbootstrap来创建和显示ratecurve对象。

创建工具

使用fininstrument创建一个存款仪对象。

解决= datetime (2021、6、15);DepRates = (0.0016 - 0.0017 .00175) ';DepDates =解决+ calmonths ((1 2 3) ');存款= fininstrument (“存款”,“成熟”DepDates,“速度”DepRates,“名字”,“deposit_instrument”)
存款=3×1对象3 x1存款数组属性:利率时期基础成熟主要BusinessDayConvention节日名称

使用fininstrument创建一个STIRFuture仪对象。

FutureRates = (0.002 0.0025 0.0035) ';FutMat = [datetime (2021、9、15) datetime (2021、12、15) datetime (2022 - 3,16)] ';FutEndDates = [datetime (2021、12、15) datetime (2022、3、15) datetime(15) 2022年,6日]';期货= fininstrument (“STIRFuture”,“成熟”FutMat,“RateEndDate”FutEndDates,“QuotedPrice”,100 - 100 * FutureRates,“名字”,“stir_future_instrument”)
期货=3×1对象3 x1 STIRFuture数组属性:QuotedPrice基础RateEndDate成熟度名义BusinessDayConvention假期ProjectionCurve名字

使用fininstrument创建一个交换仪对象。

SwapRates = [。0063 0;。0108 0;。013 0;。015 0;0.017 0;.018 0;0.019 0]; SwapTimes = [2 5 7 10 15 20 30]'; SwapDates = datemnth(Settle,12*SwapTimes); Swaps = fininstrument(“交换”,“成熟”SwapDates,“LegRate”SwapRates,“名字”,“swap_instrument”)
掉期=7×1对象7 x1交换数组属性:LegRate LegType重置基础名义LatestFloatingRate ResetOffset DaycountAdjustedCashFlow ProjectionCurve BusinessDayConvention假期EndMonthRule StartDate可以成熟的名字

定义BootInstruments三个工具。

BootInstruments =(存款、期货、掉期);

创建ratecurve对象使用irbootstrap

使用irbootstrap创建一个ratecurve对象。

ConvexityAdj = (1:3) / 10000;ZeroCurve = irbootstrap (BootInstruments,结算,“ConvexityAdjustment”ConvexityAdj,“InterpMethod”,“pchip”)
ZeroCurve = ratecurve属性:类型:“零”组合:1基础:0日期:x1 datetime [13]: [13 x1双]解决:15 - 2021年6月——InterpMethod:“pchip”ShortExtrapMethod:“下一个”LongExtrapMethod:“以前”

情节引导曲线

PlottingDates =解决+ calmonths (1:360);情节(PlottingDates zerorates (ZeroCurve PlottingDates))包含(的期限(年))ylabel (“零率”)标题(“引导曲线”)

图包含一个坐标轴对象。坐标轴对象与标题引导曲线包含一个类型的对象。

输入参数

全部折叠

工具的集合,指定为仪器对象数组。仪器可以包含的集合存款,交换,联邦铁路局,STIRFuture,OISFuture,OvernightIndexedSwap仪器。

数据类型:对象

结算日期,指定为一个标量datetime,串行日期号码,日期特征向量,或日期字符串。

数据类型:|字符|字符串|datetime

名称-值参数

指定可选的逗号分隔条名称,值参数。的名字参数名称和吗价值相应的价值。的名字必须出现在引号。您可以指定几个名称和值对参数在任何顺序Name1, Value1,…,的家

例子:外曲= irbootstrap (BootInstruments,解决“类型”,“零”,“复合”,2,‘基础’,5,“InterpMethod”,“立方”)

利率曲线类型,指定为逗号分隔组成的“类型”矢量和标量字符串或字符。

请注意

当你使用irbootstrap,您所指定的值类型会影响曲线结构,因为它影响的数据类型是插值(远期利率,零利率或折扣因素)在整个启动过程中。

数据类型:字符|字符串

复合频率,指定为逗号分隔组成的“复合”和一个标量数字使用支持的值:金宝app1,0,1,2,3,4,6,或12

数据类型:

日计数的基础上,指定为逗号分隔组成的“基础”和一个标量整数。

  • 0 -实际/实际

  • 1 - 30/360 (SIA)

  • 2 -实际/ 360

  • 3 -实际/ 365

  • 4 - 30/360 (PSA)

  • 5 - 30/360 (ISDA)

  • 6 - 30/360(欧洲)

  • 实际/ 7 - 365(日本)

  • 8 -实际/实际(国际)

  • 9 -实际/ 360(国际)

  • 实际/ 10 - 365(国际)

  • 11 - 30/360E(国际)

  • 实际/ 12 - 365 (ISDA)

  • 13 -总线/ 252

有关更多信息,请参见基础

数据类型:

插值方法,指定为逗号分隔组成的“InterpMethod”和一个标量字符串或字符使用支持向量的值。金宝app插值方法的更多信息,请参阅interp1

数据类型:字符|字符串

外推法对数据在第一个数据之前,指定为逗号分隔组成的“ShortExtrapMethod”和一个标量字符串或字符使用支持向量的值。金宝app插值方法的更多信息,请参阅interp1

数据类型:字符|字符串

去年数据外推法的数据后,指定为逗号分隔组成的“LongExtrapMethod”和一个标量字符串或字符使用支持向量的值。金宝app插值方法的更多信息,请参阅interp1

数据类型:字符|字符串

ratecurve折现现金流对象,指定为逗号分隔组成的“DiscountCurve”和先前创建的名称ratecurve对象。

数据类型:对象

为一个或多个凸性调整STIRFuture仪器,指定为逗号分隔组成的“ConvexityAdjustment”和一个NFutures——- - - - - -1向量的数值。

请注意

你只能使用ConvexityAdjustment当使用irbootstrap与一个STIRFuture乐器。的长度ConvexityAdjustment向量的数量必须匹配STIRFuture仪器。

数据类型:

输出参数

全部折叠

率曲线,作为一个返回ratecurve对象。对象具有以下属性:

  • 类型

  • 解决

  • 复合

  • 基础

  • 日期

  • 利率

  • InterpMethod

  • ShortExtrapMethod

  • LongExtrapMethod

介绍了R2020a