outPort = removeInstrument(inPort,inInst)
removes an instrument object (inInst) from a portfolio of instruments
(inPort) previously created using finportfolio.
DiscountPricer =
Discount with properties:
DiscountCurve: [1x1 ratecurve]
Add Instruments to finportfolio Object
Create an empty finportflio object using finportfolio and then use addInstrument to add the two FixedBond instruments to the portfolio.
f1 = finportfolio;
f1 = addInstrument(f1,FixB1)
f1 =
finportfolio with properties:
Instruments: [1x1 fininstrument.FixedBond]
Pricers: [0x1 finpricer.FinPricer]
PricerIndex: NaN
Quantity: 1
f1 = addInstrument(f1,FixB2)
f1 =
finportfolio with properties:
Instruments: [2x1 fininstrument.FixedBond]
Pricers: [0x1 finpricer.FinPricer]
PricerIndex: [2x1 double]
Quantity: [2x1 double]
Remove Instrument from finportfolio Object
Use removeInstrument to remove the first FixedBond instrument from the portfolio.
f1 = removeInstrument(f1,1)
f1 =
finportfolio with properties:
Instruments: [1x1 fininstrument.FixedBond]
Pricers: [0x1 finpricer.FinPricer]
PricerIndex: NaN
Quantity: 1
Set Pricer for Portfolio
Use setPricer to set the Discount pricer for the portfolio and then use pricePortfolio to calculate the price and sensitivities for the single instrument in the portfolio.
f1 = setPricer(f1,DiscountPricer)
f1 =
finportfolio with properties:
Instruments: [1x1 fininstrument.FixedBond]
Pricers: [1x1 finpricer.Discount]
PricerIndex: 1
Quantity: 1
finportfolio object, specified as a scalar finportfolio object.
Data Types: object
inInst — Instrument to remove from finportfolio object instrument object | index | string for the instrument object 'Name' property
Instrument to remove from finportfolio object, specified as a
scalar instrument object, string for the instrument object 'Name'
property, or index value for the position of instrument in the
finportfolio object.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.