bndyield
Yield to maturity for fixed-income security
Description
given Yield
= bndyield(Price
,CouponRate
,Settle
,Maturity
)NUMBONDS
bonds with SIA date parameters and clean prices
(excludes accrued interest), returns the bond equivalent yields to maturity.
adds optional name-value arguments. Yield
= bndyield(___,Name,Value
)
Examples
Compute Yield to Maturity for a Treasury Bond
This example shows how to compute the yield of a Treasury bond at three different price values.
Price = [95; 100; 105]; CouponRate = 0.05; Settle = '20-Jan-1997'; Maturity = '15-Jun-2002'; Period = 2; Basis = 0; Yield = bndyield(Price, CouponRate, Settle,... Maturity, Period, Basis)
Yield = 3×1
0.0610
0.0500
0.0396
Compute Yield to Maturity for a Treasury Bond Using datetime Inputs
This example shows how to use datetime
inputs to compute the yield of a Treasury bond at three different price values.
Price = [95; 100; 105]; CouponRate = 0.05; Settle = datetime('20-Jan-1997','Locale','en_US'); Maturity = datetime('15-Jun-2002','Locale','en_US'); Period = 2; Basis = 0; Yield = bndyield(Price, CouponRate, Settle,... Maturity, Period, Basis)
Yield = 3×1
0.0610
0.0500
0.0396
Compute the Yield of a Treasury Bond Using the Same Basis for Discounting and Generating the Cash Flows
Compute the yield of a Treasury bond.
Price = [95; 100; 105];
CouponRate = 0.0345;
Settle = datetime(2016,5,15);
Maturity = datetime(2026,2,2);
Period = 2;
Basis = 1;
format long
Yield = bndyield(Price,CouponRate,Settle,Maturity,Period,Basis)
Yield = 3×1
0.040764403932618
0.034482347625316
0.028554719853118
Using the same data, compute the yield of a Treasury bond using the same basis for discounting and generating the cash flows.
DiscountBasis = 1; Yield = bndyield(Price,CouponRate,Settle,Maturity,'Period',Period,'Basis',Basis, ... 'DiscountBasis',DiscountBasis)
Yield = 3×1
0.040780176658036
0.034495592361619
0.028565614029497
Input Arguments
Price
— Clean price of the bond
numeric
Clean price of the bond (current price without accrued interest),
specified as a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector.
Data Types: double
CouponRate
— Annual percentage rate used to determine coupons payable on a bond
decimal
Annual percentage rate used to determine the coupons payable on a bond,
specified as decimal using a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector.
Data Types: double
Settle
— Settlement date of bond
datetime array | string array | date character vector
Settlement date of the bond, specified as a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector using a
datetime array, string array, or date character vectors. The
Settle
date must be before the
Maturity
date.
To support existing code, bndyield
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
Maturity
— Maturity date of bond
datetime array | string array | date character vector
Maturity date of the bond, specified as a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector using a
datetime array, string array, or date character vectors.
To support existing code, bndyield
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
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: Yield =
bndyield(Price,CouponRate,Settle,Maturity,'Period',4,'Basis',9)
Period
— Number of coupon payments per year
2
(default) | numeric with values 0
, 1
, 2
, 3
, 4
,
6
or 12
Number of coupon payments per year, specified as the comma-separated
pair consisting of 'Period'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector using the
values: 0
, 1
,
2
, 3
, 4
,
6
, or 12
.
Data Types: double
Basis
— Day-count basis of instrument
0
(default) | numeric values: 0
,1
, 2
, 3
, 4
, 6
, 7
, 8
,
9
, 10
, 11
,
12
, 13
Day-count of the instrument, specified as the comma-separated pair
consisting of 'Basis'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector using a
supported value:
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
EndMonthRule
— End-of-month rule flag
1
(in effect) (default) | nonnegative integer 0
or 1
End-of-month rule flag, specified as the comma-separated pair
consisting of 'EndMonthRule'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector. 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 coupon payment date is always the same numerical day of the month.1
= Set rule on, meaning that a bond coupon payment date is always the last actual day of the month.
Data Types: logical
IssueDate
— Bond issue date
datetime array | string array | date character vector
Bond Issue date, specified as the comma-separated pair consisting of
'IssueDate'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector using a
datetime array, string array, or date character vectors.
If you do not specify an IssueDate
, the cash flow
payment dates are determined from other inputs.
To support existing code, bndyield
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
FirstCouponDate
— Irregular or normal first coupon date
datetime array | string array | date character vector
Irregular or normal first coupon date, specified as the
comma-separated pair consisting of 'FirstCouponDate'
and a scalar or a NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector using a
datetime array, string array, or date character vectors.
If you do not specify a FirstCouponDate
, the cash
flow payment dates are determined from other inputs.
To support existing code, bndyield
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
LastCouponDate
— Irregular or normal last coupon date
datetime array | string array | date character vector
Irregular or normal last coupon date, specified as the comma-separated
pair consisting of 'LastCouponDate'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector using a
datetime array, string array, or date character vectors.
If you do not specify a LastCouponDate
, the cash
flow payment dates are determined from other inputs.
To support existing code, bndyield
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
StartDate
— Forward starting date of payments
datetime array | string array | date character vector
Forward starting date of payments, specified as the comma-separated
pair consisting of 'StartDate'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector using a
datetime array, string array, or date character vectors.
If you do not specify a StartDate
, the effective
start date is the Settle
date.
To support existing code, bndyield
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
Face
— Face value of bond
100
(default) | numeric
Face value of the bond, specified as the comma-separated pair
consisting of 'Face'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector.
Data Types: double
CompoundingFrequency
— Compounding frequency for yield calculation
SIA uses 2
, ICMA uses 1
(default) | integer with value of 1
, 2
, 3
, 4
, 6
, or
12
Compounding frequency for yield calculation, specified as the
comma-separated pair consisting of
'CompoundingFrequency'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector. Values are:
1
— Annual compounding2
— Semiannual compounding3
— Compounding three times per year4
— Quarterly compounding6
— Bimonthly compounding12
— Monthly compounding
Note
By default, SIA bases
(0
-7
) and
BUS/252
use a semiannual compounding
convention and ICMA bases
(8
-12
) use an annual
compounding convention.
Data Types: double
DiscountBasis
— Basis used to compute the discount factors for computing the yield
SIA uses 0
(default) | integers of the set [0...13]
| vector of integers of the set [0...13]
Basis used to compute the discount factors for computing the yield,
specified as the comma-separated pair consisting of
'DiscountBasis'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector. Values
are:
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.
Note
If a SIA day-count basis is defined in the
Basis
input argument and there is no
value assigned for DiscountBasis
, the default
behavior is for SIA bases to use the
actual/actual
day count to compute
discount factors.
If an ICMA day-count basis or BUS/252 is defined in the
Basis
input argument and there is no
value assigned for DiscountBasis
, the
specified bases from the Basis
input argument
are used.
Data Types: double
LastCouponInterest
— Compounding convention for computing yield of a bond in last coupon period
compound
(default) | values are simple
or compound
Compounding convention for computing the yield of a bond in the last
coupon period, specified as the comma-separated pair consisting of
'LastCouponInterest'
and a scalar or a
NUMBONDS
-by-1
or
1
-by-NUMBONDS
vector. This is
based on only the last coupon and the face value to be repaid.
Acceptable values are:
simple
compound
Data Types: char
| cell
Output Arguments
Yield
— Yield to maturity
numeric
Yield to maturity, returned as a
NUMBONDS
-by-1
vector.
Note
By default, when you specify Basis
, the SIA
bases (0
-7
) and
BUS/252
(base 13
) use a
semiannual compounding convention and the ISMA bases
(8
-12
) use an annual
compounding convention.
More About
Price and Yield Conventions
The Price
and Yield
are
related to different formulae for SIA and ICMA conventions.
For SIA conventions, Price
and Yield
are
related by the formula:
Price + Accrued Interest = sum(Cash_Flow*(1+Yield/2)^(-Time))
For ICMA conventions, the Price
and
Yield
are related by the
formula:
Price + Accrued Interest = sum(Cash_Flow*(1+Yield)^(-Time))
Algorithms
For SIA conventions, the following formula defines bond price and yield:
where:
PV = |
Present value of a cash flow. |
CF = |
The cash flow amount. |
z = |
The risk-adjusted annualized rate or yield corresponding to a given cash flow. The yield is quoted on a semiannual basis. |
f = |
The frequency of quotes for the yield. |
TF = |
Time factor for a given cash flow. Time is measured in
semiannual periods from the settlement date to the cash flow
date. In computing time factors, use SIA
|
For ICMA conventions, the frequency of annual coupon payments determines bond price and yield.
References
[1] Krgin, D. Handbook of Global Fixed Income Calculations. Wiley, 2002.
[2] Mayle, J. "Standard Securities Calculations Methods: Fixed Income Securities Formulas for Analytic Measures." SIA, Vol 2, Jan 1994.
[3] Stigum, M., Robinson, F. Money Market and Bond Calculation. McGraw-Hill, 1996.
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although bndyield
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.
R2017b: Support for optional name-value input arguments
The specification of optional input arguments has changed. While the previous
ordered inputs syntax is still supported, it may no longer be supported in a future
release. Use the optional name-value pair inputs: Period
,
Basis
, EndMonthRule
,
IssueDate
,FirstCouponDate
,
LastCouponDate
,
StartDate
,Face
,
CompoundingFrequency
, DiscountBasis
,
and LastCouponInterest
.
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 (한국어)