主要内容

校准交换仪器的移位SABR模型参数

这个例子展示了如何校准偏移SABRa的模型参数掉期期权当你使用SABR定价方法。

市场数据加载

%零线ValuationDate = datetime (“5 - 3月- 2016“场所”“en_US”);zeroates = datemnth(ValuationDate,[1 2 3 6 9 12*[1 2 3 4 5 6 7 8 9 10 12])';ZeroRates = [-0.33 -0.28 -0.24 -0.12 -0.08 -0.03 0.015 0.028...0.033 0.042 0.056 0.095 0.194 0.299 0.415 0.525]'/100;复合= 1;ZeroCurve = ratecurve (“零”, ZeroDates ValuationDate ZeroRates,“复合”复合)
ZeroCurve =带有属性的比率曲线:类型:" 0 "复利:1基础:0日期:[16x1 datetime]利率:[16x1 double]定值:2016年3月05日InterpMethod: "linear" ShortExtrapMethod: "next" LongExtrapMethod: "previous"
定义交换SwaptionSettle = datetime (“5 - 3月- 2016“场所”“en_US”);SwaptionExerciseDate = datetime (“5 - 3月- 2017“场所”“en_US”);SwaptionStrikes = (-0.6:0.01:1.6) / 100;%包括消极打击SwapMaturity = datetime (“5 - 3月- 2022“场所”“en_US”);标的掉期的期限OptSpec =“电话”

通过创建计算正向交换速率交换仪器

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

LegRate = [0 0];交换= fininstrument (“交换”“成熟”SwapMaturity,“LegRate”LegRate,“LegType”,[“固定”“浮动”],...“ProjectionCurve”ZeroCurve,“StartDate可以”SwaptionExerciseDate)
交换=交换与属性:LegRate: [0 0] LegType:[“固定”“浮动”]重置:[2 2]基础:[0 0]名义:100 LatestFloatingRate:[南南]ResetOffset: [0 0] DaycountAdjustedCashFlow: [0 0] ProjectionCurve: [1 x2 ratecurve] BusinessDayConvention:(“实际”“实际”)假期:NaT EndMonthRule: [1] StartDate可以:05 - mar - 2017成熟:05 - mar - 2022的名字:“
ZeroCurve ForwardValue = parswaprate(交换)
ForwardValue = 7.3271 e-04

加载市场隐含波动率数据

市场掉期波动率是以转移的黑色波动率来报价的0.8百分比变化。

StrikeGrid = (-0.5;-0.25;-0.125;0;0.125;0.25;0.5;1.0;1.5) / 100;MarketStrikes = ForwardValue + StrikeGrid; Shift = 0.008;0.8%变动MarketShiftedBlackVolatilities = (21.1;15.3;14.0;14.6;16.0;17.7;19.8;23.9;26.2) / 100;ATMShiftedBlackVolatility = MarketShiftedBlackVolatilities (StrikeGrid = = 0);

调整了SABR模型参数

β参数在0.5.使用波动来计算隐含波动率。

β= 0.5;校准Alpha, Rho和NuobjFun = @(X) marketshiftedblackvolatility - finpricer(“分析”“模型”...finmodel (“SABR”“α”X (1),“β”,β,的ρ, X (2),“怒”, X (3),“转变”转变)...“DiscountCurve”, zeroccurve), swaptionexercisdate, ForwardValue, MarketStrikes);X = lsqnonlin(objFun, [0.5 0 0.5], [0 -1 0], [Inf 1 Inf]);
局部最小值。Lsqnonlin停止的原因是相对于初始值的平方和的最终变化小于函数的容差值。
α= X (1);ρ= X (2);ν= X (3);

创建SABR模型使用校准参数

使用finmodel创建一个SABR模型对象。

SABRModel = finmodel (“SABR”“α”α,“β”,β,的ρρ,“怒”ν,“转变”转变)
SABR model = SABR with properties: Alpha: 0.0135 Beta: 0.5000 Rho: 0.4654 Nu: 0.4957 Shift: 0.0080

创建SABR定价的人使用校准SABR模型和计算波动性

使用finpricer创建一个SABR对象,并使用ratecurve对象的“DiscountCurve”名称-值对的论点。

SABRPricer = finpricer (“分析”“模型”SABRModel,“DiscountCurve”ZeroCurve)
DiscountCurve: [1x1 ratecurve] Model: [1x1 finmodel。SABR]
sabrshiftedblackvolatility =波动性(SABRPricer, swaptionexercisdate, ForwardValue, SwaptionStrikes)
SABRShiftedBlackVolatilities =221×10.2978 0.2911 0.2848 0.2787 0.2729 0.2673 0.2620 0.2568 0.2518 0.2470⋮
图;情节(MarketStrikes MarketShiftedBlackVolatilities,“o”...SwaptionStrikes SABRShiftedBlackVolatilities);甘氨胆酸h =;线([0],[min (h.YLim), max (h.YLim)],“线型”“——”);ylim([0.13 - 0.31])包含(“罢工”);传奇(“市场报价”“转移SABR”“位置”“东南”);标题([“移位的黑色波动率(”num2str(* 100)转变,的百分比变化)]);

图中包含一个轴对象。标题为shift Black Volatility (0.8% shift)的轴对象包含3个类型为line的对象。这些对象代表市场报价,移位SABR。

价格掉期期权使用校准仪器SABR模型和SABR定价的人

%创建交换工具NumInst =长度(SwaptionStrikes);swap (NumInst, 1) = fininstrument(“掉期期权”...“罢工”SwaptionStrikes (1)“ExerciseDate”SwaptionExerciseDate (1)“交换”、交换);k = 1:NumInst Swaptions(k) = 1“掉期期权”“罢工”SwaptionStrikes (k),...“ExerciseDate”SwaptionExerciseDate,“交换”交换,“OptionType”, OptSpec);结束掉期期权
掉期期权=221×1对象16x1带有属性的交换数组:OptionType exercisstyle exercisdate Strike Swap Name⋮
%使用SABR定价器的价格互换SwaptionPrices =价格(SABRPricer、掉期期权);图;情节(SwaptionStrikes SwaptionPrices,“r”);甘氨胆酸h =;线([0],[min (h.YLim), max (h.YLim)],“线型”“——”);包含(“罢工”);标题(“掉期期权价格”);

图中包含一个轴对象。具有标题交换价格的axes对象包含两个类型为line的对象。