I am trying to calculate the accrued interest for a set of Treasury Bonds. I am comparing the answer from the code below with that for the 1st Bond(row) over here. In the link the AI is 0.061
whereas from the Python code I get 0.125
and am therefore trying to understand where I'm going wrong. I use the formula for AI available here.
#l contains the months to maturity
accrued_interest = 0
d_ordered = {}
l = [0]*59 # My set of Bonds (not included here) includes a 30 year to maturity Semi-Annual coupon bearing bond and hence l will have 59 periods
l[0] = 3 # I have a function (not included here) which calculates the difference in months between each of the coupon payments (and the settlement date and first coupon payment)
d_ordered[0] = l
coupon = 0.250
days_in_coupon_period = 180 #The Link contains half-yearly bonds
for i in range(0,1,1):
months_to_maturity_array = numpy.array(d_ordered[i])
for k in range(0,59,1):
# Adding the AI associated with each period k
accrued_interest = accrued_interest + ((coupon) * ((30*months_to_maturity_array[k]) /days_in_coupon_period))
print('AI', accrued_interest)
Thank You
Answer
US Treasuries follow the Actual/Actual day count convention, so you can't make the assumption that there are 180 days in a coupon period.
Let's assume that the settlement date (T + 1 for US Treasuries) is 8/6/2015, the previous coupon date for a bond is 7/31/2015, and the next coupon date is 1/31/2016. Then the number of days in the coupon period is 184 days, and the accrual period is 4 days. The accrued interest, assuming a 5% coupon rate, must be $4/184 \times 5/2 = 0.054347826$.
No comments:
Post a Comment