Financial Derivatives Toolbox    
instsetfield

Add or reset data for existing instruments

Syntax

Arguments

InstSet
(Required) 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. InstSet must be the first argument in the list.
FieldList
String or number of fields (NFIELDS)-by-1 cell array of strings listing the name of each data field. FieldList cannot be named with the reserved names Type or Index.
DataList
Number of instruments (NINST)-by-M array or NFIELDS-by-1 cell array of data contents for each field. Each row in a data array corresponds to a separate instrument. Single rows are copied to apply to all instruments to be worked on. The number of columns is arbitrary, and data is padded along columns.
IndexSet
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.
TypeList
String or number of types (NTYPES)-by-1 cell array of strings restricting instruments worked on to match one of TypeList types.

Argument value pairs can be entered in any order.

Description

instsetfield sets data for existing instruments in a collection variable.

InstSet = instsetfield(InstSet, 'FieldName', FieldList, 'Data', DataList) resets or adds fields to every instrument.

InstSet = instsetfield(InstSet, 'FieldName', FieldList, 'Data', DataList, 'Index', IndexSet, 'Type', TypeList) resets or adds fields to a subset of instruments.

The output InstSet is a new instrument set variable containing the input data.

Examples

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

Enter data for the option in Index 6: Price 2.9 for a Strike of 95.

Create a new field Maturity for the cash instrument.

Create a new field Contracts for all instruments.

Set the Contracts fields for some instruments.

See Also

instaddfield, instdisp, instget, instgetcell


  instselect instswap