债券和债券期权仪器的价格组合

这个例子显示了工作流程创建和债券价格和债券期权工具组合。您可以使用finportfoliopricePortfolio价格FixedBondFixedBondOptionOptionEmbeddedFixedBondFloatBond使用仪器IRTree定价方法。

创造ratecurve目的

创建一个ratecurve使用对象ratecurve

沉降=日期时间(2018年,1,1);ZeroTimes = calyears(1:4)';ZeroRates = [0.035;0.042147;0.047345;0.052707];ZeroDates =定居+ ZeroTimes;配混= 1;ZeroCurve = ratecurve(“零”,定居,ZeroDates,ZeroRates,“私了”,复利)
ZeroCurve = ratecurve具有属性:类型: “零” 配混:1的基础:0日期:[4X1日期时间]价格:[4X1双]结清:01-JAN-2018 InterpMethod: “线性” ShortExtrapMethod: “下一个” LongExtrapMethod:“前“

建立债券和期权工具

fininstrument创建FixedBondFixedBondOptionOptionEmbeddedFixedBondFloatBond仪器对象。

CDates =日期时间([2020,1,1; 2022,1,1]);包装箱= [0.0425;0.0750];CouponRate =时间表(CDates,板条箱);到期日期时间=(2022,1,1);周期= 1;%香草FixedBondVBond = fininstrument(“FixedBond”'到期',到期,'优惠券比例',0.0425,'期',期,'名称'“vanilla_fixed”
VBond = FixedBond与属性:CouponRate:0.0425周期:1基础:0 EndMonthRule:1校长:100 DaycountAdjustedCashFlow:0 BusinessDayConvention: “实际” 假期:自然科学IssueDate:自然科学FirstCouponDate:自然科学LastCouponDate:自然科学的StartDate:自然科学到期日:01-Jan-2022名称: “vanilla_fixed”
%台阶息债券SBond = fininstrument(“FixedBond”'到期',到期,'优惠券比例',优惠券比例,'期',期,'名称'“stepped_coupon_bond”
SBond = FixedBond与属性:CouponRate:[2×1时间表]时间:1基础:0 EndMonthRule:1校长:100 DaycountAdjustedCashFlow:0 BusinessDayConvention: “实际” 假期:自然科学IssueDate:自然科学FirstCouponDate:自然科学LastCouponDate:自然科学的StartDate:自然科学成熟度:01-Jan-2022产品名称: “stepped_coupon_bond”
%FloatBond蔓延= 0;重置= 1;浮= fininstrument(“FloatBond”'到期',到期,'传播',传播,'重启', 重启,...'ProjectionCurve',ZeroCurve,'名称'“floatbond”
浮= FloatBond与性能:差:0 ProjectionCurve:[1x1的ratecurve] ResetOffset:0复位:1的基础:0 EndMonthRule:1校长:100 DaycountAdjustedCashFlow:0 BusinessDayConvention: “实际” LatestFloatingRate:NaN的假期:自然科学IssueDate:自然科学FirstCouponDate:自然科学LastCouponDate:自然科学起始日期:自然科学到期日:01-JAN-2022产品名称: “floatbond”
%看涨期权击= 100;ExerciseDates =日期时间(2020,1,1);OptionType ='呼叫';周期= 1;CallOption = fininstrument(“FixedBondOption”'罢工',罢工,'ExerciseDate',ExerciseDates,...'OptionType',OptionType,'ExerciseStyle'“美国”'键',VBond,'名称'“fixed_bond_option”
CallOption = FixedBondOption与属性:OptionType: “呼叫” ExerciseStyle: “美国” ExerciseDate:01-JAN-2020打击:100债券:[1x1的fininstrument.FixedBond]名称: “fixed_bond_option”
%可选的嵌入式键(可调用键)CDates =日期时间([2020,1,1; 2022,1,1]);包装箱= [0.0425;0.0750];CouponRate =时间表(CDates,板条箱);StrikeOE = [100;100];ExerciseDatesOE = [日期时间(2020,1,1);日期时间(2021,1,1)];CallSchedule =时间表(ExerciseDatesOE,StrikeOE,'VariableNames'{罢工计划“});CallableBond = fininstrument(“OptionEmbeddedFixedBond”'到期',到期,...'优惠券比例',优惠券比例,'期',期间,...'CallSchedule',CallSchedule,'名称'“option_embedded_fixedbond”
CallableBond = OptionEmbeddedFixedBond与属性:CouponRate:[2×1时间表]时间:1基础:0 EndMonthRule:1校长:100 DaycountAdjustedCashFlow:0 BusinessDayConvention: “实际” 假期:自然科学IssueDate:自然科学FirstCouponDate:自然科学LastCouponDate:自然科学的StartDate:自然科学成熟度:01-Jan-2022 CallDates:2×DATETIME] PutDates:为0x1 DATETIME] CallSchedule:2×时间表] PutSchedule:为0x0时间表] CallExerciseStyle: “美国” PutExerciseStyle:为0x0字符串]产品名称: “option_embedded_fixedbond”

