yldtbill
Yield of Treasury bill
Description
Examples
Find the Yield for a Treasury Bill
This example shows how to return the yield for a Treasury bill, given the settlement date of a Treasury bill is February 10, 2000, the maturity date is August 6, 2000, the par value is $1000, and the price is $981.36.
Yield = yldtbill('2/10/2000', '8/6/2000', 1000, 981.36)
Yield = 0.0384
Find the Yield for a Treasury Bill Using datetime Inputs
This example shows how to use datetime
inputs to return the yield for a Treasury bill, given the settlement date of a Treasury bill is February 10, 2000, the maturity date is August 6, 2000, the par value is $1000, and the price is $981.36.
Yield = yldtbill(datetime(2000,2,10), datetime(2000,8,6), 1000, 981.36)
Yield = 0.0384
Input Arguments
Settle
— Settlement date of Treasury bill
datetime array | string array | date character vector
Settlement date of the Treasury bill, specified using a datetime
array, string array, or date character vectors. The
Settle
date must be before the
Maturity
date.
To support existing code, yldtbill
also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char
| string
| datetime
Maturity
— Maturity date of Treasury bill
datetime array | string array | date character vector
Maturity date of the Treasury bill, specified using a datetime array, string array, or date character vectors.
To support existing code, yldtbill
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 scalar or vector using numeric values.
Data Types: double
Price
— Price of Treasury bill
numeric
Price of the Treasury bill, specified as a scalar or vector using numeric values.
Data Types: double
Output Arguments
Yield
— Yield for Treasury bill
numeric
Yield for Treasury bill, returned as a scalar or vector of numeric values.
References
[1] Bodie, Kane, and Marcus. Investments. McGraw-Hill Education, 2013.
Version History
Introduced before R2006aR2022b: Serial date numbers not recommended
Although yldtbill
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)