Financial Derivatives Toolbox    
swapbyzero

Price swap instrument by a set of zero curves

Syntax

Arguments

RateSpec
A structure encapsulating the properties of an interest rate structure. See intenvset for information on creating RateSpec.
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 representing the settlement date for each swap. Settle must be earlier than or equal to 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) NINST-by-1 vector representing the basis used when annualizing the input forward rate tree. Default = 0 (actual/actual).
Principal
(Optional) NINST-by-1 vector of the notional principal amounts. 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.

Description

[Price, SwapRate] = swapbyzero(RateSpec, LegRate, Settle, Maturity, LegReset, Basis, Principal, LegType) prices a swap instrument by a set of zero coupon bond rates.

Price is a NINST by number of curves (NUMCURVES) matrix of swap prices. Each column arises from one of the zero curves.

SwapRate is an NINST-by-NUMCURVES matrix of rates applicable to the fixed leg such that the swap's values are zero at time 0. This rate is used in calculating the swaps' prices when the rate specified for the fixed leg in LegRate is NaN. SwapRate is padded with NaN for those instruments in which CouponRate is not set to NaN.

Examples

Example 1.

Price an interest rate swap with a fixed receiving leg and a floating paying leg. Payments are made once a year, and the notional principal amount is $100. The values for the remaining parameters are:

Based on the information above, set the required parameters and build the LegRate, LegType, and LegReset matrices.

Load the file deriv.mat, which provides ZeroRateSpec, the interest rate term structure needed to price the bond.

Use swapbyzero to compute the price of the swap.

Example 2.

Using the previous data, calculate the swap rate, the coupon rate for the fixed leg such that the swap price at time = 0 is zero.

See Also

bondbyzero, cfbyzero, fixedbyzero, floatbyzero


  swapbyhjm treepath