price¶
Evaluates the price, per $100 face value, of a security that pays periodic interest.
Synopsis¶
price (settlement, maturity, rate, t_yield, redemption, frequency, 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
rate(Input) - Annual interest rate set forth on the face of the security; the coupon rate.
- float
t_yield(Input) - Annual yield of the security.
- float
redemption(Input) - Redemption value per $100 face value of the security.
- int
frequency(Input) - Frequency of the interest payments. It should be one of
ANNUAL,SEMIANNUALorQUARTERLY. For a more detailed discussion onfrequencysee the Usage Notes section of this chapter. - 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 onbasissee the Usage Notes section of this chapter.
Return Value¶
The price per $100 face value of a security that pays periodic interest. If no result can be computed, NaN is returned.
Description¶
Function price computes the price per $100 face value of a security that
pays periodic interest.It is computed using the following:
In the above equation, DSC represents the number of days in the period starting with the settlement date and ending with the next coupon date. E represents the number of days within the coupon period. N represents the number of coupons payable in the timeframe from the settlement date to the redemption date. A represents the number of days in the timeframe starting with the beginning of coupon period and ending with the settlement date.
Example¶
In this example, price computes the price of a bond that pays coupon
every six months with the settlement of July 1, 1995, the maturity date of
July 1, 2005, a annual rate of 6%, annual yield of 7% and redemption value
of $105 using the US (NASD) 30/360 day count method.
from __future__ import print_function
from numpy import *
from datetime import date
from pyimsl.math.price import price, DAY_CNT_BASIS_ACTUAL365, SEMIANNUAL
rate = .06
yield_amt = .07
redemption = 105.
frequency = SEMIANNUAL
basis = DAY_CNT_BASIS_ACTUAL365
settlement = date(1995, 7, 1)
maturity = date(2005, 7, 1)
price_amt = price(settlement, maturity, rate, yield_amt,
redemption, frequency, basis)
print("The price of the bond is $%.2f." % (price_amt))
Output¶
The price of the bond is $95.41.