interestRateSecurity¶
Evaluates the interest rate of a fully invested security.
Synopsis¶
interestRateSecurity (settlement, maturity, investment, redemption, basis)
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
investment
(Input) - The total amount one has invested in the security.
- float
redemption
(Input) - Amount to be received at maturity.
- int
basis
(Input) - The method for computing the number of days between two dates. It should
be one of
DAY_CNT_BASIS_ACTUALACTUAL
,DAY_CNT_BASIS_NASD
,DAY_CNT_BASIS_ACTUAL360
,DAY_CNT_BASIS_ACTUAL365
, orDAY_CNT_BASIS_30E360
. For a more detailed discussion see the Usage Notes section of this chapter.
Return Value¶
The interest rate for a fully invested security. If no result can be computed, NaN is returned.
Description¶
Function interestRateSecurity
computes the interest rate for a fully
invested security.
It is computed using the following:
In the equation above, B represents the number of days in a year based on the annual basis, and DSM represents the number of days in the period starting with the settlement date and ending with the maturity date.
Example¶
In this example, interestRateSecurity
computes the interest rate of a
$7,000 investment with the settlement date of July 1, 1995, and maturity
date of July 1, 2005, using the Actual/365 day count method. The total
amount received at the end of the investment is $10,000.
from __future__ import print_function
from numpy import *
from datetime import date
from pyimsl.math.interestRateSecurity import interestRateSecurity, DAY_CNT_BASIS_ACTUAL365
investment = 7000.
redemption = 10000.
basis = DAY_CNT_BASIS_ACTUAL365
settlement = date(1995, 7, 1)
maturity = date(2005, 7, 1)
intrate = interestRateSecurity(settlement, maturity,
investment, redemption, basis)
print("The interest rate of the bond is %.2f%%." % (intrate * 100))
Output¶
The interest rate of the bond is 4.28%.