Bootstrapping a Swap Curve
This example shows how to bootstrap an interest-rate curve, often referred to as a swap curve, using the IRDataCurve
object. The static bootstrap
method takes as inputs a cell array of market instruments (which can be deposits, interest-rate futures, swaps, and bonds) and bootstraps an interest-rate curve of either the forward or the zero curve. It is also possible to specify multiple interpolation methods, including piecewise constant, linear, and Piecewise Cubic Hermite Interpolating Polynomial (PCHIP).
Obtain Data
A curve is bootstrapped from market data. In this example, you bootstrap a swap curve from deposits, Eurodollar Futures, and swaps.
For this example, the input market data is hard-coded and specified as 2 cell arrays of data, one which indicates the type of instrument and a second cell array containing the Settle
, Maturity
, and Market Quote for the instrument. For deposits and swaps, the quote is a rate, and for the EuroDollar Futures, the quote is a price. Although bonds are not used in this example, a bond would be quoted with a price.
InstrumentTypes = {'Deposit';'Deposit';'Deposit';'Deposit';'Deposit'; ... 'Futures';'Futures'; ... 'Futures';'Futures';'Futures'; ... 'Futures';'Futures';'Futures'; ... 'Futures';'Futures';'Futures'; ... 'Futures';'Futures';'Futures'; ... 'Futures';'Futures';'Futures'; ... 'Swap';'Swap';'Swap';'Swap';'Swap';'Swap';'Swap'}; Instruments = [datenum('08/10/2007'),datenum('08/17/2007'),.0532063; ... datenum('08/10/2007'),datenum('08/24/2007'),.0532000; ... datenum('08/10/2007'),datenum('09/17/2007'),.0532000; ... datenum('08/10/2007'),datenum('10/17/2007'),.0534000; ... datenum('08/10/2007'),datenum('11/17/2007'),.0535866; ... datenum('08/08/2007'),datenum('19-Dec-2007'),9485; ... datenum('08/08/2007'),datenum('19-Mar-2008'),9502; ... datenum('08/08/2007'),datenum('18-Jun-2008'),9509.5; ... datenum('08/08/2007'),datenum('17-Sep-2008'),9509; ... datenum('08/08/2007'),datenum('17-Dec-2008'),9505.5; ... datenum('08/08/2007'),datenum('18-Mar-2009'),9501; ... datenum('08/08/2007'),datenum('17-Jun-2009'),9494.5; ... datenum('08/08/2007'),datenum('16-Sep-2009'),9489; ... datenum('08/08/2007'),datenum('16-Dec-2009'),9481.5; ... datenum('08/08/2007'),datenum('17-Mar-2010'),9478; ... datenum('08/08/2007'),datenum('16-Jun-2010'),9474; ... datenum('08/08/2007'),datenum('15-Sep-2010'),9469.5; ... datenum('08/08/2007'),datenum('15-Dec-2010'),9464.5; ... datenum('08/08/2007'),datenum('16-Mar-2011'),9462.5; ... datenum('08/08/2007'),datenum('15-Jun-2011'),9456.5; ... datenum('08/08/2007'),datenum('21-Sep-2011'),9454; ... datenum('08/08/2007'),datenum('21-Dec-2011'),9449.5; ... datenum('08/08/2007'),datenum('08/08/2014'),.0530; ... datenum('08/08/2007'),datenum('08/08/2017'),.0545; ... datenum('08/08/2007'),datenum('08/08/2019'),.0551; ... datenum('08/08/2007'),datenum('08/08/2022'),.0559; ... datenum('08/08/2007'),datenum('08/08/2027'),.0565; ... datenum('08/08/2007'),datenum('08/08/2032'),.0566; ... datenum('08/08/2007'),datenum('08/08/2037'),.0566];
Construct the Curve Using Bootstrapping
The bootstrap
method is called as a static method of the IRDataCurve
class. Inputs to this method include the curve type (Zero or Forward), settle date, instrument types, instrument data, and optional arguments including an interpolation method, compounding, and an options structure for bootstrapping. Note that in this example, you pass in an IRBootstrapOptions
object which includes information for the convexity adjustment to forward rates.
IRsigma = .01; CurveSettle = datenum('08/10/2007'); bootModel = IRDataCurve.bootstrap('Forward', CurveSettle, ... InstrumentTypes, Instruments,'InterpMethod','pchip',... 'Compounding',-1,'IRBootstrapOptions',... IRBootstrapOptions('ConvexityAdjustment',@(t) .5*IRsigma^2.*t.^2));
Plot Curves
Plot both the forward and zero curves.
PlottingDates = (CurveSettle+20:30:CurveSettle+365*25)'; TimeToMaturity = yearfrac(CurveSettle,PlottingDates); BootstrappedForwardRates = bootModel.getForwardRates(PlottingDates); BootstrappedZeroRates = bootModel.getZeroRates(PlottingDates); figure hold on plot(TimeToMaturity,BootstrappedForwardRates,'r') plot(TimeToMaturity,BootstrappedZeroRates,'g') title('Bootstrapped Curve') xlabel('Time') legend({'Forward','Zero'})
Bibliography
This example draws from the following papers and journal articles:
[1] Hagan, P., West, G. (2006). "Interpolation Methods for Curve Construction." Applied Mathematical Finance, Vol 13, No. 2
[2] Ron, Uri (2000). "A Practical Guide to Swap Curve Construction." Working Papers 00-17, Bank of Canada.