treasuryBillYield¶
Evaluates the yield of a Treasury bill.
Synopsis¶
treasuryBillYield (settlement, maturity, price)
Required Arguments¶
- date
settlement
(Input) - The date on which payment is made to settle a trade. For a more detailed discussion on dates see the Usage Notes section of this chapter.
- date
maturity
(Input) - The date on which the bond comes due, and principal and accrued interest are paid. For a more detailed discussion on dates see the Usage Notes section of this chapter.
- float
price
(Input) - Price per $100 face value of the Treasury bill.
Return Value¶
The yield for a Treasury bill. If no result can be computed, NaN is returned.
Description¶
Function treasuryBillYield
computes the yield for a Treasury bill.
It is computed using the following:
\[\left(\frac{100 - \mathit{price}}{\mathit{price}}\right)
\left(\frac{360}{\mathit{DSM}}\right)\]
In the equation above, DSM represents the number of days in the period starting with the settlement date and ending with the maturity date (any maturity date that is more than one calendar year after the settlement date is excluded).
Example¶
In this example, treasuryBillYield
computes the yield for a Treasury
bill with the settlement date of July 1, 2000, the maturity date of July 1,
2001, and priced at $94.93.
from __future__ import print_function
from numpy import *
from datetime import date
from pyimsl.math.treasuryBillYield import treasuryBillYield
price = 94.93
settlement = date(2000, 7, 1)
maturity = date(2001, 7, 1)
tb_yield = treasuryBillYield(settlement, maturity, price)
print("The yield for the T-bill is $%.2f." % (tb_yield * 100))
Output¶
The yield for the T-bill is $5.27.