主要内容

创建并定价工具组合

使用finportfolio而且pricePortfolio创建利率和股票工具的投资组合并对其定价。这个投资组合包含一个香草FixedBond,一个OptionEmbeddedFixedBond,一个香草欧洲看涨期权,a香草美国看涨期权和亚洲看涨期权。

创建ratecurve对象

创建一个ratecurve对象使用ratecurve

Settle = 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 = Settle + ZeroTimes;零曲线=利率曲线(“零”、结算、ZeroDates ZeroRates);

创建仪器对象

使用fininstrument创建仪器对象。

%香草固定债券CouponRate = 0.0325;成熟度= datetime(2038,3,15);周期= 1;VanillaBond =仪器(“FixedBond”“成熟”成熟,“CouponRate”CouponRate,...“时间”期,“名字”“VanillaBond”
VanillaBond =固定债券与属性:券息率:0.0325周期:1基础:0结束月规则:1本金:100 daycountadjuststed现金流:0营业日惯例:“实际”假期:NaT发布日期:NaT第一券息日期:NaT最后券息日期:NaT开始日期:NaT到期日期:15-Mar-2038名称:“VanillaBond”
% OptionEmbeddedBond成熟度= datetime(2024,9,15);CouponRate = 0.035;罢工= 100;ExerciseDates = datetime(2023,9,15);CallSchedule =时间表(演习日期,罢工,“VariableNames”, {“罢工计划”});周期= 1;CallableBond = fininstrument(“OptionEmbeddedFixedBond”“成熟”成熟,...“CouponRate”CouponRate,“时间”期,...“CallSchedule”CallSchedule,...“名字”“CallableBond”);香草欧洲看涨期权ExerciseDate = datetime(202,1,1);罢工= 96;OptionType =“电话”;仪器仪表(“香草”“ExerciseDate”ExerciseDate,“罢工”罢工,...“OptionType”OptionType,“名字”“EuropeanCallOption”
CallOpt =香草与属性:OptionType: "call" exercisstyle: "european" ExerciseDate: 01-Jan-2022罢工:96名称:"EuropeanCallOption"
普通美国看涨期权ExerciseDate = datetime(2023,1,1);罢工= 97人;OptionType =“电话”;CallOpt_American = fininstrument(“香草”“ExerciseDate”ExerciseDate,“罢工”罢工,...“OptionType”OptionType,“ExerciseStyle”“美国”...“名字”“AmericanCallOption”
CallOpt_American =香草与属性:OptionType: "call"锻练样式:"american"锻练日期:01- 01- 2023罢工: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 exercisstyle:“欧洲”ExerciseDate: 01-Jan-2023名称:“AsianCall”

创建模型对象

使用finmodel创建HullWhite而且BlackScholes模型对象。

创建Hull-White模型Vol = 0.01;Alpha = 0.1;HWModel = finmodel(“hullwhite”“α”α,“σ”、卷);创建Black-Scholes模型Vol = 1;SpotPrice = 95;BlackScholesModel = finmodel(“BlackScholes”“波动”、卷);

创建price对象

使用finpricer创建折扣IRTreeBlackScholes莱维,BjerksundStensland对象,并使用ratecurve对象的“DiscountCurve”名称-值对参数。

%创建折扣价格DiscPricer = finpricer(“折扣”“DiscountCurve”, ZeroCurve);%创建船体-白色树价格TreeDates = Settle + calyears(1:30);hwtreeprice = finpricer(“IRTree”“模型”HWModel,“DiscountCurve”ZeroCurve,...“TreeDates”TreeDates ');%创建BlackScholes, Levy和BjerksundStensland价格BLSPricer = finpricer(“分析”“DiscountCurve”ZeroCurve,“模型”BlackScholesModel,“SpotPrice”, SpotPrice);LevyPricer = finpricer(“分析”“DiscountCurve”ZeroCurve,“模型”BlackScholesModel,...“SpotPrice”SpotPrice,“PricingMethod”“税”);金融英语:finpricer“分析”“DiscountCurve”ZeroCurve,“模型”BlackScholesModel,...“SpotPrice”SpotPrice,“PricingMethod”“BjerksundStensland”);

创建finportfolio对象

创建一个finportfolio对象,该对象包含使用的所有instrument和pricer对象finportfolio

myPort = finportfolio([VanillaBond CallableBond CallOpt CallOpt_American CallOpt_Asian]',...[DiscPricer HWTreePricer BLSPricer BJSpricer LevyPricer]')
myPort = finportfolio with properties: Instruments: [5x1 fininstrument.]定价:[5x1 finpricer。]finpricerindex: [5x1 double]数量:[5x1 double]

价格组合

使用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表价格Delta Gamma Lambda Vega Theta Rho DV01 ______ _______ ________ ______ _______ ________ ______ ______ VanillaBond 107.42 NaN NaN NaN NaN NaN NaN NaN NaN 0.1579 CallableBond 110.84 -547.9 2839.9 NaN -62.532 NaN NaN EuropeanCallOption 7.5838 0.57026 0.022762 7.1435 67.763 -1.3962 153.68 NaN AmericanCallOption 8.8705 0.5845 0.019797 6.2597 76.808 -1.8677 200.68 NaN AsianCall 2.6123 0.35611 0.032053 12.95 42.238 -0.80342 64.31 NaN
Baidu
map