Financial Derivatives Toolbox    
instselect

Create instrument subset by matching conditions

Syntax

Arguments

InstSet
Variable containing a collection of instruments. Instruments are classified by type; each type can have different data fields. The stored data field is a row vector or string for each instrument.
FieldList
String or number of fields (NFIELDS)-by-1 cell array of strings listing the name of each data field to match with data values.
DataList
Number of values (NVALUES)-by-M array or NFIELDS-by-1 cell array of acceptable data values for each field. Each row lists a data row value to search for in the corresponding FieldList. The number of columns is arbitrary and matching will ignore trailing NaNs or spaces.
IndexSet
(Optional) Number of instruments (NINST)-by-1 vector restricting positions of instruments to check for matches. The default is all indices available in the instrument variable.
TypeList
(Optional) String or number of types (NTYPES)-by-1 cell array of strings restricting instruments to match one of TypeList types. The default is all types in the instrument variable.

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.

Make a new portfolio containing only options struck at 95.

Make a new portfolio containing only futures and Treasury bills.

See Also

instaddfield, instdelete, instfind, instget, instgetcell


  instoptbnd instsetfield