Skip to Main Content Skip to Search
Product Documentation

instswap - Construct swap instrument

Syntax

InstSet = instswap(InstSet, LegRate, Settle, Maturity)

InstSet = instswap(InstSet, LegRate, Settle, Maturity,
InstSet, LegReset, Basis, Principal, LegType,
EndMonthRule)
[FieldList, ClassList, TypeString] = instswap

Arguments

InstSet

Instrument variable. This argument is specified only when adding a swap to an existing instrument set. See instget for more information on the InstSet variable.

LegRate

Number of instruments (NINST)-by-2 matrix, with each row defined as:

[CouponRate Spread] or [Spread CouponRate]

CouponRate is the decimal annual rate. Spread is the number of basis points over the reference rate. The first column represents the receiving leg, while the second column represents the paying leg.

Settle

Settlement date. NINST-by-1 vector of serial date numbers or date strings. Settle must be earlier than Maturity.

Maturity

Maturity date. NINST-by-1 vector of dates representing the maturity date for each swap.

LegReset

(Optional) NINST-by-2 matrix representing the reset frequency per year for each swap. Default = [1 1].

Basis

(Optional) Day-count basis of the instrument. A vector of integers.

  • 0 = actual/actual (default)

  • 1 = 30/360 (SIA)

  • 2 = actual/360

  • 3 = actual/365

  • 4 = 30/360 (BMA)

  • 5 = 30/360 (ISDA)

  • 6 = 30/360 (European)

  • 7 = actual/365 (Japanese)

  • 8 = actual/actual (ICMA)

  • 9 = actual/360 (ICMA)

  • 10 = actual/365 (ICMA)

  • 11 = 30/360E (ICMA)

  • 12 = actual/actual (ISDA)

  • 13 = BUS/252

For more information, see basis.

Principal

(Optional) NINST-by-1 vector or NINST-by-1 cell array of the notional principal amounts or principal value schedules. For the latter case, each element of the cell array is a NumDates-by-2 matrix where the first column is dates and the second column is its associated notional principal value. The date indicates the last day that the principal value is valid.. Default = 100.

LegType

(Optional) NINST-by-2 matrix. Each row represents an instrument. Each column indicates if the corresponding leg is fixed (1) or floating (0). This matrix defines the interpretation of the values entered in LegRate. Default is [1,0] for each instrument.

EndMonthRule

(Optional) NINST-by-1 vector representing the End-of-month rule. Default = 1.

Data arguments are number of instruments (NINST)-by-1 vectors, scalar, or empty. Fill unspecified entries in vectors with NaN. Only one data argument is required to create the instrument; the others may be omitted or passed as empty matrices [].

Description

InstSet = instswap(InstSet, LegRate, Settle, Maturity) creates a new instrument set containing swap instruments or adds swap instruments to an existing instrument set.

InstSet = instswap(InstSet, LegRate, Settle, Maturity,InstSet, LegReset, Basis, Principal, LegType, EndMonthRule) uses optional input arguments to create a new instrument set containing swap instruments or adds swap instruments to an existing instrument set.

[FieldList, ClassList, TypeString] = instswap displays the classes.

FieldList is a number of fields (NFIELDS)-by-1 cell array of strings listing the name of each data field for this instrument type.

ClassList is an NFIELDS-by-1 cell array of strings listing the data class of each field. The class determines how arguments are parsed. Valid strings are 'dble', 'date', and 'char'.

TypeString is a string specifying the type of instrument added. For a swap instrument, TypeString = 'Swap'.

Definitions

Amortizing Swap

In an amortizing swap, the notional principal decreases periodically because it is tied to an underlying financial instrument with a declining (amortizing) principal balance, such as a mortgage.

Examples

Create a Vanilla Swap Instrument

Create a vanilla swap using market data.

Use the following market data to create a swap instrument.

LegRate = [0.065, 0]
Settle = 'jan-1-2007';    
Maturity = 'jan-1-2012';
LegReset = [1, 1];
Basis = 0
Principal = 100    
LegType = [1, 0]   

InstSet = instswap(LegRate, Settle, Maturity, LegReset, Basis, Principal, LegType);

View the swap instrument using instdisp.

instdisp(InstSet)
Index Type LegRate    Settle         Maturity       LegReset Basis Principal LegType
1     Swap [0.065  0] 01-Jan-2007    01-Jan-2012    1  1     0     100       [1  0] 

*Create an Amortizing Swap Instrument

Create an amortizing swap from market data.

TBD

See Also

hjmprice | instaddfield | instbond | instcap | instdisp | instfloor | intenvprice

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS