主要内容

价格波尔多利奥

计算投资组合的价格和敏感度

描述

例子

PortPriceInstprice.PortSensInstSens) = pricePortfolio (inport.计算先前使用的仪器组合的价格和敏感性finportfolio

例子

全部折叠

finportfolio价格波尔多利奥创建一个包含aFixedBond乐器和美国人香草选择工具。

创建FixedBond仪对象

fininstrument创建一个FixedBond仪器对象。

FixB = fininstrument (“FixedBond”“成熟”,DateTime(2022,9,15),'优惠券比例',0.05,“名字”“fixed_bond”
FixB = FixedBond with properties: CouponRate: 0.0500 Period: 2 Basis: 0 EndMonthRule: 1 Principal: 100 DaycountAdjustedCashFlow: 0 BusinessDayConvention:“实际”假期:NaT issueddate: NaT FirstCouponDate: NaT LastCouponDate: NaT StartDate: NaT Maturity: 15- september 2022名称:“fixed_bond”

创建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]';zeroates = Settle + ZeroTimes;myRC = ratecurve (“零”,沉淀,零氮酸盐,零)
myrc = patterfurve with属性:类型:“零”复合:-1基础:0日期:[10x1 DATETIME]率:[10x1 DOUBLE]定位:15-SEP-2018 Interpmethod:“Linear”ShortextrapMethod:“下一步”Longextrapmethod:“以前的”

创建折扣定价的人对象FixedBond仪器

finpricer创建一个折扣对象,并使用ratecurve对象'折扣'名称-值对的论点。

fbpricer = finpricer(“折扣”'折扣',myrc)
折扣曲线:[1x1率曲线]

创建香草仪对象

fininstrument创造一个美国人香草仪器对象。

成熟= datetime(2023、9、15);AmericanOpt = fininstrument (“香草”“ExerciseDate”成熟,'罢工', 120,“ExerciseStyle”“美国”“名字”“vanilla_option”
美国式:"american" exercisdate: 15-Sep-2023 Strike: 120 Name: "vanilla_option"

创建黑暗炮模型对象香草仪器

Finmodel.创建一个黑暗炮模型对象。

BSModel = finmodel (“BlackScholes”'挥发性', 0.12)
BSModel = BlackScholes with properties:波动性:0.1200 Correlation: 1

创建BjerksundStensland定价的人对象香草仪器

finpricer为此创建一个分析定价对象BjerksundStensland定价方法和使用ratecurve对象'折扣'名称-值对的论点。

bjspricer = finpricer(“分析”'模型',bsmodel,'折扣',myrc,'现货价格', 100,“DividendValue”只有,“PricingMethod”“BjerksundStensland”
BJSPricer = BjerksundStensland属性:DiscountCurve: [1 x1 ratecurve]模型:[1 x1 finmodel。现货价格:100股息价值:0.0200股息类型:“连续”

将仪器添加到afinportfolio对象

创建一个finportfolio对象使用finportfolio并将其与其相关的价格添加到投资组合中的两个仪器。

f1 = finportfolio ([AmericanOpt, FixB], [BJSPricer FBPricer])
f1 = finportfolio with properties: Instruments: [2x1 fininstrument.]定价者:[2x1 finpricer。PricerIndex: [2x1 double]数量:[2x1 double]

价格投资组合

价格波尔多利奥计算投资组合和投资组合中的工具的价格和敏感性。

[PortPrice, InstPrice PortSens InstSens] = pricePortfolio (f1)
portprice = 119.1665.
InstPrice =2×13.1912 - 115.9753
Portsens =.1×8表价格DV01γδλ织女星θρ  ______ _______ _______ ________ ______ ______ ________ _____ 119.17 0.04295 0.23188 0.011522 7.2661 65.454 -0.81408 86.71
InstSens =2×8表价格DV01 Delta Gamma Lambda Vega Theta Rho ______ _______ _______ ________ ______ ______ ________ _____ vanilla_option 3.1912 NaN 0.23188 0.011522 7.2661 65.454 -0.81408 86.71 fixed_bond 115.98 0.04295 NaN NaN NaN NaN

此示例显示了创建和价格的工作流程和债券和粘合选项仪器的组合。您可以使用finportfolio价格波尔多利奥价格FixedBondFixedBondOptionOptionEmbeddedFixedBond, 和漂浮班仪器使用一个IRTree定价方法。

创建ratecurve对象

创建一个ratecurve对象使用ratecurve

set = datetime(2018, 1,1);ZeroTimes = calyears(1:4)”;ZeroRates = (0.035;0.042147;0.047345;0.052707);zeroates = Settle + ZeroTimes;复合= 1;ZeroCurve = ratecurve (“零”,解决,零辐射,零,“复合”复合)
zerocurve = patterfurve with属性:类型:“零”复合:1基础:0日期:[4x1 DATETIME]率:[4x1双]定位:01-JAN-2018 Interpmethod:“Linear”Shortextrapmethod:“下一步”Longextrapmethod:“上一页“

创建债券和期权工具

fininstrument创建一个FixedBondFixedBondOptionOptionEmbeddedFixedBond, 和漂浮班仪的对象。

CDATES = DATETIME([2020,1,1; 2022,1,1]);箱= [.0425;.0750];CouponRate =时间表(CDates、箱);成熟= DATETIME(2022,1,1);期间= 1;%香草FixedBondVBond = fininstrument (“FixedBond”“成熟”成熟,'优惠券比例', 0.0425,'时期',时期,“名字”“vanilla_fixed”
VBond = HypertBond具有属性:0.0425期限:0.0425周期:1个终端:1校长:100天哪次raycountAdjustedCashflow:0 BusinessDaysVention:“实际”假期:NAT发行版:NAT FirstCoupOndate:NAT StartDate:NAT成熟:01-Jan-2022名称:“vanilla_fixed”
%阶梯式优惠券债券SBond = fininstrument (“FixedBond”“成熟”成熟,'优惠券比例',优惠券比例,'时期',时期,“名字”“stepped_coupon_bond”
sbond = firditbond具有属性:powonrate:[2x1时间表]期间:1基础:0 endmonthleule:1校长:100天追踪justedcashflow:0 businessDaysvention:“实际”假期:NAT发行:NAT FirstCoupOndate:NAT StartDate:Nat Startdate:01-jan-2022名称:“stepped_coupon_bond”
% FloatBond传播= 0;重置= 1;浮动= fininstrument (“FloatBond”“成熟”成熟,'传播',传播,“重置”, 重启,......“ProjectionCurve”ZeroCurve,“名字”“floatbond”
Float = Floatbond具有属性:扩展:0投影诊断:[1x1误重] resetOffset:0重置:1基础:0 endMonthleule:1校长:100天哪次raycountadjustedcashflow:0 BusinessDaysVention:“实际”LovellateRate:NAN假期:NAT发行:NATlastcoupondate:nat startdate:nat成熟:01-Jan-2022名称:“Floatbond”
%的看涨期权罢工= 100;ExerciseDates = datetime(2020、1、1);OptionType ='称呼';期间= 1;calloption = fininstrument(“FixedBondOption”'罢工'罢工,“ExerciseDate”ExerciseDates,......“OptionType”,optiontype,“ExerciseStyle”“美国”“债券”VBond,“名字”“fixed_bond_option”
期权类型:"call" exercisstyle: "american" exercisdate: 01-Jan-2020 Strike: 100 Bond: [1x1 fininstrument。FixedBond)名称:“fixed_bond_option”
嵌入式债券的%选项(可调用债券)CDATES = DATETIME([2020,1,1; 2022,1,1]);箱= [.0425;.0750];CouponRate =时间表(CDates、箱);StrikeOE = [100;100);ExerciseDatesOE = [datetime(2020年,1,1);datetime(2021年,1,1)];CallSchedule =时间表(ExerciseDatesOE StrikeOE,'variablenames',{'罢工时间'});CallableBond = fininstrument (“repectionembeddedfixedbond”“成熟”成熟,......'优惠券比例',优惠券比例,'时期'期,......'callchedule'CallSchedule,“名字”“option_embedded_fixedbond”
CallableBond = OptionEmbeddedFixedBond with properties: CouponRate: [2x1时间表]Period: 1 Basis: 0 EndMonthRule: 1 Principal: 100 DaycountAdjustedCashFlow: 0 BusinessDayConvention:“实际”假期:NaT IssueDate: NaT FirstCouponDate: NaT LastCouponDate: NaT StartDate: NaT Maturity: 01-Jan-2022 CallDates: [2x1 datetime] PutDates:[0x1 datetime] CallSchedule: [2x1时刻表]PutSchedule: [0x0时刻表]callexercisstyle: "american" putexercisstyle: [0x0 string] Name: "option_embedded_fixedbond"

创建HullWhite模型

Finmodel.创建一个HullWhite模型对象。

Volcurve = 0.01;alphacurve = 0.1;hwmodel = finmodel(“hullwhite”“α”,字母表,“σ”VolCurve)
HWMODEL = HULLWHITE具有属性:ALPHA:0.1000西格玛:0.0100

创建IRTree定价的人了HullWhite模型

finpricer创造一个IRTree对象的PricerHullWhite建立模型并使用ratecurve对象'折扣'名称-值对的论点。

hwtreepricer = finpricer(“IRTree”'模型'HWModel,'折扣'ZeroCurve,'三次旅行'ZeroDates)
hwtreepricer = hwbktree具有属性:树:[1x1 struct]三次:[4x1 datetime]型号:[1x1 finmodel.hullwhite]折扣:[1x1差分urve]

创建finportfolio对象并添加可收回债券工具

创建一个finportfolio买入普通债券、阶梯式息票债券、浮动债券和看涨期权。

myportfolio = finportfolio([VBond,SBond,Float, callloption],HWTreePricer, [1,2,2,1])
myportfolio = finportfolio with properties:价格:[1x1 finpricer.irtree.]HWBKTree: PricerIndex: [4x1 double]数量:[4x1 double]

addInstrument将可赎回债券工具加入现有投资组合。

myportfolio = addInstrument (myportfolio CallableBond HWTreePricer, 1)
myportfolio = finportfolio with properties:价格:[1x1 finpricer.irtree.]HWBKTree: PricerIndex: [5x1 double]数量:[5x1 double]
myportfolio。PricerIndex
ans =5×11 1 1 1

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

价格投资组合

价格波尔多利奥计算投资组合以及投资组合中的债券和期权工具的价格和敏感性。

格式银行[PortPrice, InstPrice PortSens InstSens] = pricePortfolio (myportfolio)
PortPrice = 600.55
InstPrice =5×196.5943 204.1377 200.0000 0.0487 99.7738
Portsens =.1×4表价格Vega Gamma Delta ______ _____________________________________________________63.40 5759.65 -1297.48
InstSens =5×4表价格Vega Gamma Delta ______ _________________ ____ ____ ___ _fixed 96.59 -0.00 1603.49 -344.81梯队_coupon_bond 204.14 0.00 3364.60 -725.96浮动界200.00 -0.00 -0.00 0.00固定_bond_option 0.05 12.48 24.15 -3.69 option_embedded_fixedbond 99.77 -75.88 767.41 -75.88 767.41 -35.88 767.41 -75.88 767.41 -75.88 767.41 -75.88

输入参数

全部折叠

投资组合对象,以前创建的finportfolio

数据类型:对象

输出参数

全部折叠

投资组合工具的价格,以数字形式返回。

仪器价格,以数字形式返回。

投资组合敏感性,作为数字返回。

仪器敏感性,作为数字返回。

介绍了R2020a