| Financial Derivatives Toolbox | ![]() |
Create instrument subset by matching conditions
Syntax
InstSubSet = instselect(InstSet, 'FieldName', FieldList, 'Data', DataList, 'Index', IndexSet, 'Type', TypeList)
Arguments
Parameter value pairs can be entered in any order. The InstSet variable must be the first argument. 'FieldName' and 'Data' parameters must appear together or not at all. 'Index' and 'Type' parameters are each optional.
Description
InstSubSet = instselect(InstSet, 'FieldName', FieldList, 'Data',
DataList, 'Index', IndexSet, 'Type', TypeList)
creates an instrument subset (InstSubSet) from an existing set of instruments (InstSet).
InstSubSet is a variable containing instruments matching the input criteria. Instruments are returned in InstSubSet if all the Field, Index, and Type conditions are met. An instrument meets an individual Field condition if the stored FieldName data matches any of the rows listed in the DataList for that FieldName. See instfind for examples on matching criteria.
Examples
Retrieve the instrument set ExampleInst from the data file. InstSetExamples.mat. The variable contains three types of instruments: Option, Futures, and TBill.
load InstSetExamples instdisp(ExampleInst) Index Type Strike Price Opt Contracts 1 Option 95 12.2 Call 0 2 Option 100 9.2 Call 0 3 Option 105 6.8 Call 1000 Index Type Delivery F Contracts 4 Futures 01-Jul-1999 104.4 -1000 Index Type Strike Price Opt Contracts 5 Option 105 7.4 Put -1000 6 Option 95 2.9 Put 0 Index Type Price Maturity Contracts 7 TBill 99 01-Jul-1999 6
Make a new portfolio containing only options struck at 95.
Opt95 = instselect(ExampleInst, 'FieldName', 'Strike',... 'Data', '95') instdisp(Opt95) Opt95 = Index Type Strike Price Opt Contracts 1 Option 95 12.2 Call 0 2 Option 95 2.9 Put 0
Make a new portfolio containing only futures and Treasury bills.
FutTBill = instselect(ExampleInst,'Type',{'Futures';'TBill'}) instdisp(FutTBill) = Index Type Delivery F Contracts 1 Futures 01-Jul-1999 104.4 -1000 Index Type Price Maturity Contracts 2 TBill 99 01-Jul-1999 6
See Also
instaddfield, instdelete, instfind, instget, instgetcell
| instoptbnd | instsetfield | ![]() |