bnddurp
Bond duration given price
In R2017b, 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
, andLastCouponInterest
.
Syntax
Description
[
computes the Macaulay and modified duration ofModDuration
,YearDuration
,PerDuration
] = bnddurp(Price
,CouponRate
,Settle
,Maturity
)NUMBONDS
fixed-income securities given a clean price for each bond.
bnddurp
决定了麦考利和修改时间a bond whether the first or last coupon periods in the coupon structure are short or long (that is, whether the coupon structure is synchronized to maturity).bnddurp
also determines the Macaulay and modified duration for a zero coupon bond.
[
adds optional name-value pair arguments.ModDuration
,YearDuration
,PerDuration
] = bnddurp(___,Name,Value
)
Examples
Find Bond Duration Given Price
This example shows how to compute the duration of three bonds given their prices.
Price = [106; 100; 98]; CouponRate = 0.055; Settle ='02-Aug-1999'; Maturity ='15-Jun-2004'; Period = 2; Basis = 0; [ModDuration, YearDuration, PerDuration] = bnddurp(Price,...CouponRate, Settle, Maturity, Period, Basis)
ModDuration =3×14.2400 4.1925 4.1759
YearDuration =3×14.3275 4.3077 4.3007
PerDuration =3×18.6549 8.6154 8.6014
Find Bond Duration Given Price Using datetime Inputs
This example shows how to usedatetime
inputs to compute the duration of three bonds given their prices.
Price = [106; 100; 98]; CouponRate = 0.055; Settle = datetime('02-Aug-1999','Locale','en_US'); Maturity = datetime('15-Jun-2004','Locale','en_US'); Period = 2; Basis = 0; [ModDuration, YearDuration, PerDuration] = bnddurp(Price,...CouponRate, Settle, Maturity, Period, Basis)
ModDuration =3×14.2400 4.1925 4.1759
YearDuration =3×14.3275 4.3077 4.3007
PerDuration =3×18.6549 8.6154 8.6014
Input Arguments
Price
—Clean price (excludes accrued interest)
numeric
Clean price (excludes accrued interest), specified as numeric value using a scalar or aNUMBONDS
-by-1
or1
-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 value using a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector.
Data Types:double
Settle
—Settlement date for certificate of deposit
serial date number|date character vector|datetime
Settlement date for the certificate of deposit, specified as a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector using serial date numbers, date character vectors, or datetime arrays. TheSettle
date must be before theMaturity
date.
Data Types:double
|char
|datetime
Maturity
—Maturity date for certificate of deposit
serial date number|date character vector|datetime
Maturity date for the certificate of deposit, specified as a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector using serial date numbers, date character vectors, or datetime arrays.
Data Types:double
|char
|datetime
Name-Value Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, whereName
is the argument name andValue
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 encloseName
in quotes.
Example:[ModDuration,YearDuration,PerDuration] = bnddurp(Price,CouponRate,Settle,Maturity,'Period',4,'Basis',7)
Period
—Number of coupon payments per year
2
(default) |numeric with values0
,1
,2
,3
,4
,6
or12
Number of coupon payments per year, specified as the comma-separated pair consisting of'Period'
and a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector using the values:0
,1
,2
,3
,4
,6
, or12
.
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 aNUMBONDS
-by-1
or1
-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, seeBasis.
Data Types:double
EndMonthRule
—End-of-month rule flag
1
(in effect)(default) |nonnegative integer0
or1
End-of-month rule flag, specified as the comma-separated pair consisting of'EndMonthRule'
and a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector. This rule applies only whenMaturity
is an end-of-month date for a month having 30 or fewer days.
0
= Ignore rule, meaning that a bond 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
serial date number|date character vector|datetime
Bond Issue date, specified as the comma-separated pair consisting of'IssueDate'
and a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector using serial date numbers, date character vectors, or datetime arrays.
If you do not specify anIssueDate
, the cash flow payment dates are determined from other inputs.
Data Types:double
|char
|datetime
FirstCouponDate
—Irregular or normal first coupon date
serial date number|date character vector|datetime
Irregular or normal first coupon date, specified as the comma-separated pair consisting of'FirstCouponDate'
and a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector using serial date numbers, date character vectors, or datetime arrays.
If you do not specify aFirstCouponDate
, the cash flow payment dates are determined from other inputs.
Data Types:double
|char
|datetime
LastCouponDate
—Irregular or normal last coupon date
serial date number|date character vector|datetime
Irregular or normal last coupon date, specified as the comma-separated pair consisting of'LastCouponDate'
and a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector using serial date numbers, date character vectors, or datetime arrays.
If you do not specify aLastCouponDate
, the cash flow payment dates are determined from other inputs.
Data Types:double
|char
|datetime
StartDate
—向前paym的开始日期ents
serial date number|date character vector|datetime
向前paym的开始日期ents, specified as the comma-separated pair consisting of'StartDate'
and a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector using serial date numbers, date character vectors, or datetime arrays. TheStartDate
is when a bond actually starts (the date from which a bond cash flow is considered). To make an instrument forward-starting, specify this date as a future date.
If you do not specify aStartDate
, the effective start date is theSettle
date.
Data Types:double
|char
|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 aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector.
Data Types:double
CompoundingFrequency
—Compounding frequency for yield calculation
SIA bases uses2
, ICMA bases uses1
(default) |integer with value of1
,2
,3
,4
,6
, or12
Compounding frequency for yield calculation, specified as the comma-separated pair consisting of'CompoundingFrequency'
and a scalar or aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector.
1
— Annual compounding2
— Semiannual compounding3
— Compounding three times per year4
— Quarterly compounding6
— Bimonthly compounding12
— Monthly compounding
Note
By default, SIA bases (0
-7
) andBUS/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 uses0
(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 aNUMBONDS
-by-1
or1
-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, seeBasis.
Note
If a SIA day-count basis is defined in theBasis
input argument and there is no value assigned forDiscountBasis
, 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 theBasis
input argument and there is no value assigned forDiscountBasis
, the specified bases from theBasis
input argument are used.
Data Types:double
LastCouponInterest
—Compounding convention for computing yield of a bond in last coupon period
compound
(default) |values aresimple
orcompound
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 aNUMBONDS
-by-1
or1
-by-NUMBONDS
vector.LastCouponInterest
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
ModDuration
— Modified duration in years
numeric
Modified duration in years reported on a semiannual bond basis (in accordance with SIA convention), returned as aNUMBONDS
-by-1
vector.
YearDuration
— Macaulay duration in years
numeric
Macaulay duration in years, returned as aNUMBONDS
-by-1
vector.
PerDuration
— Periodic Macaulay duration
numeric
Periodic Macaulay duration reported on a semiannual bond basis (in accordance with SIA convention), returned as aNUMBONDS
-by-1
vector.
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
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
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)