bootstrap
Bootstrap interest-rate curve from market data
Syntax
Description
bootstraps an interest-rate curve from market data. The dates of the bootstrapped curve
correspond to the maturity dates of the input instruments.DCurve
= IRDataCurve.bootstrap(Type
,Settle
,InstrumentTypes
,Instruments
)
Note
The ratecurve
object and associated
methods were introduced in R2020a as part of a new object-based framework in the
Financial Instruments Toolbox™ which supports end-to-end workflows in instrument modeling and analysis.
For more information, see irbootstrap
and Get Started with Workflows Using Object-Based Framework for Pricing Financial Instruments.
adds optional name-value pair arguments. DCurve
= IRDataCurve.bootstrap(___,Name,Value
)
Examples
Use the bootstrap
Method to Create an IRDataCurve
Object
In this bootstrapping example, InstrumentTypes
, Instruments
, and a Settle
date are defined:
InstrumentTypes = {'Deposit';'Deposit';... 'Futures';'Futures';'Futures';'Futures';'Futures';'Futures';... 'Swap';'Swap';'Swap';'Swap';}; Instruments = [datenum('08/10/2007'),datenum('09/17/2007'),.0532000; ... 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('08/08/2014'),.0530; ... datenum('08/08/2007'),datenum('08/08/2019'),.0551; ... datenum('08/08/2007'),datenum('08/08/2027'),.0565; ... datenum('08/08/2007'),datenum('08/08/2037'),.0566]; CurveSettle = datenum('08/10/2007');
Use the bootstrap
method to create an IRDataCurve
object.
bootModel = IRDataCurve.bootstrap('Forward', CurveSettle, ... InstrumentTypes, Instruments,'InterpMethod','pchip');
To create the plot for the bootstrapped market data:
PlottingDates = (datenum('08/11/2007'):30:CurveSettle+365*25)'; plot(PlottingDates, getParYields(bootModel, PlottingDates),'r') ylim([0 .06]) datetick
Use the bootstrap
Method to Create an IRDataCurve
Object That Includes Bonds
In this bootstrapping example, InstrumentTypes
, Instruments
, and a Settle
date are defined:
CurveSettle = datenum('8-Mar-2010'); InstrumentTypes = {'Deposit';'Deposit';'Deposit';'Deposit';... 'Futures';'Futures';'Futures';'Futures';'Swap';'Swap';'Bond';'Bond'}; Instruments = [datenum('8-Mar-2010'),datenum('8-Apr-2010'),.003; ... datenum('8-Mar-2010'),datenum('8-Jun-2010'),.005; ... datenum('8-Mar-2010'),datenum('8-Sep-2010'),.007; ... datenum('8-Mar-2010'),datenum('8-Mar-2011'),.009; ... datenum('8-Mar-2010'),datenum('18-Jun-2011'),9840; ... datenum('8-Mar-2010'),datenum('17-Sep-2011'),9820; ... datenum('8-Mar-2010'),datenum('17-Dec-2011'),9810; ... datenum('8-Mar-2010'),datenum('18-Mar-2012'),9800; ... datenum('8-Mar-2010'),datenum('8-Mar-2015'),.025; ... datenum('8-Mar-2010'),datenum('8-Mar-2020'),.035; ... datenum('8-Mar-2010'),datenum('8-Mar-2030'),99; ... datenum('8-Mar-2010'),datenum('8-Mar-2040'),101];
When bonds are used, InstrumentCouponRate
must be specified:
InstrumentCouponRate = [zeros(10,1);.045;.05];
Note, for parameters that are only applicable to bonds (InstrumentFirstCouponDate
, InstrumentLastCouponDate
, InstrumentIssueDate
, InstrumentFace
) the entries for non-bond instruments (deposits and futures) are ignored.
Use the bootstrap
method to create an IRDataCurve
object.
bootModel = IRDataCurve.bootstrap('Forward', CurveSettle, ... InstrumentTypes, Instruments,'InterpMethod','pchip',... 'InstrumentCouponRate',InstrumentCouponRate);
Create the plot for the bootstrapped market data.
PlottingDates = datemnth(CurveSettle,1:30*12);
plot(PlottingDates, getParYields(bootModel, PlottingDates),'r')
ylim([0 .06])
datetick
Use IRBootstrapOptionsObj
with bootstrap
for Negative Zero Interest-Rates
Use the IRBootstrapOptionsObj
optional argument with the bootstrap
method to allow for negative zero rates when solving for the swap zero points.
Settle = datenum('15-Mar-2015'); InstrumentTypes = {'Deposit';'Deposit';'Swap';'Swap';'Swap';'Swap';}; Instruments = [Settle,datenum('15-Jun-2015'),.001; ... Settle,datenum('15-Dec-2015'),.0005; ... Settle,datenum('15-Mar-2016'),-.001; ... Settle,datenum('15-Mar-2017'),-0.0005; ... Settle,datenum('15-Mar-2018'),.0017; ... Settle,datenum('15-Mar-2020'),.0019]; irbo = IRBootstrapOptions('LowerBound',-1); bootModel = IRDataCurve.bootstrap('zero', Settle, InstrumentTypes,... Instruments,'IRBootstrapOptions',irbo); bootModel.getZeroRates(datemnth(Settle,1:60))
ans = 60×1
0.0012
0.0011
0.0010
0.0009
0.0008
0.0008
0.0007
0.0006
0.0005
-0.0000
⋮
Note that optional argument for LowerBound
is set to -1
for negative zero rates when solving the swap zero points.
Input Arguments
Type
— Type of interest-rate curve bootstrapped from market instruments
character vector with value of 'zero'
, 'discount'
, or 'forward'
Type of interest-rate curve bootstrapped from market instruments, specified by using a scalar character vector.
When using the bootstrap
, the choice of the
Type
parameter can impact the curve construction because it will
affect the type of data that will be interpolated on (that is, forward rates, zero
rates, or discount factors) during the bootstrapping process. So curves that are
bootstrapped using different Type
parameters undergo different
bootstrapping algorithms with different interpolation methods, and they can sometimes
produce different results when using the “get” functions (for example,
getForwardRates
).
Data Types: char
Settle
— Settle date of interest-rate curve
serial date number | character vector
Settle date of interest-rate curve, specified using a serial date number or date character vector.
Data Types: double
| char
InstrumentTypes
— Instrument types
cell array of character vectors with values of 'deposit'
, 'futures'
, 'swap'
, 'bond'
, and 'fra'
Instrument types, specified using an N
-by-1
cell array (where N
is the number of instruments) indicating what
kind of instrument is in the Instruments
matrix. Acceptable values
are 'deposit'
, 'futures'
,
'swap'
, 'bond'
, and
'fra'
.
Data Types: char
| cell
Instruments
— Instruments
matrix
Instruments, specified as an N
-by-3
data
matrix for Instruments
where the first column is
Settle
date using a serial date number, the second column is
Maturity
using a serial date number, and the third column is the
market quote. The market quote represents the following for each instrument:
deposit
: ratefutures
: price (for example, 9628.54)swap
: ratebond
: clean pricefra
: forward rateNote
Instruments
input forfra
and forfutures
are different. Specifically, the forward rate underlying afra
starts on the start date (column 1 ofInstruments
) and ends on the end date (column 2 ofInstruments
). While the forward rate underlying afutures
contract starts on the maturity date of thefutures
contract and ends on a date n months after thefutures
maturity, where n is the periodicity of thefutures
contract.
Data Types: double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: DCurve =
IRDataCurve.bootstrap('Forward',CurveSettle,InstrumentTypes,Instruments,'InterpMethod','pchip')
Compounding
— Compounding frequency per-year for IRDataCurve
object
CurveObj.Compounding
(default) | possible values include: –1
, 0
, 1
, 2
, 3
,
4
, 6
, 12
.
Compounding frequency per-year for the IRDataCurve
object, specified as the
comma-separated pair consisting of 'Compounding'
and a scalar
numeric using one of the supported values:
−1
= Continuous compounding0
= Simple interest (no compounding)1
= Annual compounding2
= Semiannual compounding3
= Compounding three times per year4
= Quarterly compounding6
= Bimonthly compounding12
= Monthly compounding
Data Types: double
Basis
— Day count basis of the interest-rate curve
0
(actual/actual) (default) | integer from 0
to 13
Day count basis of the interest-rate curve, specified as the comma-separated pair
consisting of 'Basis'
and a scalar integer.
0 — actual/actual
1 — 30/360 (SIA)
2 — actual/360
3 — actual/365
4 — 30/360 (PSA)
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.
Data Types: double
InterpMethod
— Interpolation method
'linear'
(default) | character vector with values of 'linear'
, 'cubic'
, 'pchip'
, or 'spline'
Interpolation method, specified as the comma-separated pair consisting of
'InterpMethod'
and a scalar character vector. For more
information on interpolation methods, see interp1
.
Data Types: char
IRBootstrapOptionsObj
— IRBootstrapOptions object
[]
(default) | IRBootstrapOptions
object
IRBootstrapOptions object, specified as the comma-separated pair consisting of
'IRBootstrapOptionsObj'
and an
IRBootstrapOptions
object previously created using IRBootstrapOptions
.
Data Types: object
DiscountCurve
— RateSpec
for curve used to discount cash flows
[]
(default) | RateSpec
object
RateSpec
for curve used to discount cash flows, specified as
the comma-separated pair consisting of 'DiscountCurve'
and a
RateSpec
object previously created using intenvset
or toRateSpec
.
Data Types: object
InstrumentCouponRate
— Annual percentage rate to determine the coupons payable on an instrument
[]
(default) | decimal
Annual percentage rate to determine the coupons payable on an instrument,
specified as the comma-separated pair consisting of
'InstrumentCouponRate'
and a scalar decimal value.
Data Types: double
InstrumentPeriod
— Coupons per year for the instrument
2
(default) | numeric with value of 0
, 1
, 2
, 3
, 4
, 6
, and 12
Coupons per year for the instrument, specified as the comma-separated pair
consisting of 'InstrumentPeriod'
and a scalar numeric value.
Data Types: double
InstrumentBasis
— Day-count basis of the instrument
0
(actual/actual) (default) | integer from 0
to 13
Day count basis of the instrument, specified as the comma-separated pair
consisting of 'InstrumentBasis'
and a scalar integer.
0 — actual/actual
1 — 30/360 (SIA)
2 — actual/360
3 — actual/365
4 — 30/360 (PSA)
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
Note
InstrumentBasis
distinguishes a bond instrument's
Basis
value from the interest-rate curve's
Basis
value.
For more information, see Basis.
Data Types: double
InstrumentEndMonthRule
— End-of-month rule
1
(default) | logical with value 0
or 1
End-of-month rule, specified as the comma-separated pair consisting of
'InstrumentEndMonthRule'
and a logical value. This rule applies
only when Maturity
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.
Data Types: logical
InstrumentIssueDate
— Instrument issue date
[]
(default) | string scalar | date character vector | serial date number
Instrument issue date, specified as the comma-separated pair consisting of
'InstrumentIssueDate'
and a scalar string, data character vector,
or serial date number.
Data Types: char
| double
| string
InstrumentFirstCouponDate
— Date when a bond makes its first coupon payment
cash flow payment dates are determined from other inputs (default) | string scalar | date character vector | serial date number
Date when a bond makes its first coupon payment (used when bond has an irregular
first coupon period), specified as the comma-separated pair consisting of
'InstrumentFirstCouponDate'
and a scalar string, date character
vector, or serial date number. When InstrumentFirstCouponDate
and
InstrumentLastCouponDate
are both specified,
InstrumentFirstCouponDate
takes precedence in determining the
coupon payment structure. If you do not specify a
InstrumentFirstCouponDate
, the cash flow payment dates are
determined from other inputs.
Data Types: char
| double
| string
InstrumentLastCouponDate
— Last coupon date of a bond before the maturity date
cash flow payment dates are determined from other inputs (default) | string scalar | date character vector | serial date number
Last coupon date of a bond before the maturity date (used when bond has an
irregular last coupon period), specified as the comma-separated pair consisting of
'InstrumentLastCouponDate'
and a scalar string, date character
vector, or serial date number. In the absence of a specified
InstrumentFirstCouponDate
, a specified
InstrumentLastCouponDate
determines the coupon structure of the
bond. The coupon structure of a bond is truncated at the
InstrumentLastCouponDate
, regardless of where it falls, and is
followed only by the bond's maturity cash flow date. If you do not specify a
InstrumentLastCouponDate
, the cash flow payment dates are
determined from other inputs.
Data Types: char
| double
| string
| datetime
InstrumentFace
— Face or par value
100
(default) | numeric
Face or par value, specified as the comma-separated pair consisting of
'InstrumentFace'
and a scalar numeric.
Data Types: double
Note
When using Instrument
name-value pairs, you can specify simple
interest for an Instrument
by specifying the
InstrumentPeriod
value as 0
. If
InstrumentBasis
and InstrumentPeriod
are not
specified for an Instrument
, the following default values are used:
deposit
instrument usesInstrumentBasis
as2
(act/360) andInstrumentPeriod
is0
(simple interest).futures
instrument usesInstrumentBasis
as2
(act/360) andInstrumentPeriod
is4
(quarterly).swap
instrument usesInstrumentBasis
as2
(act/360) andInstrumentPeriod
is2
.bond
instrument usesInstrumentBasis
as0
(act/act) andInstrumentPeriod
is2
.FRA
instrument usesInstrumentBasis
as2
(act/360) andInstrumentPeriod
is4
(quarterly).
Output Arguments
DCurve
— Interest-rate curve from market data
structure
Interest-rate curve from market data, returned as a structure.
Version History
Introduced in R2008b
See Also
IRDataCurve
| IRBootstrapOptions
| toRateSpec
| getForwardRates
| getZeroRates
| getDiscountFactors
| getParYields
| irbootstrap
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 (한국어)