Financial
Instruments Toolbox™ contains the function `liborfloat2fixed`

, which computes a fixed-rate
par yield that equates the floating-rate side of a swap to the fixed-rate
side. The solver sets the present value of the fixed side to the present
value of the floating side without having to line up and compare fixed
and floating periods.

Rates are quarterly, for example, that of Eurodollar futures.

Effective date is the first third Wednesday after the settlement date.

All delivery dates are spaced 3 months apart.

All periods start on the third Wednesday of delivery months.

All periods end on the same dates of delivery months, 3 months after the start dates.

Accrual basis of floating rates is actual/360.

Applicable forward rates are estimated by interpolation in months when forward-rate data is not available.

Design allows you to create a bond of any coupon, basis, or frequency, based on the floating-rate input.

The start date is a valuation date, that is, a date when an agreement to enter into a contract by the settlement date is made.

Settlement can be on or after the start date. If it is after, a forward fixed-rate contract results.

Effective date is assumed to be the first third Wednesday after settlement, the same date as that of the floating rate.

The end date of the bond is a designated number of years away, on the same day and month as the effective date.

Coupon payments occur on anniversary dates. The frequency is determined by the period of the bond.

Fixed rates are not interpolated. A fixed-rate bond of the same present value as that of the floating-rate payments is created.

This example shows the use of the functions in computing the fixed rate applicable to a series
of 2-, 5-, and 10-year swaps based on Eurodollar market data. According to the
Chicago Mercantile Exchange (`https://www.cmegroup.com`

), Eurodollar data on
Friday, October 11, 2002, was as shown in the following table.

This example illustrates swap calculations in MATLAB^{®} software.
Timing of the data set used was not rigorously examined and was assumed
to be the proxy for the swap rate reported on October 11, 2002.

**Eurodollar Data on Friday, October 11, 2002 **

Month | Year | Settle |
---|---|---|

10 | 2002 | 98.21 |

11 | 2002 | 98.26 |

12 | 2002 | 98.3 |

1 | 2003 | 98.3 |

2 | 2003 | 98.31 |

3 | 2003 | 98.275 |

6 | 2003 | 98.12 |

9 | 2003 | 97.87 |

12 | 2003 | 97.575 |

3 | 2004 | 97.26 |

6 | 2004 | 96.98 |

9 | 2004 | 96.745 |

12 | 2004 | 96.515 |

3 | 2005 | 96.33 |

6 | 2005 | 96.135 |

9 | 2005 | 95.955 |

12 | 2005 | 95.78 |

3 | 2006 | 95.63 |

6 | 2006 | 95.465 |

9 | 2006 | 95.315 |

12 | 2006 | 95.16 |

3 | 2007 | 95.025 |

6 | 2007 | 94.88 |

9 | 2007 | 94.74 |

12 | 2007 | 94.595 |

3 | 2008 | 94.48 |

6 | 2008 | 94.375 |

9 | 2008 | 94.28 |

12 | 2008 | 94.185 |

3 | 2009 | 94.1 |

6 | 2009 | 94.005 |

9 | 2009 | 93.925 |

12 | 2009 | 93.865 |

3 | 2010 | 93.82 |

6 | 2010 | 93.755 |

9 | 2010 | 93.7 |

12 | 2010 | 93.645 |

3 | 2011 | 93.61 |

6 | 2011 | 93.56 |

9 | 2011 | 93.515 |

12 | 2011 | 93.47 |

3 | 2012 | 93.445 |

6 | 2012 | 93.41 |

9 | 2012 | 93.39 |

Using this data, you can compute 1-, 2-, 3-, 4-, 5-, 7-, and
10-year swap rates with the toolbox function `liborfloat2fixed`

.
The function requires you to input only Eurodollar data, the settlement
date, and tenor of the swap. MATLAB software then performs the
required computations.

To illustrate how this function works, first load the data contained
in the supplied Excel^{®} worksheet `EDdata.xls`

.

```
[EDRawData, textdata] = xlsread('EDdata.xls');
```

Extract the month from the first column and the year from the second column. The rate used as proxy is the arithmetic average of rates on opening and closing.

Month = EDRawData(:,1); Year = EDRawData(:,2); IMMData = (EDRawData(:,4)+EDRawData(:,6))/2; EDFutData = [Month, Year, IMMData];

Next, input the current date.

```
Settle = datenum('11-Oct-2002');
```

To compute for the 2-year swap rate, set the tenor to `2`

.

Tenor = 2;

Finally, compute the swap rate with `liborfloat2fixed`

.

[FixedSpec, ForwardDates, ForwardRates] = ... liborfloat2fixed(EDFutData, Settle, Tenor)

