cdprice
Price of certificate of deposit
Syntax
Description
[
computes the price of a certificate of deposit given its yield.Price
,AccrInt
] = cdprice(Yield
,CouponRate
,Settle
,Maturity
,IssueDate
)
cdprice
assumes that the certificates of deposit pay
interest at maturity. Because of the simple interest treatment of these
securities, this function is best used for short-term maturities (less than 1
year). The default simple interest calculation uses the
Basis
for the actual/360 convention
(2
).
Examples
Compute the Price and Accrued Interest for a Certificate of Deposit
This example shows how to compute the price and the accrued interest due on the settlement date, given a certificate of deposit with the following characteristics.
Yield = 0.0525; CouponRate = 0.05; Settle = '02-Jan-02'; Maturity = '31-Mar-02'; IssueDate = '1-Oct-01'; [Price, AccruedInt] = cdprice(Yield, CouponRate, Settle, ... Maturity, IssueDate)
Price = 99.9233
AccruedInt = 1.2917
Compute the Price and Accrued Interest for a Certificate of Deposit Using datetime Inputs
This example shows how to use datetime
inputs to compute the price and the accrued interest due on the settlement date, given a certificate of deposit with the following characteristics.
Yield = 0.0525; CouponRate = 0.05; Settle = datetime('02-Jan-02','Locale','en_US'); Maturity = datetime('31-Mar-02','Locale','en_US'); IssueDate = datetime('1-Oct-01','Locale','en_US'); [Price, AccruedInt] = cdprice(Yield, CouponRate, Settle, ... Maturity, IssueDate)
Price = 99.9233
AccruedInt = 1.2917
Input Arguments
Yield
— Simple yield to maturity over basis denominator
numeric
Simple yield to maturity over the basis denominator, specified as a
numeric value using a scalar or a
NCDS
-by-1
or
1
-by-NCDS
vector.
Data Types: double
CouponRate
— Coupon annual interest rate
decimal
Coupon annual interest rate, specified as decimal using a scalar or a
NCDS
-by-1
or
1
-by-NCDS
vector.
Data Types: double
Settle
— Settlement date for certificate of deposit
datetime array | string array | date character vector
Settlement date for the certificate of deposit, specified as a scalar
or a NCDS
-by-1
or
1
-by-NCDS
vector using a datetime
array, string array, or date character vectors. The
Settle
date must be before the
Maturity
date.
To support existing code, cdprice
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
Maturity
— Maturity date for certificate of deposit
datetime array | string array | date character vector
Maturity date for the certificate of deposit, specified as a scalar or
a NCDS
-by-1
or
1
-by-NCDS
vector using a datetime
array, string array, or date character vectors.
To support existing code, cdprice
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
IssueDate
— Issue date for certificate of deposit
datetime array | string array | date character vector
Issue date for the certificate of deposit, specified as a scalar or a
NCDS
-by-1
or
1
-by-NCDS
vector using a datetime
array, string array, or date character vectors.
To support existing code, cdprice
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
Basis
— Day-count basis for certificate of deposit
2
(actual/360) (default) | integers of the set [0...13]
| vector of integers of the set [0...13]
(Optional) Day-count basis for the certificate of deposit, specified
as a scalar or a NINST
-by-1
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.
Data Types: double
Output Arguments
Price
— Clean price of certificate of deposit per $100
numeric
Clean price of the certificate of deposit per $100, returned as a
NCDS
-by-1
or
1
-by-NCDS
vector.
AccrInt
— Accrued interest payable at settlement per unit of face value
numeric
Accrued interest payable at settlement per unit of face value,
returned as a NCDS
-by-1
or
1
-by-NCDS
vector.
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although cdprice
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.
See Also
bndprice
| cdai
| cdyield
| stepcpnprice
(Financial Instruments Toolbox) | tbillprice
| datetime
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 (한국어)