Financial Derivatives Toolbox    
instget

Retrieve data from instrument variable

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
(Optional) String or number of fields (NFIELDS)-by-1 cell array of strings listing the name of each data field to match with data values. FieldList entries can also be either 'Type' or 'Index'; these return type strings and index numbers respectively. The default is all fields available for the returned set of instruments.
IndexSet
(Optional) Number of instruments (NINST)-by-1 vector of positions of instruments to work on. If TypeList is also entered, instruments referenced must be one of TypeList types and contained in IndexSet. 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.

Description

[Data_1, Data_2,...,Data_n] = instget(InstSet, 'FieldName', FieldList, 'Index', IndexSet, 'Type', TypeList) retrieve data arrays from an instrument variable.

Data_1 is an NINST-by-M array of data contents for the first field in FieldList. Each row corresponds to a separate instrument in IndexSet. Unavailable data is returned as NaN or as spaces.

Data_n is an NINST-by-M array of data contents for the last field in FieldList.

Examples

Retrieve the instrument set ExampleInst from the data file. InstSetExamples.mat. ExampleInst contains three types of instruments: Option, Futures, and TBill.

Extract the price from all instruments.

Get all the prices and the number of contracts held.

Compute a value V. Create a new variable ISet that appends V to ExampleInst.

Look at only the instruments which have nonzero Contracts.

Get the Type and Opt parameters from those instruments.(Only options have a stored 'Opt' field.)

Create a string report of holdings Type, Opt, and Value.

See Also

instaddfield, instdisp, instgetcell


  instfloor instgetcell