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
对象。
数据类型:对象
inInst
- - - - - -仪器将从finportfolio
对象
仪对象|指数|字符串工具对象“名字”
财产
仪器将从finportfolio
对象,指定为一个标量对象工具,工具对象的字符串“名字”
财产,或索引值的位置的工具finportfolio
对象。
数据类型:对象
|双
|字符串
输出参数
外港
- - -更新finportfolio
对象
finportfolio
对象
更新finportfolio
,返回finportfolio
对象。
版本历史
MATLAB命令
你点击一个链接对应MATLAB命令:
运行该命令通过输入MATLAB命令窗口。Web浏览器不支持MATLAB命令。金宝app
你也可以从下面的列表中选择一个网站:
表现最好的网站怎么走吗
选择中国网站(中文或英文)最佳站点的性能。其他MathWorks国家网站不优化的访问你的位置。