主要内容

创建和价格组合的工具

使用finportfoliopricePortfolio创建和价格的利率和股票投资组合工具。投资组合包含一个香草FixedBond,一个OptionEmbeddedFixedBond,一个香草欧洲的看涨期权香草美国的看涨期权,和一个亚洲看涨期权。

创建ratecurve对象

创建一个ratecurve对象使用ratecurve

解决= datetime (2018、9、15);ZeroTimes = [calmonths (6) calyears ([1 2 3 4 5 7 10 20 30])) ';ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307) ';ZeroDates = + ZeroTimes定居;ZeroCurve = ratecurve (“零”、结算、ZeroDates ZeroRates);

创建设备对象

使用fininstrument创建设备对象。

%香草FixedBondCouponRate = 0.0325;成熟= datetime (2038、3、15);时间= 1;VanillaBond = fininstrument (“FixedBond”,“成熟”成熟,“CouponRate”CouponRate,“时间”期,“名字”,“VanillaBond”)
VanillaBond = FixedBond属性:CouponRate: 0.0325期:1基础:0 EndMonthRule: 1主要:100 DaycountAdjustedCashFlow: 0 BusinessDayConvention:“实际”假期:NaT IssueDate: NaT FirstCouponDate: NaT LastCouponDate: NaT StartDate可以:NaT成熟度:15 - 3月- 2038的名字:“VanillaBond”
% OptionEmbeddedBond成熟= datetime (2024、9、15);CouponRate = 0.035;罢工= 100;ExerciseDates = datetime (2023、9、15);CallSchedule =时间表(ExerciseDates,罢工,“VariableNames”,{“罢工计划”});时间= 1;CallableBond = fininstrument (“OptionEmbeddedFixedBond”,“成熟”成熟,“CouponRate”CouponRate,“时间”期,“CallSchedule”CallSchedule,“名字”,“CallableBond”);%香草欧洲看涨期权ExerciseDate = datetime (2022、1、1);罢工= 96;OptionType =“电话”;CallOpt = fininstrument (“香草”,“ExerciseDate”ExerciseDate,“罢工”罢工,“OptionType”OptionType,“名字”,“EuropeanCallOption”)
CallOpt =香草与属性:OptionType:“叫“ExerciseStyle:“欧洲”ExerciseDate: 01 - 2022年1月,罢工:96姓名:“EuropeanCallOption”
%香草美式看涨期权ExerciseDate = datetime (2023、1、1);罢工= 97;OptionType =“电话”;CallOpt_American = fininstrument (“香草”,“ExerciseDate”ExerciseDate,“罢工”罢工,“OptionType”OptionType,“ExerciseStyle”,“美国”,“名字”,“AmericanCallOption”)
CallOpt_American =香草与属性:OptionType:“叫“ExerciseStyle:“美国”ExerciseDate: 01 - 2023年1月,罢工:97姓名:“AmericanCallOption”
%亚洲看涨期权ExerciseDate = datetime (2023、1、1);罢工= 102;OptionType =“电话”;CallOpt_Asian = fininstrument (“亚洲”,“ExerciseDate”ExerciseDate,“罢工”罢工,“OptionType”OptionType,“名字”,“AsianCall”)
CallOpt_Asian =亚洲的属性:OptionType:“所谓的“罢工:102 AverageType:“算术”AveragePrice: 0 AverageStartDate: NaT ExerciseStyle:“欧洲”ExerciseDate: 01 - 1月- 2023的名字:“AsianCall”

创建模型对象

使用finmodel创建HullWhiteBlackScholes模型对象。

%创建Hull-White模型卷= 0.01;α= 0.1;HWModel = finmodel (“hullwhite”,“α”α,“σ”、卷);%创建布莱克-斯科尔斯模型卷= 1;SpotPrice = 95;BlackScholesModel = finmodel (“BlackScholes”,“波动”、卷);

创建定价的人对象

使用finpricer创建折扣,IRTree,BlackScholes,莱维,BjerksundStensland定价的人对象和使用ratecurve对象的“DiscountCurve”名称-值对的论点。

%创建折扣定价的人DiscPricer = finpricer (“折扣”,“DiscountCurve”,ZeroCurve);%创建Hull-White树定价的人TreeDates =解决+ calyears (1:30);HWTreePricer = finpricer (“IRTree”,“模型”HWModel,“DiscountCurve”ZeroCurve,“TreeDates”TreeDates ');%创建BlackScholes、征税和BjerksundStensland定价的人BLSPricer = finpricer (“分析”,“DiscountCurve”ZeroCurve,“模型”BlackScholesModel,“SpotPrice”,SpotPrice);LevyPricer = finpricer (“分析”,“DiscountCurve”ZeroCurve,“模型”BlackScholesModel,“SpotPrice”SpotPrice,“PricingMethod”,“税”);BJSpricer = finpricer (“分析”,“DiscountCurve”ZeroCurve,“模型”BlackScholesModel,“SpotPrice”SpotPrice,“PricingMethod”,“BjerksundStensland”);

创建finportfolio对象

创建一个finportfolio对象包含的所有仪器和定价的人使用的对象finportfolio

myPort = finportfolio ([VanillaBond CallableBond CallOpt CallOpt_American CallOpt_Asian)”,[DiscPricer HWTreePricer BLSPricer BJSpricer LevyPricer]”)
myPort = finportfolio属性:仪器:[5 x1 fininstrument。x1 finpricer FinInstrument]定价的人:[5。FinPricer] PricerIndex: [5 x1双)数量:[5 x1双)

价格组合

使用pricePortfolio计算投资组合的价格和敏感性和工具组合。

[PortPrice, InstPrice PortSens InstSens] = pricePortfolio (myPort)
PortPrice = 237.3275
InstPrice =5×1107.4220 110.8389 7.5838 8.8705 2.6123
PortSens =表1×8价格γδλ织女星θρDV01 ______累积_____交交2840 26.354 124.28 -4.0673 418.68 0.1579 237.33 - -546.39
InstSens =5×8表价格γδλ织女星θρDV01 ______累积________ ________ ________交VanillaBond 107.42南南南南南南CallableBond 0.1579 110.84 -547.9 2839.9 -62.532南南南南EuropeanCallOption 7.5838 0.57026 0.022762 7.1435 67.763 -1.3962 153.68南AmericanCallOption 8.8705 0.5845 0.019797 6.2597 76.808 -1.8677 200.68南南AsianCall 2.6123 0.35611 0.032053 12.95 42.238 -0.80342 64.31