创造HullWhite模型

finmodel创建HullWhite模型对象。

VolCurve = 0.01;AlphaCurve = 0.1;HWModel = finmodel(“hullwhite”'α',AlphaCurve,“西格玛”,VolCurve)
HWModel = HullWhite与属性:阿尔法:0.1000西格玛:0.0100

创造IRTree定价者的HullWhite模型

finpricer创建IRTree对于定价者对象HullWhite建模和使用ratecurve对象为'DiscountCurve'名称 - 值对的参数。

HWTreePricer = finpricer(“IRTree”'模型',HWModel,'DiscountCurve',ZeroCurve,'TreeDates',ZeroDates)
HWTreePricer = HWBKTree与属性:树:[1x1的结构] TreeDates:[4X1日期时间]型号:[1x1的finmodel.HullWhite] DiscountCurve:[1x1的ratecurve]

创造finportfolio对象,然后添加买回债券仪

创建一个finportfolio与香草键,阶梯息债券,浮置接合,并且该呼叫选项对象。

myportfolio = finportfolio([VBond,SBond,浮动,CallOption],HWTreePricer,[1,2,2,1])
myportfolio = finportfolio与属性:仪器:[4X1 fininstrument.FinInstrument]定价器:[1x1的finpricer.irtree.HWBKTree] PricerIndex:[4X1双]数量:[4X1双]

addInstrument在可赎回债券工具添加到现有的投资组合。

myportfolio = addInstrument(myportfolio,CallableBond,HWTreePricer,1)
myportfolio = finportfolio与属性:仪器:[5X1 fininstrument.FinInstrument]定价器:[1x1的finpricer.irtree.HWBKTree] PricerIndex:[5X1双]数量:[5X1双]
myportfolio.PricerIndex
ANS =5×11 1 1 1 1

PricerIndex属性具有等于长度的长度的仪器中的对象finportfolio对象并存储的定价者用于每个仪器对象的索引。在这种情况下,因为只有一个定价者,每台仪器必须使用定价者。

价格组合

pricePortfolio计算价格和敏感性的投资组合,并在投资组合中债券和期权工具。

格式银行[PortPrice,InstPrice,PortSens,InstSens] = pricePortfolio(myportfolio)
PortPrice = 600.40
InstPrice =5×196.59 204.14 200.00 0.05 99.62
PortSens =1×4表价格维加伽玛三角洲______ ______ _______ ________ 600.40 -91.88 5729.66 -1285.76
InstSens =5×4表价格维加伽玛三角洲______ _______ _______ _______ vanilla_fixed 96.59 -0.00 1603.49 -344.81 stepped_coupon_bond 204.14 0.00 3364.60 -725.96 200.00 floatbond 0.00 -0.00 -0.00 fixed_bond_option 0.05 12.49 24.15 -3.69 option_embedded_fixedbond 99.62 -104.37 737.41 -211.30