This example shows how to find the bond equivalent yield for a Treasury bill that has a settlement date of February 11, 2000, a maturity date of August 7, 2000, and a discount rate is 5.77.
Settlement date of the Treasury bill, specified as a scalar or a
NTBILLS-by-1 vector using a
datetime array, string array, or date character vectors.
Settle must be earlier than
Maturity.
To support existing code, beytbill also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char | string | datetime
Maturity date of the Treasury bill, specified as a scalar or a
NTBILLS-by-1 vector using a
datetime array, string array, or date character vectors.
To support existing code, beytbill also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char | string | datetime
Discount rate of the Treasury bill, specified as a scalar of a
NTBILLS-by-1 vector of decimal
fraction values.
Treasury bill yield, returned as a scalar or
NTBILLS-by-1 vector.
Note
The number of days to maturity is typically quoted as: md - sd
- 1. A NaN is returned for all cases in which
negative prices are implied by the discount rate,
Discount, and the number of days
between Settle and
Maturity.
Although beytbill 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.