prtbill
Price of Treasury bill
Description
Examples
Calculate the Price for a Treasury Bill
This example shows how to return the price for a Treasury bill, where the settlement date of a Treasury bill is February 10, 2002, the maturity date is August 6, 2002, the discount rate is 3.77%, and the par value is $1000.
Price = prtbill('2/10/2002', '8/6/2002', 1000, 0.0377)
Price = 981.4642
Calculate the Price for a Treasury Bill Using datetime Inputs
This example shows how to use datetime
inputs to return the price for a Treasury bill, where the settlement date of a Treasury bill is February 10, 2002, the maturity date is August 6, 2002, the discount rate is 3.77%, and the par value is $1000.
Price = prtbill(datetime(2002,2,10), datetime(2002,8,6), 1000, 0.0377)
Price = 981.4642
Input Arguments
Settle
— Settlement date for Treasury bill
datetime scalar | string scalar | date character vector
Settlement date for the Treasury bill, specified as a scalar datetime,
string, or date character vector. The Settle
date must be
before the Maturity
date.
To support existing code, prtbill
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
Maturity
— Maturity date for Treasury bill
datetime scalar | string scalar | date character vector
Maturity date for the Treasury bill, specified as a scalar datetime, string, or date character vector.
To support existing code, prtbill
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
Face
— Redemption value of Treasury bill
numeric
Redemption value (par value) of the Treasury bill, specified as a numeric value.
Data Types: double
Discount
— Discount rate of Treasury bill
decimal fraction
Discount rate of the Treasury bill, specified as a decimal fraction value.
Data Types: double
Output Arguments
Price
— Treasury bill price
numeric
Treasury bill price, returned as a numeric value.
References
[1] Bodie, Kane, and Marcus. Investments. McGraw-Hill Education, 2013.
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although prtbill
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.
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 (한국어)