主要内容

removeInstrument

将仪器从投资组合的工具

描述

例子

外港= removeInstrument (轮廓尺寸,inInst)删除乐器对象(inInst)的投资组合工具(轮廓尺寸)之前创建的使用finportfolio

例子

全部折叠

使用addInstrument将工具添加到一个空的组合,然后删除乐器的组合使用removeInstrument

创建FixedBond仪的对象

使用fininstrument创建两个FixedBond仪的对象。

FixB1 = fininstrument (“FixedBond”,“成熟”datetime (2022、9、15),“CouponRate”,0.045,“名字”,“fixed_bond1”)
FixB1 = FixedBond属性:CouponRate: 0.0450期:2基础:0 EndMonthRule: 1主要:100 DaycountAdjustedCashFlow: 0 BusinessDayConvention:“实际”假期:NaT IssueDate: NaT FirstCouponDate: NaT LastCouponDate: NaT StartDate可以:NaT成熟度:15 - 9 - 2022的名字:“fixed_bond1”
FixB2 = fininstrument (“FixedBond”,“成熟”datetime (2022、9、15),“CouponRate”,0.035,“名字”,“fixed_bond2”)
FixB2 = FixedBond属性:CouponRate: 0.0350期:2基础:0 EndMonthRule: 1主要:100 DaycountAdjustedCashFlow: 0 BusinessDayConvention:“实际”假期:NaT IssueDate: NaT FirstCouponDate: NaT LastCouponDate: NaT StartDate可以:NaT成熟度:15 - 9 - 2022的名字:“fixed_bond2”

创建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定居;myRC = ratecurve (“零”、结算、ZeroDates ZeroRates)
myRC = ratecurve属性:类型:“零”组合:1基础:0日期:x1 datetime[10]利率:x1双[10]解决:15 - 9 - 2018 InterpMethod:“线性”ShortExtrapMethod:“下一个”LongExtrapMethod:“以前”

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

使用finpricer创建一个折扣定价的人对象和使用ratecurve对象的“DiscountCurve”名称-值对的论点。

DiscountPricer = finpricer (“折扣”,“DiscountCurve”myRC)
DiscountPricer =折扣的属性:DiscountCurve: [1 x1 ratecurve]

添加工具finportfolio对象

创建一个空finportflio对象使用finportfolio然后使用addInstrument添加两个FixedBond工具的组合。

f1 = finportfolio;FixB1 f1 = addInstrument (f1)
f1 = finportfolio属性:仪器:[1 x1 fininstrument。FixedBond]定价的人:[0 x1 finpricer。FinPricer] PricerIndex:南数量:1
FixB2 f1 = addInstrument (f1)
f1 = finportfolio属性:仪器:[2 x1 fininstrument。FixedBond]定价的人:[0 x1 finpricer。FinPricer] PricerIndex: [2 x1双)数量:[2 x1双)

将仪器从finportfolio对象

使用removeInstrument删除第一个FixedBond乐器的组合。

f1 = removeInstrument (f1, 1)
f1 = finportfolio属性:仪器:[1 x1 fininstrument。FixedBond]定价的人:[0 x1 finpricer。FinPricer] PricerIndex:南数量:1

制定投资组合定价的人

使用setPricer设置折扣定价的人的组合,然后使用pricePortfolio计算价格和敏感性的单一乐器组合。

DiscountPricer f1 = setPricer (f1)
f1 = finportfolio属性:仪器:[1 x1 fininstrument。FixedBond]定价的人:[1 x1 finpricer。折扣] PricerIndex: 1 Quantity: 1
[PortPrice, InstPrice PortSens InstSens] = pricePortfolio (f1)
PortPrice = 110.0749
InstPrice = 110.0749
PortSens =1×2表价格DV01 ______在110.07 - 0.041629
InstSens =1×2表价格DV01 ______月______ fixed_bond2 110.07 - 0.041629

输入参数

全部折叠

finportfolio对象,指定为一个标量finportfolio对象。

数据类型:对象

仪器将从finportfolio对象,指定为一个标量对象工具,工具对象的字符串“名字”财产,或索引值的位置的工具finportfolio对象。

数据类型:对象||字符串

输出参数

全部折叠

更新finportfolio,返回finportfolio对象。

版本历史

介绍了R2020a