Financial Derivatives Toolbox    

Portfolio Management

The portfolio management capabilities provided by the Financial Derivatives toolbox include:

Instrument Constructors

The toolbox provides constructors for the most common financial instruments.

The instruments and their constructors in this toolbox are listed below.

Instrument
Constructor
Bond
instbond
Bond option
instoptbnd
Arbitrary cash flow
instcf
Fixed rate note
instfixed
Floating rate note
instfloat
Cap
instcap
Floor
instfloor
Swap
instswap

Each instrument has parameters (fields) that describe the instrument. The toolbox functions enable you to:

The instrument structure consists of various fields according to instrument type. A field is an element of data associated with the instrument. For example, a bond instrument contains the fields CouponRate, Settle, Maturity, etc. Additionally, each instrument has a field that identifies the investment type (bond, cap, floor, etc.).

In reality the set of parameters for each instrument is not fixed. Users have the ability to add additional parameters. These additional fields will be ignored by the toolbox functions. They may be used to attach additional information to each instrument, such as an internal code describing the bond.

Parameters not specified when creating an instrument default to NaN, which, in general, means that the functions using the instrument set (such as intenvprice or hjmprice) will use default values. At the time of pricing, an error occurs if any of the required fields is missing, such as Strike in a cap, or the CouponRate in a bond.

Creating New Instruments or Properties

Use the instaddfield function to create a new kind of instrument or to add new properties to the instruments in an existing instrument collection.

To create a new kind of instrument with instaddfield, you need to specify three arguments: 'Type', 'FieldName', and 'Data'. 'Type' defines the type of the new instrument, for example, Future. 'FieldName' names the fields uniquely associated with the new type of instrument. 'Data' contains the data for the fields of the new instrument.

An optional fourth parameter is 'ClassList'. 'ClassList' specifies the data types of the contents of each unique field for the new instrument.

Here are the syntaxes to create a new kind of instrument using instaddfield.

To add new instruments to an existing set, use

As an example, consider a futures contract with a delivery date of July 15, 2000, and a quoted price of $104.40. Since the Financial Derivatives Toolbox does not directly support this instrument, you must create it using the function instaddfield. The parameters used for the creation of the instruments are:

Enter the data into MATLAB.

Optionally, you can also specify the data types of the data cell array by creating another cell array containing this information.

Finally, create the portfolio with a single instrument.

Now use the function instdisp to examine the resulting single-instrument portfolio.

Because your portfolio Port has the same structure as those created using the function instadd, you can combine portfolios created using instadd with portfolios created using instaddfield. For example, you can now add two cap instruments to Port with instadd.

View the resulting portfolio using instdisp.

Searching or Subsetting a Portfolio

The Financial Derivatives Toolbox provides functions that enable you to:

The instfind function finds instruments with a specific parameter value; it returns an instrument index (position) in a large instrument set. The instselect function, on the other hand, subsets a large instrument set into a portfolio of instruments with designated parameter values; it returns an instrument set (portfolio) rather than an index.

instfind.   The general syntax for instfind is

InstSet is the instrument set to search. Within InstSet instruments are categorized by type, and each type can have different data fields. The stored data field is a row vector or string for each instrument.

The FieldList, DataList, and TypeList arguments indicate values to search for in the 'FieldName', 'Data', and 'Type' data fields of the instrument set. FieldList is a cell array of field name(s) specific to the instruments. DataList is a cell array or matrix of acceptable values for the parameter(s) specified in FieldList. 'FieldName' and 'Data' (consequently, FieldList and DataList) parameters must appear together or not at all.

IndexSet is a vector of integer index(es) designating positions of instruments in the instrument set to check for matches; the default is all indices available in the instrument set. 'TypeList' is a string or cell array of strings restricting instruments to match one of the 'TypeList' types; the default is all types in the instrument set.

IndexMatch is a vector of positions of instruments matching the input criteria. Instruments are returned in IndexMatch if all the 'FieldName', 'Data', '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.

instfind Examples.   The examples use the provided MAT-file deriv.mat.

The MAT-file contains an instrument set, HJMInstSet, that contains eight instruments of seven types.

Find all instruments with a maturity date of January 01, 2003.

Find all cap and floor instruments with a maturity date of January 01, 2004.

Find all instruments where the portfolio is long or short a quantity of 50.

instselect.   The syntax for instselect is exactly the same syntax as for instfind. instselect returns a full portfolio instead of indexes into the original portfolio. Compare the values returned by both functions by calling them equivalently.

Previously you used instfind to find all instruments in HJMInstSet with a maturity date of January 01, 2003.

Now use the same instrument set as a starting point, but execute the instselect function instead, to produce a new instrument set matching the identical search criteria.

instselect Examples.   These examples use the portfolio ExampleInst provided with the MAT-file InstSetExamples.mat.

The instrument set contains three instrument types: 'Option', 'Futures', and 'TBill'. Use instselect to make a new instrument set containing only options struck at 95. In other words, select all instruments containing the field Strike and with the data value for that field equal to 95.

You can use all the various forms of instselect and instfind to locate specific instruments within this instrument set.


  Portfolio Creation Using Financial Derivatives