Calculating Euro swap rates in MATLAB

 

Introduction

 

This example shows how one can compute par swap-rates based on Euribor future rates.  The function we will use to do this is called liborfloat2fixed.m.

 

Calculation

 

The data used comes from a free quote vendor/dealer on the web, and result should be looked upon for illustrative purposes only

 

Calculating swap rates requires inputs based on underlying forward rates. The following future rates were obtained on May 19, 2003:

 

 

% Demo 1. Euro swap rates:

FwdDates = ...

    [datenum('15-Jun-2003');

     datenum('15-Sep-2003');

     datenum('15-Dec-2003');

     datenum('15-Mar-2004');

     datenum('15-Jun-2004');

     datenum('15-Sep-2004');

     datenum('15-Dec-2004');

     datenum('15-Mar-2005');

     datenum('15-Jun-2005');

     datenum('15-Sep-2005');

     datenum('15-Dec-2005');

     datenum('15-Mar-2006');

     datenum('15-Jun-2006');

     datenum('15-Sep-2006');

     datenum('15-Dec-2006');

     datenum('15-Mar-2007');

     datenum('15-Jun-2007');

     datenum('15-Sep-2007');

     datenum('15-Dec-2007');

     datenum('15-Mar-2008')];

 

 FwdQte = [97.790;

           97.910;

           97.935;

           97.910;

           97.805;

           97.665;

           97.480;

           97.320;

           97.150;

           96.990;

           96.835;

           96.700;

           96.535;

           96.410;

           96.285;

           96.220;

           96.070;

           95.980;

           95.960;

           95.830];

 

FFadj = [.0534 .1548 .3031 .4898 .7335 1.0121 1.3309 1.6700 2.0824 2.5120 2.9757 3.4472 3.9995 4.5569 5.1430 5.7741 6.3959 7.0605 7.8028 8.4921]

 

ImpVol = [0.0077    0.0085    0.0092    0.0096]

 

Life =[2 3 4 5]

 

PeriodRates =[0.0221 0.0213 0.0207 0.0208 0.0216 0.0229 0.0246 0.0263 0.0280 0.0295 0.0311 0.0325 0.0341 0.0354 0.0367 0.0376 0.0387 0.0399 0.0403 0.0413]

 

timeYrs =[0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25 2.5 2.75 3 3.25 3.5 3.75 4 4.25 4.5 4.75 5]

 

figure(1)

plot(timeYrs, 100*PeriodRates, 'bo-')

title('Euribor Futures Rates on May 19, 2003')

xlabel('Number of years')

ylabel('Futures Rates in percent [%]');

grid;

 

MATLAB incorporates a relatively simple routine to adjust for convexity when dealing with future rates. This adjustment arises from uncertainty, or volatility of the associated future rates from the settlement date to the contract maturity.

 

We chose to implement one-factor Hull-White (HW) style adjustment, keeping close track with observed volatility term structure implied from caps premia of maturity of 2 to 5 years.

 

(We will not make the argument if the implied volatility should have been calibrated from swap or swaption premia as this example is for illustration only.)

figure(2)

plot(Life, ImpVol*10000, 'bo-')

grid;

xlabel('Cap Maturity in YEARS')

ylabel('Cap implied volatility in basis points [bps]');

title('HW- Flat volatility, across MATURITIES of 2.5% Cap')

 

Given the above volatility structure, one can devise a correction (in basis points) to the future rates over the relevant swap periods:

 

figure(3)

plot(timeYrs, FFadj, 'bo-')

grid;

xlabel('Time to fixing dates in number of years')

ylabel('Convexity adjustments in basis points [bps]')

title('Convexity adjustments for Euribor swaps on May 19, 2003');

 

Armed with the information above, we compute and compare the swap rates for 2, 3, 4 and 5 year to that day’s average* quote:

(* middle of bid and ask)

 

Swap Life (Years)

Computed Rates

Actual Rates

2

2.28

2.28

3

2.54

2.56

4

2.81

2.82

5

3.05

3.05

 

FwdDatesVec = datevec(FwdDates);

FwdDatesMth = FwdDatesVec(:,2);

FwdDatesYrs = FwdDatesVec(:,1);

EDFutData = [FwdDatesMth, FwdDatesYrs, FwdQte];

Settle = datenum('19-May-2003');

for i = 1:4

    FixedSpec = liborfloat2fixed(EDFutData, Settle, Life(i), [], [], 1, [0.03, ImpVol(i)]);

    swap(i) = 100*FixedSpec.Coupon;

end

 

swap

sprintf('These are 2, 3, 4, 5 year calculated swap rates in percent')

sprintf('Market (traded) values are: 2.26, 2.54, 2.80, and 3.04')

 

 

The result compares favorably with traded swap rates on that day (All swap rates are quarterly, 30/360 basis).

 

Keep in mind, too, that such result was obtained very quickly, fitted simultaneously to forward rates and their cap implied volatility structure as we have shown above. Accuracy and more consistency to the swap rate scientific foundation could be obtained by overcoming some of the issues briefly mentioned or implied throughout this article.