The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathW orks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern
theuse,modification,reproduction,release,performance,display,anddisclosureoftheProgramand
Documentation by the federal government (or other entity acquiring for or through the federal government)
and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the
government’s needs or is inconsistent in any respect with federal procurement law, the government agrees
to return the Program and Docu mentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
May 2003Online onlyNew for V ersion 1.0 (Release 13)
November 2003First printingUnchanged
June 2004Online onlyRevised for Version 1.0.1 (Release 14)
August 2004Online onlyRevised for Version 1.1 (Release 14+)
September 2005 Online onlyRevised for Version 1.1.1 (Release 14SP3)
March 2006Online onlyRevised for Version 1.1.2 (Release 2006a)
September 2006 Online onlyRevised for Version 1.2 (Release 2006b)
March 2007Online onlyRevised for Version 1.3 (Release 2007a)
September 2007 Online onlyRevised for Version 1.4 (Release 2007b)
March 2008Online onlyRevised for Version 1.5 (Release 2008a)
October 2008Online onlyRevised for Version 1.6 (Release 2008b)
March 2009Online onlyRevised for Version 1.7 (Release 2009a)
September 2009 Online onlyRevised for Version 1.8 (Release 2009b)
March 2010Online onlyRevised for Version 1.9 (Release 2010a)
Supported Tasks
Using Mortgage-Backed Securities
Using Debt Instruments
Using Derivative Securities
Using Interest-Rate Curve Objects
..................................1-4
........................1-4
...................1-4
............................1-5
.........................1-5
...................1-5
Mortgage-Backed Securities
2
What Are Mortgage-Backed Securities? ..............2-2
Using Fixed-Rate Mortgage Pool Functions
Introduction
Inputs to Functions
Generating Prepayment Vectors
Mortgage Prepayments
Risk Measurement
Mortgage Pool Valuation
Computing Option-Adjusted Spread
Prepayments with Fewer Than 360 Months Remaining
Pools with Different Numbers of Coupons Remaining
......................................2-3
................................2-4
.....................2-4
.............................2-6
................................2-8
...........................2-9
.................. 2-10
..........2-3
..2-13
....2-15
v
Debt Instruments
3
Treasury Bills Defined .............................3-2
Computing T reasury Bill Price and Yield
Introduction
Treasury Bill Repurchase Agreements
Treasury Bill Yields
Using Zero-Coupon Bonds
Introduction
Measuring Zero-Coupon Bond Function Quality
PricingTreasuryNotes
Pricing Corporate Bonds
Stepped-Coupon Bonds
Introduction
Cash Flows from Stepped-Coupon Bonds
Price and Yield of Stepped-Coupon Bonds
Term Structure Calculations
Introduction
Computing Spot and Forward Curves
Computing Spreads
......................................3-3
................3-3
...............................3-5
..........................3-7
......................................3-7
.............................3-8
............................ 3-10
............................ 3-12
......................................3-12
....................... 3-15
......................................3-15
................. 3-15
................................3-17
............3-3
........3-7
..............3-12
..............3-14
viContents
4
ing and Hedging
Pric
Pricing Assumptions
Swap
p Pricing Example
Swa
tfolio Hedging
Por
nvertible B on d Valuation
Co
nd Fu tures
Bo
.................................
.....................................
Derivative Securities
...............................
..........................
.............................
........................
4-
4-
4-2
4-2
4-3
4-8
10
12
Supported Bond Futures ............................ 4-12
Example Analysis of Bond Futures
Managing Interest-Rate Risk with Bond Futures
................... 4-14
........4-16
Interest-Rate Curve Objects
5
Introduction to Interest-Rate Curve Objects .........5-2
Class Structure
Supported Workflow Model Using Interest-Rate Curve
Objects
...................................5-2
........................................5-3
Creating Interest-Rate Curve Objects
Creating an IRDataCurve Object
Using the IRDataCurve Constructor with Dates and
Data
..........................................5-6
Using IRDataCurve bo otstrap Method for Bootstrapping
Based on Market Instruments
Creating an IRFunctionCurve Object
Using a Function Handle to Fit an IRFunctionCurve
Object
Using the Nelson-Siegel M ethod to Fit an IRFunctionCurve
Object
Using the Svensson Method to Fit an IRFunctionCurve
Object
UsingtheSmoothingSplineMethodtoFitan
IRFunctionCurve Object
Using the fitFunction to Create a Custom Fitting Function
for an IRFunctionCurve Object
Converting an IRDataCurve or IRFunctionCurve
Object
Introduction
Using the toRateSpec Method
Using Vector of Dates and Data Methods
.........................................5-13
.........................................5-14
.........................................5-16
..........................................5-25
......................................5-25
.....................5-7
.......................... 5-18
....................... 5-25
...............5-4
....................5-6
................ 5-13
.................... 5-21
..............5-26
vii
Function Reference
6
Bond Futures.....................................6-2
Fixed-Income Toolbox™ software extends MATLAB®with functions for
fixed-income modeling and analysis. You can use the toolbox to determine
the price, yield, and cash flow for many types of fixed-income securities,
including mortgage-backed securities, corporate bonds, treasury bonds,
municipal bonds, certificates of deposit, and treasury bills. Fixed-Income
Toolbox functions also enable you to work with derivatives, including swaps,
convertible bonds, and treasury futures. The built-in functions can be used to
create customized fixed-income models based on mortgage-backed securities
and debt instruments.
In this section...
“Introduction” on page 1-2
“Expected Background” on page 1-2
1-2
Expected Background
In general, this guide assumes experience working with fixed-income
instruments and some familiarity with the underlying models.
Your title is likely one of these:
• Analyst, quantitative analyst
• Risk manager
• Portfolio manager
• Fund manager, asset m anager
• Financial engineer
• Trader
• Student, professor, or other academic
Your background, education, training, and responsibilities likely match some
aspectsofthisprofile:
Product Overview
• Finance, economics, perhaps accounting
• Engineering, mathematics, physics, other quantitative sciences
• Bachelor’s degree minimum; MS or MBA likely; Ph.D. perhaps; CFA
• Comfortable with probability theory, statistics, and algebra
• Understand linear or matrix algebra and calculus
• Perhaps new to MATLAB software
1-3
1 Getting Started
What This Product Provides
In this section...
“Supported Tasks” on page 1-4
“Using Mortgage-Backed Securities” on page 1-4
“Using Debt Instruments” on page 1-5
“Using Derivative Securities” on page 1-5
“Using Interest-Rate Curve Objects” on page 1-5
Supported Tasks
Fixed-Income Toolbox software extends MATLAB software with functions for
fixed-income modeling and analysis. You can use the toolbox to determine the
price, yield, and cash flow for many types of fixed-income securities, including
mortgage-backed securities, corporate bonds, Treasury bonds, municipal
bonds, certificates of deposit, and Treasury bills.
1-4
Fixed-Income Toolbox software also enables y ou to work with derivatives,
including swaps, convertible bonds, and Treasury futures. You can use
built-in functions to create customized fixed-income models based on
mortgage-backed securities and debt instruments. You can then use
Fixed-Income Toolbox softwaretoperformthefollowing:
• Calculate the price and yield for generic fixed-rate mortgage pools and
balloon mortgages.
• Determine the price, yield, discount rate, and cash-flow schedule for
debt instruments, including Treasury bills, zero-coupon bonds, and
stepped-coupon bonds.
• Calculate swap rates and sensitivities.
• Analyze the term structure of interest rates, including bootstrapping and
fitting the term structure to market data using parametric models.
Using Mortgage-Backed Securities
With Fixed-Income Toolbox software, you can model generic fixed-rate
mortgage pools and balloon mortgages. Tools are provided for:
What This Product Provides
• Calculating the price and yield of mortgage-backed securities using
prepayment options derived from uniform practices of the Public Securities
Association (PSA)
• Determining the mortgage-pool price or effective duration using the
option-adjusted spread (OAS) method
• Calculating basic risk measurements for a mortgage-pool portfolio using
convexity, duration, and average life
Using Debt Instruments
You can also use Fixed-Income Toolbox software to work with a variety of debt
instruments. You can calculate price, yield, dis count rate, and break-even
discount rate for treasury bills, and determine price, yield, and cash- flow
schedules for corporate, treasury, and municipal bonds. The zero-coupon
functions in Fixed-Income Toolbox software help with the extraction of
present value from virtually any fixed-coupon instrument for any time period.
Toolbox functions also let you calculate price, yield, and cash-flow schedules
for stepped-coupon bonds. The n ext coupon dates are computed automatically
from the last entered input end dates. The payment due on settlement
represents the accrued interest due on that day.
Using Derivative Securities
In addition, Fixed-Income Toolbox software provides tools based on Black’s
option functions for working with fixed-income derivatives. These tools let
you calculate swap price by computing par yields that equate the floating-rate
side of a swap to the fixed-rate side. You can set the present value of the fixed
side to the present value of the floating side without aligning and comparing
fixed and floating periods. The duration-hedging capability in the toolbox lets
you hedge a portfolio and address interest-rate risk exposure with a swap
arrangement. Fixed-Income Toolbox software lets you use binomial a nd
trinomial trees to v a lue convertible bonds. The value of the convertible bond
is determined by the uncertainty of the relative stock.
Using Interest-Rate Curve Objects
Fixed-Income Toolbox software provides tools for analyzing the term structure
of interest rates, including bootstrapping and fitting the term structure to
market data using parametric models (e.g., Nelson-Siegel and Svensson),
1-5
1 Getting Started
spline-based models, and user-defined functions. Fixed-Income Toolbox
supports three class objects:
• “@IRCurve” on page A-4
Creates an interest-rate curves and includes methods for extracting
forward, zero, and discount factors curves.
Supports a method to convert to a
acceptable input format for the Financial Derivatives Toolbox™ function
intenvset.
• “@IRDataCurve” on page A-7
Represents interest-rate curves based on vectors of dates and data.
This class supports bootstrapping an interest-rate curve from market
instruments with a range of interpolation methods.
• “@IRFunctionCurve” on page A-12
Represents an interest-rate curve with a function; the function can be
specified directly, or a form of the function can be specified and then the
parameters are fit to available market data. In addition, you can determine
which type of interest-rate curve (zero, forward, or discount curve) fits the
market data, as well as, any custom functions.
RateSpec structure, which is an
1-6
2
Mortgage-Backed Securities
• “What Are Mortgage-Backed Securities?” on page 2-2
• “Using Fixed-Rate Mortgage Pool Functions” on page 2-3
2 Mortgage-Backed Securities
What Are Mor tgage-Backed Securities?
Mortgage-backed securities (MBSs) are a type of investment that represents
ownership in a group of mortgages. Principal and interest from the individual
mortgages are used to pay principal and interest on the MBS.
Ownership in a group of mortgages is typically represented by a pass-throughcertificate (PC). Most pass-through certificates are issued by the Government
National Mortgage Agency, a branch of the United States government,
or by one of two private corporations: Fannie Mae or Freddie Mac. With
these certificates, homeowners’ payments pass from the originating bank
through the issuing agency to holders of the certificates. These agencies also
frequently guarantee that the ce rtificate holder receives timely payment of
principal and interest from the PCs.
2-2
Using Fixed-Rate Mortgage Pool Functions
Using Fixed-Rate Mortgage Pool Functions
In this section...
“Introduction” on page 2-3
“Inputs to Functions” on page 2-4
“Generating Prepayment Vectors” on page 2-4
“Mortgage Prepayments” on page 2-6
“Risk Measurement” on page 2-8
“Mortgage Pool Valuation” on page 2-9
“Computing Option-Adjusted Spread” on page 2-10
“Prepayments with Fewer Than 360 Months Remaining” on page 2-13
“Pools with Different Numbers of Coupons Remaining” on page 2-15
Introduction
Fixed-Income Toolbox software supports calculations involved with generic
fixed-rate mortgage pools and balloon mortgages. Pass-through certificates
typically ha ve embedded call options in the form of prepayment. Prepayment
is an excess payment applied to the principal of a PC. These accelerated
payments reduce the effective life of a PC.
The toolbox comes with a sta n da rd Bond Market Association (PSA)
prepayment model and can generate multiples of standard prepayment
speeds. The Public Securities Association provides a set of uniform practices
for calculating the characteristics of mortgage-backed securities when there is
an assumed prepayment function.
You can obtain more information about these uniform practices on the PSA
Web site (
Alternatively, aside from the standard PSA implementation in this toolbox,
you can supply yo ur own projected prepayment vectors. At this time, however,
custom prepayment functionality that incorporates pool-specific information
and interest rate forecasts are not available in this toolbox. If you plan to use
http://www.bondmarkets.com).
2-3
2 Mortgage-Backed Securities
custom prepayment vectors in your calculations, you presumably already
own such a suite in MATLAB.
Inputs to Functions
Because of the generic, all-purpos e nature of the toolbox pass-through
functions, you can fine-tune them to conform to a particular mortgage. Most
functions require at least this set of inputs:
• Gross coupon rate
• Settlement date
• Issue (effective) date
• Maturity date
Typical optional inputs include standard prepay m en t speed (or customized
vector), net coupon rate (if different from gross coupon rate), and payment
delay in number of days.
2-4
All calculations are based on expected payment dates and actual cash flow to
the investor. For example, when
to
mbsdurp, the function returns a modified duration based on CouponRate.
(A notable exception is
based on the
GrossRate.)
mbspassthrough, which returns interest quantities
GrossRate and CouponRate differ as inputs
Generating Prepayment Vectors
You can generate PSA multiple prepayment vectors quickly. T o generate
prepayment vectors of 100 and 200 PSA, type
This function computes two prepayment values: conditional prepayment
rate (CPR) and single monthly mortality (SMM) rate. CPR is the percentage
of outstanding principal prepaid in1year. SMMisthepercentageof
outstanding principal prepaid in 1 month. In other words, CPR is an annual
version of SMM.
Using Fixed-Rate Mortgage Pool Functions
Since the entire 360-by-2 array is too long to show in this document, observe
the SMM (100 and 200 PSA) plots, spaced one month apart, instead.
Prepayment assumptions form the basis upon which far more comprehensive
MBS calculations are based. As an illustration observe the following example,
which shows the use of the function
mbscfamounts to generate cash flows and
timings based on a set of standard prepayments.
Considerthreemortgagepoolsthatweresoldontheissuedate(whichstarts
unamortized). The first two pools "balloon out" in 60 months, and the third is
regularly amortized to the end. The prepayment speeds are assumed to be
100, 200, and 200 PSA, respectively.
Settle= [datenum('1-Feb-2000');
datenum('1-Feb-2000');
datenum('1-Feb-2000')];
Maturity= [datenum('1-F eb-2030')];
IssueDate= datenum('1-Feb-2000');
2-5
2 Mortgage-Backed Securities
The fourth output argument, Factors, indicates the fraction of the balance
still outstanding at the beginning of each month. A snapshot of this argument
in the MATLAB Variable Editor illustrates the 60-month life of the first two
of the mortgages with balloon payments and the continuation of the third
mortgage until the end (360 months).
You can readily see that mbscfamounts is the building block of most fixed rate
and balloon pool cash flows.
Mortgage Prepayments
Prepayment is beneficial to the pass-through owner when a mortgage pool
has been p urchased at discount. The next example compares mortgage
yields (compounded monthly) versus the purchase clean price with constant
Using Fixed-Rate Mortgage Pool Functions
prepayment speed. The example illustrates that when you have purchased
a pool at a discount, prepay m ent generates a higher yield with decreasing
purchase price.
Using Fixed-Income Toolbox functions, you can obtain modified duration
and convexity from either price or yield, as long as you specify a prepayment
vector or an assumed prepayment speed. The toolbox risk-measurement
functions (
guidelines listed in the PSA Uniform Practices manual.
Mortgage Pool Valuation
For accurate valuation of a mortgage pool, you must generate interest rate
paths and use them with mortgage pool characteristics to properly value
the pool. A widely used methodology is the option-adjusted spread (OAS).
OAS measures the yield spread that is not directly attributable to the
characteristics of a fixed-income investment.
Calculating OAS
Prepayment alters the cash flows of an otherwise regularly amortizing
mortgage pool. A comprehensive option-adjusted spread calculation
typically begins with the generation of a set of paths of spot rates to predict
prepayment. A path is collection of i spot-rate paths, with corresponding
j cashflowsoneachofthosepaths.
2-9
2 Mortgage-Backed Securities
The effect of the OAS on pool pricing is shown mathematically in the following
equation, where K is the option-adjuste d spread.
CF
ij
∑
1()
++
j
CF
ij
zeroratesK
ij
T
ij
PoolPrice
mmberofPaths
=×
NumberofPaths
1
Nu
∑
i
Calculating Effective Duration
Alternatively, if you are more interested in the sensitivity of a mortgage pool
to interest rate changes, use effective duration, which is a more appropriate
measure. Effective duration is defined mathematically with the following
equation.
+− −()()
ΔΔ
Pyy Pyy
Effective Duration
=
()
Δ2
Py y
Calculating Market Price
The toolbox has all the components required to calculate OAS and effective
duration if you supply prepayment vectors or assumptions. For O AS, given a
prepayment vector, you can generate a set of cash flows with
Discounting these cash flows with the reference curve and then adding OAS
produces the market price. See “Computing Option-Adjusted Spread” on page
2-10 fo r a discussion on the computation of option-adjusted spread.
Effective duration is a more difficult issue. W hile modified duration changes
the discounting process (by changing the yield used to discount cash flows),
effective duration must account for the change in cash flow because of the
change in yield. A possible solution is to recompute prices using
a small change in yield, in both the upwards and downwards directions. In
this case, you must recompute the prepayment input. Internally, this alters
the cash flows of the mortgage pool. Assuming that the OAS stays constant in
all yield environments, you can apply a set of discounting factors to the cash
flows in up and down yield environments to find the effective duration.
mbscfamounts.
mbsprice for
2-10
Computing Option-Adjusted Spread
The option-adjuste d spread (OAS) is an amount of extra interest added above
(orbelowifnegative)thereferencezerocurve. TocomputetheOAS,youmust
Using Fixed-Rate Mortgage Pool Functions
provide the zero curve as an extra input. You can specify the zero curve in
any intervals and with any compounding method. (To minimize any error
due to interpolation, keep the intervals as regular and frequent as possible.)
You must supply a prepayment vector or specify a speed corresponding to
a standard PSA prepayment vector.
Onewaytocomputetheappropriatezerocurveforanagencyistolookatits
bond yields and bootstrap them from the shortest m aturity onwards. You can
do this with Financial Toolb ox™ functions
zbtprice and zbtyield.
The following example shows how to calculate an appropriate zero curve
followed by computation of the pool’s OAS. This example calculates the OAS
of a 30-year fixed rate mortgage with about a 28-year w eigh t ed average
maturity left, given an assumption of 0, 50, and 100 PSA prepayment speeds.
Create curve for
Bonds = [datenum('11/21/2002')0100021;
Yields = [0.0162;
zerorates.
datenum('02/20/2003')0100021;
datenum('07/31/2004')0.03100231;
datenum('08/15/2007')0.035100231;
datenum('08/15/2012')0.04875 100231;
datenum('02/15/2031')0.05375 100231];
0.0163;
0.0211;
0.0328;
0.0420;
0.0501];
Since the above is Treasury data and not selected agency data, a term
structure of spread is assumed. In this example, the spread declines
proportionally from a maximum of 250 basis points at the shortest maturity.
This example shows that one cash flow set is being discounted and solved for
its OAS, as contrasted with the
NumberOfPaths set of cash flows as shown
Using Fixed-Rate Mortgage Pool Functions
in “Mortgage Pool Valuation” on page 2-9. Averaging the sets of cash flows
resulting from all simulations into one average cash flow vector and solving
for the OAS, discounts the averaged cash flows to have a present value of
today’s (average) price.
While this example uses the mortgage pool price (
theOAS,youcanalsouseyieldtoresolveit(
reverse OAS functions that return prices and yields given OAS (
and mbsoas2yield).
The example also restates earlier examples that show discount securities
benefit from higher l evel of prepayme nt, keeping everything else unchanged.
The relation is reversed for premium securities.
mbsprice2oas) to determine
mbsyield2oas). Also, there are
mbsoas2price
Prepayments with Fewer Than 360 Months
Remaining
When fewer than 360 months remain in the pool, the applicable PSA
prepayment vector is "seasoned" by the pool’s age. (Elements in the
360-element prepayment vector that repres ent past payments are skipped.
For example, on a 30-year mortgage that is 10 months old, only the final
350 prepayments are applied.)
Assume, for example, that you h ave two 30-year loans, one new and another
10 months old. Both have the same PSA speed of 100 and prepay using the
vectors plotted below.
2-13
2 M ortgage-Backed Securities
2-14
Still within the scope of relative valuation, you could also solve for the
percentage of the standard PSA prepayment vector given the pool’s arbitrary,
user-supplied prepayment vector, such that the PSA speed gives the same
Macaulay duration as the user-supplied prepayment vector.
If yo u supply a custom prepayment vector, you must account for the number
of months remaining.
Examine the prepayment input. The remaining 29 years require 348 monthly
elements in the prepayment vector. Supposethen,keepingeverythingthe
same, you change
Settle = datenum('14-Feb-2003');
Settle to February 14, 2003.
You can use cpncount to count all incoming coupons received after Settle
by invoking
The input 12 defines the monthly payment frequency, 1 defines the 30/360
basis, and
IssueDate defines aging and determination-of-holder date.
Thus, you must supply a 323-element vector to account for a prepayment
corresponding to each monthly payment.
Pools with Different Numbers of Coupons Remaining
Suppose one pool has two remaining coupons, and the other has three.
MATLAB software expects the prepaymentmatrixtobeinthefollowing
format:
V11V21
V12V22
NaNV23
denotes the single monthly mortality (SMM) rate for pool i during the jth
V
ij
coupon period since
The use of
NaN to pad the prepayment matrix is necessary because MATLAB
cannot concatenate vectors of different lengths into a matrix. Also, it can
Settle.
2-15
2 M ortgage-Backed Securities
serve as an error check against any unintended operation (any MATLAB
operation that would return
For example, assume that the 2 month pool has a constant SMM of 0.5% and
the 3 month has a constant SMM of 1% in every period. The prepayment
matrix you would create is depicted below.
NaN).
2-16
Create this input in whatever manner is best for you.
Summary of Prepayment Data Vector Representation
• When you specify a PSA prepayment speed, MATLAB "seasons" the pool
according to its age.
• Whenyouspecifyyourownprepayment matrix, identify the maximum
number of coupons remaining using
elements up to the point when cash flow ceases to exist.
• When different length pools must exist inthesamematrix,padtheshorter
one(s) with
specific pool.
NaN. Each column of the prepayment matrix corresponds to a
cpncount. Then supply the matrix
Debt Instruments
• “Treasury Bills Defined” on page 3-2
• “Computing Treasury Bill Price and Yield” on page 3-3
• “Using Zero-Coupon Bonds” on page 3-7
• “Stepped-Coupon Bonds” on page 3-12
• “Term Structure Calculations” on page 3-15
3
3 Debt Instruments
Treasury Bills Defined
Treasury bills are short-term securities (issued with maturities of 1 year
or less) sold by the United States Treasury. Sales of these securities are
frequent, usually week ly. F rom time to time, the Treasury also offers longer
duration securities called Treasury notes and Treasury bonds.
A Treasury bill is a discount security. The holder of the Treasury bill does not
receive periodic interest paym ents. Instead,atthetimeofsale,apercentage
discount is applied to the face value. At maturity, the holder redeems the
bill for full face value.
The basis for Treasury bill interest calculation is actual/360. Under this
system, interest accrues on the actual number of e lapsed days between
purchase and maturity, and each year contains 360 days.
3-2
Computing Treasury Bill Price and Yield
In this section...
“Introduction” on page 3-3
“Treasury Bill Repurchase Agreements” on page 3-3
“Treasury Bill Yields” on page 3-5
Introduction
Fixed-Income Toolbox software provides the following suite of functions for
computing price and yield on Treasury bills.
Treasury Bill Function s
FunctionPurpose
tbilldi
tbillpr
tbillrepo
tbillyield
tbillyield2disc
tbillval01
sc2yield
ice
Convert d
Price Treasury bill given its yield or discount rate.
Break-even discount of repurchase agreement.
Yield and discount of Treasury bill given its price.
Convert yield to discount rate.
The value of 1 basis point given the characteristics
of the Treasury bill, as represented by its
settlement and maturity dates. You can relate
the basis point to d iscount, money-market, or
bond-equivalent yield.
iscount rate to yield.
Computing Treasury Bill Price a n d Yield
For all functions with yield in the computation, you can specify yield as
money-market or bond-equivalent yield. The functions all assume a face value
of $100 for each Treasury bill.
Treasury Bill Repurchase Agreements
The following example shows how to compute the break-even discount rate.
This is the rate that correctly prices the Treasury bill such that the profit
from selling the tail equ als 0.
You can check the result of this computation by examining the cash flows
in and out from the repurchase transaction. First compute the price of the
Treasury bill on the purchase date (September 26).
Examining the cash flows, observe that the break-even discount causes the
sum of the price on the purchase date plus the accrued 30-day interest to be
equaltothepriceonsaledate. Thenexttableshowsthecashflows.
Cash Flows from Repurchase Agreement
DateCashOutFlowCashInFlow
9/26/2002
10/26/2002
Purchase T-bill
Payment of repo
Repo interest
99.593
99.593
0.1238
Repo m oney
Sell T-bill
99.593
99.7168
Total
199.3098199.3098
Treasury Bill Yields
Using the same data as before, you can examine the money-market and
bond-equivalent yields of the Treasury bill at the time of purchase and sale.
The function
tbilldisc2yield can perform both computations at one time.
3-5
3 Debt Instruments
0.0167
BEYield =
0.0164
0.0170
MMYield =
0.0162
0.0168
For the short Treasury bill (fewer than 182 days to m aturity), the
money-market yield is 360/365 of the bond-equivalent yield, as this example
shows.
3-6
Using Zero-Coupon Bonds
In this section...
“Introduction” on page 3-7
“Measuring Zero-Coupon Bond Function Quality” on page 3-7
“Pricing Treasury Notes” on page 3-8
“Pricing Corporate Bonds” on page 3-10
Introduction
A zero-coupon bond is a corporate, Treasury, or municipal debt instrument
that pays no periodic interest. T ypically, the bond is redeemed at maturity
for its full face value. It will be a security issued at a discount from its face
value, or it may be a coupon bond stripped o f its coupons and repackaged
as a zero-coupon bond.
Fixed-Income Toolbox software provides functions for valuing zero-coupon
debt instruments. These functions supplement existing coupon bond functions
such as
software.
bndprice and bndyield that are available in Financial Toolbox
Using Zero-Coupon Bonds
Measuring Zero-Coupon Bond Function Quality
Zero-coupon function quality is measured by h ow consistent the results
are with coupon-bearing bonds. Because the zero coupon’s yield is
bond-equivalent, comparisons with coupon-bearing bonds are possible.
In the textbook case, where time (t) is measured continuously and the rate
(r) is continuously compounded, the value of a zero bond is the principal
tiplied by
mul
be variable, requiring a more consistent approach to meet the stricter
can
ands of accurate pricing.
dem
e following two examples
Th
rt−
. In reality, the rate quoted is continuous and the basis
e
3-7
3 Debt Instruments
• “Pricing Treasury Notes” on page 3-8
• “Pricing Corporate Bonds” on page 3-10
show how the zero functions are consistent with supported coupon bond
functions.
Pricing Treasury Notes
A Treasury note can be considered to be a package of zeros. The toolbox
functions that price zeros require a coupon bond equivalent yield. That
yield can originate from any type of coupon paying bond, with any periodic
payment, or any accrual basis. The next example shows the use of the toolbox
to price a Treasury note and compares the calculated price with the actual
price quotation for that day.
The following table shows the intermediate calculations.
Discounted Cash
Cash FlowsDiscount Factors
Flows
-1.21551.0000-1.2155
2.75000.99082.7246
2.75000.97452.6799
2.75000.95852.6359
2.75000.94272.5925
2.75000.92722.5499
2.75000.91202.5080
2.75000.89702.4668
2.75000.88232.4263
2.75000.86782.3864
2.75000.85352.3472
2.75000.83952.3086
2.75000.82572.2706
102.75000.812183.4451
Total
112.1263
Using Zero-Coupon Bonds
Compare the quoted price and the calculated p rice based on zeros.
[QPriceACT PriceofZeros]
ans =
112.1270112 .1263
This example shows that zeropr ice can satisfactorily price a Treasury note,
a semiannual actual/actual basis bond, as if it were a composed of a series
of zero-coupon bonds.
3-9
3 Debt Instruments
Pricing Corpora
You can similarl
zero-coupon bon
zeros exist. Yo
quoted coupon-
[CFlows, CDates] = cfa mounts(CouponRate, Settle, MaturityCpn, ...
Period, Basis);
Maturity = CDates;
Compute
multip
the price of the coupon bond identically as a collection of zeros by
lying the discount factors to the corresponding cash flows.
y price a corporate bond, for which there is no corresponding
d, as opposed to a Treasury note, for which corresponding
u can create a synthetic zero-coupon bond and arrive at the
bond price when you later sum the zeros.
sh flow and compute price from the sum of zeros.
te Bonds
3-10
Price30 = CFlows * zeroprice(QYield, Settle, Mat urity, Period, ...
Basis)/100;
Compa
As a
(
re quoted price and calculated price based on zeros.
[QPrice30 Price30]
ans =
99.382099.3 828
test of fidelity, intentionally giving the wrong basis, say actual/actual
sis = 0
Ba
) instead of 30/360, gives a price of 99.3972. Such a systematic
Using Zero-Coupon Bonds
error, if recurring in a more complex pric in g routine, quickly adds up to large
inaccuracies.
In summ ary, the zero functions in MATLAB software facilitate extraction of
present value from virtually any fixed-coupon instrument, up to any period
in time.
3-11
3 Debt Instruments
Stepped-Coupon Bonds
In this section...
“Introduction” on page 3-12
“Cash Flows from Stepped-Coupon Bonds” on page 3-12
“Price and Yield of Stepped-Coupon Bonds” on page 3-14
Introduction
A stepped-coupon bond has a fixed schedule of changing coupon amounts.
Like fixed coupon bonds, stepped-couponbondscouldhavedifferent periodic
payments and accrual bases.
The functions
such bonds. An accompanying function
stepcpnprice and stepcpnyield compute prices and yields of
stepcpncfamounts produces the cash
flow schedules pertaining to these bonds.
Cash Flows from Stepped-Coupon Bonds
Consider a bond that has a schedule of two coupons. Suppose the bond starts
out with a 2% coupon that steps up to 4% in 2 years and onward to maturity.
Assume that the issue and settlement dates are both March 15, 2003. The
bond has a 5 year maturity. Use
flow schedule and times.
Notably, ConvDates has 1 less element than CouponRates because MATLAB
software assumes that the first element of
schedule between
Settle (March 15, 2003) and the first element of ConvDates
(March 15, 2005), shown diagrammatically below.
stepcpncfamounts to generate the cash
CouponRates indicates the coupon
3-12
Stepped-Coupon Bonds
Effective 2% on March
15, 2003
Coupon DatesSemiannual Coupon Payment
15-Mar-03
15-Sep-03
15-Mar-04
15-Sep-04
15-Mar-05
15-Sep-05
15-Mar-06
15-Sep-06
15-Mar-07
15-Sep-07
15-Mar-08
Pay 2% from March
15, 2003
Pay 4% from March
15, 2003
Effective 4% on March
15, 2005
0
1
1
1
1
2
2
2
2
2
102
The payment on March 15, 2005 is still a 2% coupon. Payment of the 4%
coupon starts with the next payment, September 15, 2005. March 15, 2005
is the end of first coupon schedule, not to be confused with the beginning of
the second.
In summary, MATLAB takes user input as the end dates of coupon schedules
and computes the next coupon dates automatically.
The payment due on settlement (zero in this case) represents the accrued
interestdueonthatday. Itisnegative if such amount is nonzero. Comparison
with
cfamounts in Financial Toolbox software shows that the two functions
operate identically.
3-13
3 Debt Instruments
Price and Yield of Stepped-Coupon Bonds
The toolbox provides two basic analytical functions to compute price and
yield for stepped-coupon bonds. Using the above bond as an example, you can
compute the price when the yield is known.
You can estimate the y ield to maturity as a number-of-year weighted average
of coupon rates. For this b ond, the estimated yield is:
()()22 43
×+×
5
.
or 3.33%. While definitely not exact (due to nonlinear relation of price and
yield), this estimate suggests close to par valuation and serves as a quick
first check on the function.
The price returned is 99.2237 (per $100 notional), and the accrued interest is
zero, consistent with our earlier assertions.
To validate that there is consistency among the stepped-coupon functions,
you can use the above price and see if indeed it implies a 3.33% yield by
using
So far, a more formal definition of "yield" and its application has not been
developed. In many situations when cash flow is available, discounting factors
to the cash flows may not be immediately apparent. In other cases, what
is relevant is often a spread, the difference between curves (also known as
the term structure of spread).
All these calculations require one main ingredient, the Treasury spot,
par-yield, or forward curve. Typically, the generation of these curves starts
with a series of on-the-run and selected off-the-run issues as inputs.
Term S t ruct u re Ca l cula tion s
MATLAB software uses these bonds to find spot rates one at a time, from the
shortest maturity onwards, using bootstrap techniques. All cash flows are
used to construct the spot curve, and rates between maturities (for these
coupons) are interpolated linearly.
Computing Spot and Forward Curves
For an illustration of how this works, observe the use of zbtyield (or
equivalently
BillsMaturity DateCurrent Yield
3month
onth
6m
zbtprice) on a portfolio of six Treasury bills and bonds.
5
7/03
4/1
7/17/03
1.1
1.18
3-15
3 Debt Instruments
Notes/Bonds
Coupon
2year1.750
5year3.000
10 year4.000
30 year5.375
Maturity Date
12/31/04
11/15/07
11/15/12
2/15/31
Current Yield
1.68
2.97
4.01
4.92
You can specify prices or yields to the bonds above to infer the spot curve. The
function
To proceed, first assemble the above table into a variable called
zbtyield accepts yields (bond-equivalent yield, to be exact).
Bonds.The
first column contains maturities, the second contains coupons, and the third
contains notionals or face values of the bonds. (Note that bills have zero
coupons.)
Here the notion of forward rates refers to rates between the maturity dates
shown above, not to a certain period (forward 3 month rates, for example).
Computing Spreads
Calculating the spread between specific, fixed forward periods (such as the
Treasury-Eurodollar spread) requires an extra step. Interpolate the zero
rates (or zero prices, instead) for the corresponding maturities on the interval
dates. Then use the interpolated zero rates to deduce the forward rates, and
thus the spread of Eurodollar forward curve segments versus the relevant
forward segments from Treasury bills.
3-17
3 Debt Instruments
Additionally, the variety of curve functions (including zero2fwd)helpsto
standardize such calculations. For instance, by making both rates quoted
with quarterly compounding and on an actual/360 basis, the resulting spread
structure is fully comparable. This avoi ds the small inconsistency that occurs
when directly comparing the bond-equ ivalent yield of a Treasury bill to the
quarterly forward rates implied by Eurodollar futures.
Noise in Curve Computations
When introducing more bonds in constructing curves, noise may become a
factor and may need some “smoothing” (with splines, for example); this helps
obtain a s moother forward curve.
The following spot and forward curves are constructed from 67 Treasury
bonds. The fitted and bootstrapped spot curve (bottom right figure) displays
comparable stability. The forward curve (upper-left figure) contains
significant noise and shows an improbable forward rate structure. The
noise is not necessarily bad; it could uncover trading opportunities for a
relative-value approach. Yet, a more balanced approach is desired when the
bootstrapped forward curve oscillates this much and contains a negative rate
as large as -10% (not shown in the plot because it is outside the limits).
3-18
Term S t ruct u re Ca l cula tion s
This example uses termfit,ademonstrationfunction from Financial Toolbox
software that also requires the use of Spline Toolbox™ software.
3-19
3 Debt Instruments
3-20
Derivative Securities
• “Pricing and Hedging” on page 4-2
• “Convertible Bond Valuation” on page 4-10
• “Bond Futures” on page 4-12
4
4 Derivative Securities
Pricing and Hedging
In this section...
“Swap Pricing Assumptions” on page 4-2
“Swap Pricing Example” on page 4-3
“Portfolio Hedging” on page 4-8
Swap Pricing Assumptions
Fixed-Income Toolbox softw are contains the function liborfloat2fixed,
which computes a fixed-rate par yield that equates the floating-rate side of
a swap to the fixed-rate side. The solver sets the present value of the fixed
side to the present value of the floating side without having to line up and
compare fixed and f loating periods.
Assumptions on Floating-Rate Input
4-2
• Rates are quarterly, for example, that of Eurodollar futures.
• Effective date is the first third Wednesday after the settlement date.
• All delivery dates are spaced 3 months apart.
• All periods start on the third Wednesday of delivery months.
• All periods end on the same dates of delivery months, 3 months after the
start dates.
• Accrual basis of floating rates is actual/360.
• Applicable forward rates are estimated by interpolation in months when
forward-rate data is not available.
umptions on Fixed-Rate Output
Ass
• Des
• Th
ign allows you to create a bond of any coupon, basis, or frequency, based
n the floating-rate input.
upo
e start date is a valuation date, that is, a date when an agreement to
ter into a contract by the settlement date is made.
en
Pricing and Hedging
• Settlement can be on or after the start date. If it is after, a forward
• The end date of the bond is a designated number of years away, on the
same day and month as the effective date.
• Coupon payments occur on anniversary dates. The frequency is determined
by the period of the bond.
• Fixed rates are not interpolated. A fixed-rate bond of thesamepresent
value as that of the floating-rate payments is created.
Swap Pricing Example
This example shows the use of the functions in computing the fixed rate
applicable to a series of 2-, 5-, and 10-year swaps based on Eurodollar market
data. According to the Chicago Mercantile Exchange (
Eurodollar data on Friday, October 11, 2002, was as shown in the following
table.
http://www.cme.com),
Note This example illustrates swap calculations in MATLAB software.
Timing of the data set used was not rigorously examined and was assumed to
be the proxy for the swap rate reported on October 11, 2002.
Eurodollar Data on Friday, October 11, 2002
MonthYearSettle
10200298.21
11
12200298.3
1
2200398.31
3200398.275
6200398.12
200298.26
200398.3
4-3
4 Derivative Securities
Eurodollar Data on Friday, October 11, 2002 (Continued)
MonthYearSettle
9200397.87
12200397.575
3200497.26
6200496.98
9200496.745
12200496.515
3200596.33
6200596.135
9200595.955
12200595.78
3200695.63
6200695.465
9200695.315
12200695.16
3200795.025
6200794.88
9200794.74
4.005
9
5
28
12200794.59
3200894.48
6200894.375
9200894.
12200894.185
3200994.1
62
9200993.925
12200993.865
009
4-4
Eurodollar Data on Friday, October 11, 2002 (Continued)
MonthYearSettle
3201093.82
6201093.755
9201093.7
12201093.645
3201193.61
6201193.56
9201193.515
12201193.47
3201293.445
6201293.41
9201293.39
Pricing and Hedging
Using this data, you can compute 1-, 2-, 3-, 4-, 5-, 7-, and 10-year swap rates
with the toolbox function
liborfloat2fixed. The function requires you
to input only Eurodollar data, the settlement date, and tenor of the swap.
MATLAB software then performs the required computations.
To illustrate how this function works, first load the data contained in the
supplied Excel
[EDRawData, textdata] = x lsread('EDdata.xls');
®
worksheet EDdata.xls.
Extract the month from the first column and the year from the second column.
The rate used as proxy is the arithmetic average of rates on opening and
closing.
MATLAB returns a par-swap rate of 2.23% using the default setting
(quarterly compounding and 30/360 accrual), and forward dates and
rates data (quarterly compounded), comparable to 2.17% of Friday’s
average broker data in Table H15 of Federal Reserve Statistical Release
(
In the FixedSpec output, note that the swap rate actually goes forward from
the third Wednesday of October 2002 (October 16, 2002), 5 days after the
original
for the swap rate on
Settle input (October 11, 2002). This, however, is still the best proxy
Settle, as the assumption merely starts the swap’s
effective period and does not affect its valuation method or its length.
The correction suggested by Hull and White improves the result by turning
on convexity adjustment as part of the input to
liborfloat2fixed.(See
Hull, J., Options, Futures, and Other Derivatives, 4th Edition, Prentice-Hall,
2000.) For a long swap, for example, 5 years or more, this correction could
provetobelarge.
The adjustment requires additional parameters:
•
StartDate, which you make the same as Settle (the default) by providing
an empty matrix
ConvexAdj to tell liborfloat2fixed to perform the adjustment.
•
RateParam, which provides the parameters a and S as input to the
•
[] as input.
Hull-White short rate process.
• Optional parameters
matrices
FixedCompound,withwhichyoucanfacilitatecomparison with values cited
•
[] to accept the M ATLAB defaults.
InArrears and Sigma, for which you can use empty
in Table H15 of Federal Reserve Statistical Release by turning the default
quarterly compounding into sem iannual compounding, with the (default)
basis of 30/360.
This returns 2.21% as the 2-year swap rate, quite close to the reported swap
rate for that date.
Analogously, the following table summarizesthesolutionsfor1-,3-,5-,7-,
and 10-year swap rates (convexity-adjusted and unadjusted).
Calculated and Market Average Data of Swap Rates on Friday,
October 11, 2 002
Swap
Length
(Years)UnadjustedAdjustedTable H15
1
22.24%2.21%2.22%
32.70%2.66%2.66%0
4
53.50%3.37%3.36%
74.16%3.92%3.89%+3
104.87%4.42%4.39%+3
1.80%1.79%1.80%
3.12%3.03%3.04%
Adjusted
Error
(Basis Points)
-1
-1
-1
+1
Portfolio Hedging
You can use these results further, such as for hedging a portfolio. The
liborduration function provides a duration-hedging capability. You can
isolate assets (or liabilities) from interest-rate risk exposure with a swap
arrangement.
Suppose you own a b ond with these characteristics:
• $100 million face value
4-8
• 7% coupon paid semiannually
• 5% yield to maturity
• Settlement on October 11, 2002
• Maturity on January 15, 2010
• Interest accruing on an actual/365 basis
Pricing and Hedging
Use of the
bnddury function from Financial Toolbox software shows a modified
duration of 5.6806 years.
To immunize this asset, you can enter into a pay-fixed swap,
specifically a swap in the amount of notional principal (Ns) such that
Ns*SwapDuration + $100M*5.6806 = 0 (or Ns = -100*5.6806/SwapDuration).
Suppose again, you choose to use a 5-, 7-, or 10-year swap (3.37%, 3.92%, and
4.42% from the previous table) as your hedging tool.
This gives a duration of -3.6835, -4.7307, and -6.0661 years for 5-, 7-, and
10-year swaps. The corresponding notional amount is computed by
Ns = -100*5.6806./PayFixDuration
Ns =
154.2163
120.0786
93.6443
The n otional amount entered in pay-fixed side of the swap instantaneously
immunizes the portfolio.
4-9
4 Derivative Securities
Convertible Bond Valuation
A convertible bond (CB) is a debt instrument that can be converted into a
predetermined amount of a company’s equity at certain times before the
bond’s maturity.
Fixed-Income Toolbox software uses a binomial and trinomial tree a pproa ch
(
determined by the uncertainty of the related stock. Once the stock evolution
is modeled, backward discounting is computed.
The last column of such trees provides the data to decide which is more
profitable: the debt notional (plus interest, if any) or the equivalent number of
shares per the notional.
Where debt prevails, the too lbox discounts backward with the risk-free
rate plus the spread reflecting the credit risk of the issuer. Where stock
prevails, the toolbox discounts with the risk-free rate. The intrinsic value of
a convertible bond is the sum of the (probability-adjusted) debt and stock
portions from the last node. This is compared to current stock price, to see
if voluntary or forced conversion may take place. Otherwise, its value is
the intrinsic value. From here, the same discounting process is repeated
after adjusting debt portion to be equal to 0 if any conversion takes place.
Dividends and coupons are handled discretely, at the date they occur.
4-10
The approach is equivalent to solving a one-dimensional partial differential
equation such as one described by Tsiveriotis and Fernandes. (See Tsiveriotis,
K. and C. Fernandes (1998), “Valuing Convertible Bonds with Credit Risk,”
The Journal of Fixed Income, 8 (3), 95-102.) Using the same example of
bond specifications that they use (4% annual coupon, payable twice a year,
callable after 2 years at 110, and redeemable at par in 5 years), the toolbox
gives results like theirs.
Convertible Bond Valuation
The figure on the left shows the bond "floor" of the convertible (a 5% yield,
given a 4% coupon at about 97% par) when share prices are low.
The change of curvature located at the end of the second year is due to the
activation of the embedded (soft) call feature (visible on the surface plot in
the right figure).
Finally, there is the flat section when time is nearing expiration and share
prices are high, indicating a delta of unity, a characteristic of in-the-money
equity options embedded in a bond.
4-11
4 Derivative Securities
Bond Futures
In this section...
“Supported Bond Futures” on page 4-12
“Example Analysis of Bond Futures” on page 4-14
“Managing Interest-Rate Risk with Bond Futures” on page 4-16
Supported Bond Futures
Bond futures are futures contracts where the commodity for delivery is a
government bond. There are established global markets for government bond
futures. Bond futures provide a liquid alternative for managing interest-rate
risk.
In the U.S. market, the Chicago Mercantile Exchange (CME) offers futures on
Treasury bonds and notes with maturities of 2, 5, 10, and 30 years. Typically,
the following bond future contracts from the CME have maturities of 3, 6, 9,
and 12 months:
4-12
• 30-year U.S. Treasury bond
• 10-year U.S. Treasury bond
• 5-year U.S. Treasury bond
• 2-year U.S. Treasury bond
The short position in a Treasury bond or note future contract must deliver
to the long position in one of many possible existing Treasury bonds. For
example, in a 30-year Treasury bond future, the short position must deliver a
Treasury bond with at least 15 years to maturity. Because these bonds have
different values, the bond future contract is standardized by computing a
conversion factor. The conversion factor normalizes the price of a bond to a
theoretical bond with a coupon of 6%. The price of a bond future contract is
represented as:
InvoicePriceFutPrice CFAI=×+
ere:
wh
Bond Futures
FutPrice is the price of the bond future.
CF is the conversion factor for a bond to deliver in a futures contract.
AI is the accrued interest.
You can reference these conversion factors at U.S. Treasury Bond Futures
Contract. The short position in a futures contract has the option of which
bond to deliver and, in the U.S. bond market, when in the delivery month to
deliver the bond. The short position typically chooses to deliver the bond
known as the Cheapest to Deliver (CTD). The CTD bond most often delivers
on the last delivery day of the month.
Fixed-Income Toolbox software supports the following bond futures:
• U.S. Treasury bonds and notes
• German Bobl, Bund, Buxl, and Schatz
• UK Gilts
• Japanese government bonds (JGBs)
The functions supporting all bond futures are:
FunctionPurpose
convfactor
Calculates bond conversion factors for U.S. Treasury
bonds, German Bobl, Bund, Buxl, and Schatz, U.K.
Gilts, and JGBs.
bndfutprice
bndfutimprepo
Prices bond future given repo rates.
Calculates implied repo rates for a bond future given
price.
The functions supporting U.S. Treasury bond futures are:
4-13
4 Derivative Securities
FunctionPurpose
tfutbyprice
Calculates future prices of Treasury bonds given the
spot price.
tfutbyyield
Calculates future prices of Treasury bonds given
current yield.
tfutimprepo
Calculates implied repo rates for the Treasury bond
future given price.
tfutpricebyrepo
Calculates implied repo rates given the Treasury
bond future price.
tfutyieldb
yrepo
Calculates
bond future
implied repo rates given the Treasury
yield.
Example A nalysis of Bond Futures
The following example demonstrates analyzing German Euro-Bund futures
traded on Eurex. However,
apply to bond futures in the U.S., U.K., Germany, and Japan. The workflow
for this analysis is:
convfactor, bndfutprice,andbndfutimprepo
4-14
1 Calculate bond conversion factors.
2 Calcula
3 Price the bond future using the term implied repo rate .
te implied repo rates to find the CTD bond.
Calculating Bond Conversion Factors
Use conversion factors to normalize the price of a particular bond for delivery
in a futures contract. When using conversion factors, the assumption is that a
bond for delivery has a 6% coupon. Use
factors for all bond futures from the U.S., Germany, Japan, and U.K.
For example, conversion factors for Euro-Bund futures on Eurex are listed at
www.eurexchange.com. The delivery date for Euro-Bund futures is the 10th
day of the month, as opposed to bond futures in the U.S., where the short
position has the option of choosing when to deliver the bond.
For the 4% bond, compute the conversion factor with:
This syntax for convfactor worksfineforbondswithstandardcoupon
periods. However, some deliverable bonds have long or short first coupon
periods. Compute the conversion factors for such bonds using the optional
input parameters
input arguments for
StartDate and FirstCouponDate. Specify all optional
convfactor as parameter/value pairs:
Calculating Implied Repo Rates to Find the CTD Bond
To determine the availability of the cheapest bond for deliverable bonds
against a futures contract, compute the implied repo rate for each bond. The
bond with the highest repo rate is the cheapest because it has the lowest
initial value, thus yielding a higher return, provided you deliver it with the
stated futures price. Use
Pricing Bond Futures Using the Term Implied Repo Rate
Use bndfu tpri ce to perform price calculations for all bond futures from the
U.S., Germany, Japan, and U.K. To price the bond, given a term repo rate:
ThePresentValueofaBasisPoint(PVBP)isusedtomanageinterest-rate
risk. PVBP is a measure that quantifies the change in price of a bond given
a one-basis point shi ft in interest rates. The PVBP of a bond is computed
with the following:
PVBP
Duration MarketValue
Bond =
The PVBP of a bond futures contract can be computed with the following:
×
100
Bond Futures
PVBP
PVBP
Futures
=
CTDConversionFactor
CTDBond
Use bnddurp and bnddury from Financial Toolbox software to compute the
modified durations of CTD bonds. For more information, see the Fixed-Income
Toolbox demo “Managing Interest Rate Risk with Bond Futures” at:
demo toolbox 'fixed-income'
4-17
4 Derivative Securities
4-18
5
Interest-Rate Curve Objects
• “Introduction to Interest-Rate Curve Objects” on page 5-2
• “Creating Interest-Rate Curve Objects” on page 5-4
• “Creating an IRDataCurve Object” on page 5-6
• “Creating an IRFunctionCurve Object” on page 5-13
• “Converting an IRDataCurve or IRFunctionCurve Object” on page 5-25
5 Interest-Rate Curve Objects
Introduction to Interest-Rate Curve Objects
In this section...
“Class Structure” on page 5-2
“Supported Workflow Model Using Interest-Rate Curve Objects” on page 5-3
Class Structure
Fixed-Income Toolbox class structure supports interest-rate curve objects.
The class structure supports five classes .
Class NameDescription
“@IRCurve” on page A-4Base abstract class for interest-rate curves.
IRCurve is an abstract class; you cannot
create instances of it directly. You can create
IRFunctionCurve and IRDataCurve objects
that are derived from this class.
5-2
“@IRDataCurve” on page
A-7
“@IRFunctionCurve” on
page A-12
“@IRBootstrapOptions”
on page A-2
“@IRFitOptions” on page
A-10
Creates a representation of an interest-rate
curve with dates and data.
constructed directly by specifying dates and
corresponding interes t rates or discount factors,
or you can bootstrap an
from market data.
Creates a representation of an interest-rate
curve with a function.
constructed directly by specifying a function
handle, or you can fit a function to market data
using methods of the
The IRBootstrapOptions object lets you specify
options relating to the bootstrapping of an
IRDataCurve object.
The IRFitOptions object lets you specify
options relating to the fitting process for an
IRFunctionCurve object.
IRFunctionCurve object.
IRDataCurve is
IRDataCurve object
IRFunctionCurve is
Introduction to Interest-Rate Curve Objects
Supported Workflow Model Using Interest-Rate
Curve Objects
The supported workflow model for using interest-rate curve objects is:
1 Create an interest-rate curve based on an IRDataCurve object or an
IRFunctionCurve object.
• To create an
IRDataCurve object:
– Use vectors of dates and data with interpolation methods.
– Use bootstrapping based on market instruments.
• To create an
IRFunctionCurve object:
– Specify a function handle.
– Fit a function using the Nelson-Siegel model, Svensson model, or
smoothing spline model.
– Fit a custom function.
2 Use methods of the IRDataCurve or IRFunctionCurve objects to extract
forward, zero, discount factor, or par yield curves for the interest-rate
curve object.
3 Convert an interest-rate curve from an IRDataCurve or IRFunctionCurve
object to a RateSpec structure. This RateSpec structure is identical to
the
RateSpec produced by the Financial Derivatives Toolbox function
intenvset.UsingtheRateSpec for an interest-rate curve object, you can
then use Financial Derivatives Toolbox functions to model an interest-rate
structure and price. For more information, see “Interest-Rate Deriv atives ”.
5-3
5 Interest-Rate Curve Objects
Creating Interest-Rate Curve Objects
Depending on your data and purpose for analysis, you can create an
interest-rate curve object by using an
object.
IRDataCurve or IRFunctionCurve
To create an
• Use the
• Use the
Using an
• Forward rate curve —
• Zero rate curve — getZeroRates
• Discount rate curve — getDiscountFactors
• Par yield curve — getParYields
Alternatively, to create an IRFunctionCurve object, you can:
• Use the
handle.
• Use
IRDataCurve object, you can:
IRDataCurve constructor.
IRDataCurve method bootstrap.
IRDataCurve object, you can use the following methods to determine:
getForwardRates
IRFunctionCurve constructor and directly specify a function
IRFunctionCurve methods:
- fitNelsonSie gel fits a Nelson-Siegel model on page Glossary-8 to
market data for bonds.
- fitSvensson fits a Sven sson model on page Glossary-12 to market
data for bonds.
5-4
- fitSmoothing Spli ne fits a smoothing spline on page Glossary-11
function to market data for bonds.
- fitFunction custom fits an interest-rate curve object to market data
for bonds.
Using an
determine:
IRFunctionCurve object, you can use the following method to
Creating Interest-Rate Curve Objects
• Forward rate curve — getForwardRates
• Zero rate curve — getZeroRates
• Discount rate curve — getDiscountFactors
• Par yield curve — getParYields
In addition, you can convert an IRDataCurve or IRFunctionCurve to a
RateSpec structure. For m ore information, s ee “Converting an IRDataCurve
or IRFunctionCurve Object” on page 5-25.
5-5
5 Interest-Rate Curve Objects
Creating an IRDataCurve Object
In this section...
“Using the IRDataCurve Constructor with Dates and Data” on page 5-6
“Using IRDataCurve bootstrap Method for Bootstrapping Based on Market
Instruments” on page 5-7
Using the IRDataCurve Constructor with Dates and
Data
Use the IRDataCurve constructor with vectors of dates and data to create
an interest-rate curve object. When constructing the
you can also use optional inputs to define how the interest-rate curve is
constructed from the dates and data.
Example
In this example, you create the vectors for Dates and Data for an interest-rate
curve:
IRDataCurve object,
5-6
Data = [2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100;
legend({'Constant Forward Rates','PCHIP Forward Rates','Constant Zero Rates',...
Creating an IRDataCurve Object
'PCHIP Zero Rates'},'location','SouthEast')
title('Interpolation methods for IRDataCurve objects')
datetick
The plot demonstrates the relationship of the forward and zero rate curves.
Using IRDataCurve bootstrap Method for
Bootstrapping Based on Market Instruments
Use the bootstrapping method, based on market instruments, to create an
interest-rate curve object. When bootstrapping, you also have the option
to define a range of interpolation methods (
pchip).
mple 1
Exa
In this example, you bootstrap a swap curve from deposits, Eurodollar
Futures and swaps. The input market data for this example is hard-coded
linear, spline, cont sant ,and
5-7
5 Interest-Rate Curve Objects
and specified as two cell arrays of data; one cell array indicates the type of
instrument and the other contains the
quote for the ins trume n t. For deposits and swaps, the quote is a rate; for the
EuroDollar futures, the quote is a price. Although bonds are not use d in this
example, a bond would also be quoted with a price.
The boot stra p method is called as a static method of the “@IRDataCurve”
on page A-7 class. Inputs to this method include the curve
Type (zero
or forward), Settle date, InstrumentTypes,andInstrument data.
The
bootstrap method also supports optional arguments, including an
interpolation method, compounding, basis, and an options structure for
bootstrapping. For example, you are passing in an “@IRBootstrapOptions”
on page A-2 object which includes information for the
In this example, you bootstrap a swap curve from deposits, Eurodollar
futures and swaps. The input market data for this example is hard-coded
and specified as two cell arrays of data; one cell array indicates the type of
Creating an IRDataCurve Object
instrument and the other cell array contains the Settle, Maturity values
and a market quote for the instrument. This example of bootstrapping also
demonstrates the use of an
The plot demonstrates the par yields curve for the market data.
5-12
Creating an IRFunctionCurve Object
In this section...
“Using a Function Handle to Fit an IRFunctionCurve Object” on page 5-13
“Using the Nelson-Siegel Method to Fit an IRFunctionCurve Object” on
page 5-14
“Using the Svensson Method to Fit an IRFunctionCurve Object” on page
5-16
“Using the Smoothing Spline Method to Fit an IRFunctionCurve Object”
on page 5-18
“Using the fitFunction to Create a Custom Fitting Function for an
IRFunctionCurve Object” on page 5-21
Using a Function Handle to Fit an IRFunctionCurve
Object
You can use the constructor IRFunctionCurve with a MATLAB function
handle to define an interest-rate curve. For more information on defining
a function handle, see the MATLAB Programming Fundamentals
documentation.
Creating an IRFunctionCurve Object
Example
This example uses a Functio nHandle argument with a value @( t) t.^2
to construct an interest-rate curve:
title('Nelson Siegel model of UK instantaneous no minal forward curve')
5-15
5 Interest-Rate Curve Objects
5-16
Using the Svensson Method to Fit an IRFunctionCurve
Object
Use the method, fitSvensson, for the Svensson model to improve the
flexibility of the curves and the fit for a Nelson-Siegel model. In 1994,
Svensson extended Nelson and Siegel’s function by adding a further term that
allows for a second “hump.” The extra precision is achieved at the cost of
adding two more parameters, β3 and τ2, which have to be estimated.
Example
In this example of using the fitSvensson method, an IRFitOptions
structure, previously defined using the IRFitOptions constructor, is used.
Thus, you must specify
and the
Load the data:
OptOptions optimization parameters for lsqnonlin.
FitType, InitialGuess, UpperBound, LowerBound,
Creating an IRFunctionCurve Object
load ukdata20080430
Convert repo rates to be equivalent zero coupon bonds:
title('Svensson model of UK instantaneous nominal forward curve')
5-18
Using the Smoothing Spline Method to Fit an
IRFunctionCurve Object
Use the method, fitSmoothingSpline, to model the t erm structure with a
spline, specifically, the term structure represents the forward curve with a
cubic spline.
Example
The IRFunctionCurve object is used to fit a smoothing spline representation
of the forward curve with a penalty function. Required inputs are
Settle,thematrixofInstruments,andLambdafun, a function handle
containing the penalty function
Type,
Creating an IRFunctionCurve Object
Load the data:
load ukdata20080430
Convert repo rates to be equivalent zero coupon bonds:
Converting an IRDataCurve or IRFunctionCurve Object
Converting an IRDataCurve or IRFunctionCurve Object
In this section...
“Introduction” on page 5-25
“Using the toRateSpec Method” on page 5-25
“Using V ector of Dates and Data Methods” on page 5-26
Introduction
The IRDataCurve and IRFunct ionCurve objects for interest-rate curves
support conversion to:
• A
RateSpec structure. The RateSpec generated from an IRDataCurve or
IRFunctionCurve object, using the toRateSpec method, is identical to the
RateSpec structure created with intenvset using Financial Derivatives
Toolbox software.
• A vector of dates and data from an
prbyzero, bkcall, bkput, tfutbyprice,andtfutbyyield or any function
IRDataCurve object acceptable to
that requires a term structure of interest rates.
Using the toRateSpec Method
To convert an IRDataCurve or IRFunctionCurve object to a RateSpec
structure, you must first create an interest-rate curve object. Then, use the
toRateSpec method for an IRDataCurve object or thetoRateSpec method for