MATLAB returns a par-swap rate of 2.23% using the default setting (quarterly compounding and 30/360 accrual), and forward dates and rates data (quarterly compounded).

FixedSpec = Coupon: 0.0223 Settle: '16-Oct-2002' Maturity: '16-Oct-2004' Period: 4 Basis: 1 ForwardDates = 731505 731596 731687 731778 731869 731967 732058 732149 ForwardRates = 0.0178 0.0168 0.0171 0.0189 0.0216 0.0250 0.0280 0.0306

In the `FixedSpec`

output, note that the swap
rate actually goes forward from the third Wednesday of October 2002
(October 16, 2002), 5 days after the original `Settle`

input
(October 11, 2002). This, however, is still the best proxy for the
swap rate on `Settle`

, as the assumption merely starts
the swap's effective period and does not affect its valuation method
or its length.

The correction suggested by Hull and White improves the result
by turning on convexity adjustment as part of the input to `liborfloat2fixed`

. (See Hull, J., *Options,
Futures, and Other Derivatives*, 4th Edition, Prentice-Hall,
2000.) For a long swap, for example, five years or more, this correction
could prove to be large.

The adjustment requires additional parameters:

`StartDate`

, which you make the same as`Settle`

(the default) by providing an empty matrix`[]`

as input.`ConvexAdj`

to tell`liborfloat2fixed`

to perform the adjustment.`RateParam`

, which provides the parameters`a`

and`S`

as input to the Hull-White short rate process.Optional parameters

`InArrears`

and`Sigma`

, for which you can use empty matrices`[]`

to accept the MATLAB defaults.`FixedCompound`

, with which you can facilitate comparison with values cited in Table H15 of*Federal Reserve Statistical Release*by turning the default quarterly compounding into semiannual compounding, with the (default) basis of 30/360.StartDate = []; Interpolation = []; ConvexAdj = 1; RateParam = [0.03; 0.017]; FixedCompound = 2; [FixedSpec, ForwardDaates, ForwardRates] = ... liborfloat2fixed(EDFutData, Settle, Tenor, StartDate, ... Interpolation, ConvexAdj, RateParam, [], [], FixedCompound)

This returns 2.21% as the 2-year swap rate, quite close to the reported swap rate for that date.

Analogously, the following table summarizes the solutions for 1-, 3-, 5-, 7-, and 10-year swap rates (convexity-adjusted and unadjusted).

**Calculated and Market Average Data of Swap
Rates on Friday, October 11, 2002**

Swap Length (Years) | Unadjusted | Adjusted | Table H15 | Adjusted Error |
---|---|---|---|---|

1 | 1.80% | 1.79% | 1.80% | -1 |

2 | 2.24% | 2.21% | 2.22% | -1 |

3 | 2.70% | 2.66% | 2.66% | 0 |

4 | 3.12% | 3.03% | 3.04% | -1 |

5 | 3.50% | 3.37% | 3.36% | +1 |

7 | 4.16% | 3.92% | 3.89% | +3 |

10 | 4.87% | 4.42% | 4.39% | +3 |

You can use these results further, such as for hedging a portfolio.
The `liborduration`

function
provides a duration-hedging capability. You can isolate assets (or
liabilities) from interest-rate risk exposure with a swap arrangement.

Suppose that you own a bond with these characteristics:

$100 million face value

7% coupon paid semiannually

5% yield to maturity

Settlement on October 11, 2002

Maturity on January 15, 2010

Interest accruing on an actual/365 basis

Use of the `bnddury`

function
from Financial
Toolbox™ software shows a modified duration of 5.6806
years.

To immunize this asset, you can enter into a pay-fixed swap,
specifically a swap in the amount of notional principal (*Ns*)
such that *Ns***SwapDuration* + $100M*5.6806 = 0 (or *Ns* = -100*5.6806/*SwapDuration*).

Suppose again, you choose to use a 5-, 7-, or 10-year swap (3.37%, 3.92%, and 4.42% from the previous table) as your hedging tool.

```
SwapFixRate = [0.0337; 0.0392; 0.0442];
Tenor = [5; 7; 10];
Settle = '11-Oct-2002';
PayFixDuration = liborduration(SwapFixRate, Tenor, Settle)
```

This gives a duration of -3.6835, -4.7307, and -6.0661 years for 5-, 7-, and 10-year swaps. The corresponding notional amount is computed by

Ns = -100*5.6806./PayFixDuration

Ns = 154.2163 120.0786 93.6443

The notional amount entered in pay-fixed side of the swap instantaneously immunizes the portfolio.

`liborduration`

| `liborfloat2fixed`

| `liborprice`