The Financial Toolbox™ product contains several functions to derive and analyze interest rate curves, including data conversion and extrapolation, bootstrapping, and interest-rate curve conversion functions.
One of the first problems in analyzing the term structure of interest rates is dealing with market data reported in different formats. Treasury bills, for example, are quoted with bid and asked bank-discount rates. Treasury notes and bonds, on the other hand, are quoted with bid and asked prices based on $100 face value. To examine the full spectrum of Treasury securities, analysts must convert data to a single format. Financial Toolbox functions ease this conversion. This brief example uses only one security each; analysts often use 30, 100, or more of each.
First, capture Treasury bill quotes in their reported format
% Maturity Days Bid Ask AskYield TBill = [datenum('12/26/2000') 53 0.0503 0.0499 0.0510];
then capture Treasury bond quotes in their reported format
% Coupon Maturity Bid Ask AskYield TBond = [0.08875 datenum(2001,11,5) 103+4/32 103+6/32 0.0564];
and note that these quotes are based on a November 3, 2000 settlement date.
Settle = datenum('3-Nov-2000');
Next use the toolbox
tbl2bond function to convert the Treasury bill data to Treasury bond format.
TBTBond = tbl2bond(TBill)
TBTBond = 0 730846 99.26 99.27 0.05
(The second element of
TBTBond is the serial date number for December 26, 2000.)
Now combine short-term (Treasury bill) with long-term (Treasury bond) data to set up the overall term structure.
TBondsAll = [TBTBond; TBond]
TBondsAll = 0 730846 99.26 99.27 0.05 0.09 731160 103.13 103.19 0.06
The Financial Toolbox software provides a second data-preparation function,
tr2bonds, to convert the bond data into a form ready for the bootstrapping functions.
tr2bonds generates a matrix of bond information sorted by maturity date, plus vectors of prices and yields.
[Bonds, Prices, Yields] = tr2bonds(TBondsAll);
Using this market data, you can use one of the Financial Toolbox bootstrapping functions to derive an implied zero curve. Bootstrapping is a process whereby you begin with known data points and solve for unknown data points using an underlying arbitrage theory. Every coupon bond can be valued as a package of zero-coupon bonds which mimic its cash flow and risk characteristics. By mapping yields-to-maturity for each theoretical zero-coupon bond, to the dates spanning the investment horizon, you can create a theoretical zero-rate curve. The Financial Toolbox software provides two bootstrapping functions:
zbtprice derives a zero curve from bond data and prices, and
zbtyield derives a zero curve from bond data and yields. Using
[ZeroRates, CurveDates] = zbtprice(Bonds, Prices, Settle)
ZeroRates = 0.05 0.06 CurveDates = 730846 731160
CurveDates gives the investment horizon.
ans = 26-Dec-2000 05-Nov-2001
Additional Financial Toolbox functions construct discount, forward, and par yield curves from the zero curve, and vice versa.
[DiscRates, CurveDates] = zero2disc(ZeroRates, CurveDates,... Settle); [FwdRates, CurveDates] = zero2fwd(ZeroRates, CurveDates, Settle); [PYldRates, CurveDates] = zero2pyld(ZeroRates, CurveDates,... Settle);