zbtyield
Zero curve bootstrapping from coupon bond data given yield
Syntax
Description
[
uses the bootstrap method to return a zero curve given a portfolio of coupon bonds
and their yields. ZeroRates
,CurveDates
] = zbtyield(Bonds
,Yields
Settle
)
A zero curve consists of the yields to maturity for a portfolio of theoretical
zero-coupon bonds that are derived from the input Bonds
portfolio. The bootstrap method that this function uses does
not require alignment among the cash-flow dates of the
bonds in the input portfolio. It uses theoretical par bond arbitrage and yield
interpolation to derive all zero rates; specifically, the interest rates for cash
flows are determined using linear interpolation. For best results, use a portfolio
of at least 30 bonds evenly spaced across the investment horizon.
adds an optional argument for ZeroRates
,CurveDates
= zbtyield(___,OutputCompounding
)OutputCompounding
.
Examples
Compute a Zero Curve Given a Portfolio of Coupon Bonds and Their Yields Using datetime Inputs
Given data and yields to maturity for 12 coupon bonds (two with the same maturity date), and given the common settlement date, compute the zero curve using datetime
inputs.
Bonds = [datenum('6/1/1998') 0.0475 100 2 0 0; datenum('7/1/2000') 0.06 100 2 0 0; datenum('7/1/2000') 0.09375 100 6 1 0; datenum('6/30/2001') 0.05125 100 1 3 1; datenum('4/15/2002') 0.07125 100 4 1 0; datenum('1/15/2000') 0.065 100 2 0 0; datenum('9/1/1999') 0.08 100 3 3 0; datenum('4/30/2001') 0.05875 100 2 0 0; datenum('11/15/1999') 0.07125 100 2 0 0; datenum('6/30/2000') 0.07 100 2 3 1; datenum('7/1/2001') 0.0525 100 2 3 0; datenum('4/30/2002') 0.07 100 2 0 0]; Yields = [0.0616 0.0605 0.0687 0.0612 0.0615 0.0591 0.0603 0.0608 0.0655 0.0646 0.0641 0.0627]; Settle = datetime(1997,12,18); OutputCompounding = 2; t = array2table(Bonds,'VariableNames',{'Maturity','CouponRate', 'Face' ,'Period', 'Basis', 'EndMonthRule'}); disp(t)
Maturity CouponRate Face Period Basis EndMonthRule __________ __________ ____ ______ _____ ____________ 7.2991e+05 0.0475 100 2 0 0 7.3067e+05 0.06 100 2 0 0 7.3067e+05 0.09375 100 6 1 0 7.3103e+05 0.05125 100 1 3 1 7.3132e+05 0.07125 100 4 1 0 7.305e+05 0.065 100 2 0 0 7.3036e+05 0.08 100 3 3 0 7.3097e+05 0.05875 100 2 0 0 7.3044e+05 0.07125 100 2 0 0 7.3067e+05 0.07 100 2 3 1 7.3103e+05 0.0525 100 2 3 0 7.3134e+05 0.07 100 2 0 0
t.Maturity = datetime(t.Maturity,'ConvertFrom','datenum','Locale','en_US'); [ZeroRates, CurveDates] = zbtyield(t, Yields, Settle, OutputCompounding)
ZeroRates = 11×1
0.0616
0.0603
0.0657
0.0590
0.0649
0.0650
0.0606
0.0611
0.0643
0.0614
⋮
CurveDates = 11x1 datetime
01-Jun-1998
01-Sep-1999
15-Nov-1999
15-Jan-2000
30-Jun-2000
01-Jul-2000
30-Apr-2001
30-Jun-2001
01-Jul-2001
15-Apr-2002
30-Apr-2002
Compute the Real Zero Rates From the Real Yields of Inflation-Linked Bonds
Use zbtyield
to compute the real zero rates from the real yields of inflation-linked bonds.
% Load the data load usbond_02Sep2008 Settle = datetime(2008,9,2);
Compute the real yields and then compute the real zero rates.
RealYields = bndyield(TIPSPrice,TIPSCoupon,Settle,TIPSMaturity); TIPSBonds = [TIPSMaturity TIPSCoupon]; [RealZeroRates, CurveDates] = zbtyield(TIPSBonds, RealYields, Settle)
RealZeroRates = 26×1
0.0069
0.0094
0.0092
0.0111
0.0110
0.0119
0.0116
0.0128
0.0126
0.0136
⋮
CurveDates = 26x1 datetime
15-Jan-2010
15-Apr-2010
15-Jan-2011
15-Apr-2011
15-Jan-2012
15-Apr-2012
15-Jul-2012
15-Apr-2013
15-Jul-2013
15-Jan-2014
15-Jul-2014
15-Jan-2015
15-Jul-2015
15-Jan-2016
15-Jul-2016
15-Jan-2017
15-Jul-2017
15-Jan-2018
15-Jul-2018
15-Jan-2025
15-Jan-2026
15-Jan-2027
15-Jan-2028
15-Apr-2028
15-Apr-2029
15-Apr-2032
Input Arguments
Bonds
— Coupon bond information to generate zero curve
table | matrix
Coupon bond information to generate zero curve, specified as a
6-column table or a n
-by-2
to
n
-by-6
matrix of bond
information, where the table columns or matrix columns contains:
Maturity
(Column 1, Required) Maturity date of the bond, specified as a datetime, string, or date character vector.To support existing code,
zbtyield
also accepts serial date numbers as inputs, but they are not recommended.If the input
Bonds
is a table, theMaturity
dates can be a datetime array, string array, or date character vectors.CouponRate
(Column 2, Required) Decimal fraction indicating the coupon rate of the bond.Face
(Column 3, Optional) Redemption or face value of the bond. Default =100
.Period
(Column 4, Optional) Coupons per year of the bond. Allowed values are0
,1
,2
(default),3
,4
,6
, and12
.Basis
(Column 5, Optional) Day-count basis of the bond. A vector of integers.0 = actual/actual (default)
1 = 30/360 (SIA)
2 = actual/360
3 = actual/365
4 = 30/360 (BMA)
5 = 30/360 (ISDA)
6 = 30/360 (European)
7 = actual/365 (Japanese)
8 = actual/actual (ICMA)
9 = actual/360 (ICMA)
10 = actual/365 (ICMA)
11 = 30/360E (ICMA)
12 = actual/365 (ISDA)
13 = BUS/252
For more information, see Basis.
EndMonthRule
(Column 6, Optional) End-of-month rule. This rule applies only whenMaturity
is an end-of-month date for a month having 30 or fewer days.0
= ignore rule, meaning that a bond's coupon payment date is always the same numerical day of the month.1
= set rule on (default), meaning that a bond's coupon payment date is always the last actual day of the month
:
Note
If
Bonds
is a table, theMaturity
dates can be a datetime array, string array, or date character vectors.If
Bonds
is a matrix, is ann
-by-2
ton
-by-6
matrix where each row describes a bond, the first two columns (Maturity
andCouponRate
) are required. The remainder of the columns are optional but must be added in order. All rows inBonds
must have the same number of columns.
.
Data Types: double
| char
| string
| datetime
| table
Yields
— Yield to maturity of each bond in Bonds
numeric
Yield to maturity of each bond in Bonds
, specified
as a N
-by-1
column vector. The
number of rows (n) must match the number of rows in
Bonds
.
Note
Yield to maturity must be compounded semiannually.
Data Types: double
Settle
— Settlement date representing time zero in derivation of zero curve
datetime scalar | string scalar | date character vector
Settlement date representing time zero in derivation of zero curve,
specified as a scalar datetime, string, or date character vector.
Settle
represents time zero for deriving the zero
curve, and it is normally the common settlement date for all the
bonds.
To support existing code, zbtyield
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: string
| char
| datetime
OutputCompounding
— Compounding frequency of output ZeroRates
2
(default) | numeric values: 0
,1
, 2
, 3
, 4
, 6
, 12
, 365
,
-1
(Optional) Compounding frequency of output
ZeroRates
, specified using the allowed values:
0
— Simple interest (no compounding)1
— Annual compounding2
— Semiannual compounding (default)3
— Compounding three times per year4
— Quarterly compounding6
— Bimonthly compounding12
— Monthly compounding-1
— Continuous compounding
Data Types: double
Output Arguments
ZeroRates
— Implied zero rates for each point along the investment horizon defined by maturity date
decimal fractions
Implied zero rates for each point along the investment horizon defined
by a maturity date, returned as a
m
-by-1
vector of decimal
fractions where m
is the number of bonds with unique
maturity dates. In aggregate, the rates in ZeroRates
constitute a zero curve.
If more than one bond has the same Maturity
date,
zbtyield
returns the mean zero rate for that
Maturity
. Any rates before the first
Maturity
are assumed to be equal to the rate at
the first Maturity
, that is, the curve is assumed to
be flat before the first Maturity
.
CurveDates
— Maturity dates that correspond to ZeroRates
datetime | serial date number
Maturity dates that correspond to the ZeroRates
,
returned as a m
-by-1
vector of
unique maturity dates, where m
is the number of bonds
of different maturity dates. These dates begin with the earliest
Maturity
date and end with the latest
Maturity
date in the Bonds
table or matrix.
If either inputs for Bonds
or
Settle
have datetime values, then
CurveDates
CurveDates
is
datetimes. Otherwise CurveDates
is serial date numbers.
Use the function datetime
to convert serial
date numbers to formatted date character vectors.
References
[1] Fabozzi, Frank J. “The Structure of Interest Rates.” Ch. 6 in Fabozzi, Frank J. and T. Dessa Fabozzi, eds. The Handbook of Fixed Income Securities. 4th ed. New York, Irwin Professional Publishing, 1995.
[2] McEnally, Richard W. and James V. Jordan. “The Term Structure of Interest Rates.” in Ch. 37 in Fabozzi and Fabozzi, ibid
[3] Das, Satyajit. “Calculating Zero Coupon Rates.” in Swap and Derivative Financing. Appendix to Ch. 8, pp. 219–225. New York, Irwin Professional Publishing, 1994.
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although zbtyield
supports serial date numbers,
datetime
values are recommended instead. The
datetime
data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.
To convert serial date numbers or text to datetime
values, use the datetime
function. For example:
t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)
y = 2021
There are no plans to remove support for serial date number inputs.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)