这个例子展示了如何校准偏移SABR
a的模型参数掉期期权
当你使用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)转变,的百分比变化)]);
掉期期权
使用校准仪器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)],“线型”,“——”);包含(“罢工”);标题(“掉期期权价格”);