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

  • $\begingroup$ @haginile I kindly request your help in this question as you provided the document against which I am comparing the Accrued Interest. $\endgroup$
    – Jojo
    Commented Aug 5, 2015 at 15:38

1 Answer 1


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$.

  • $\begingroup$ Thank you once again. One thing I'm unsure of is how to set the settlement dates for each coupon payment. I've previously assumed its just 1 day after the coupon payment is due. And hence, if I were to have a 30 year to maturity bond, then the formula would be : $accrued interest = accrued interest from last period + (1/coupon period × coupon/2)$. Is this correct? $\endgroup$
    – Jojo
    Commented Aug 5, 2015 at 16:21
  • $\begingroup$ @Jojo There should be one settlement for all cash flows. If the pricing date is today, the settlement date is just the next business day after the pricing date. $\endgroup$
    – Helin
    Commented Aug 5, 2015 at 16:26
  • $\begingroup$ Thanks. So, if there is a bond with 12 months to maturity and it has settlement date 8/6/2015 and has the same description as you described in you answer, and a coupon date on 7/31/2016, would the Accrued Interest for this bond be $0.054347826 + 4/184×5/2$? I'm sort of confused how to calculate the Accrued Interest for the next period. $\endgroup$
    – Jojo
    Commented Aug 5, 2015 at 16:34
  • 1
    $\begingroup$ @Jojo, sorry i'm quite confused... there's one accrued interest for each bond and for each settlement date. 0.054 IS the accrued interest. Why are you adding the other term? $\endgroup$
    – Helin
    Commented Aug 5, 2015 at 16:40
  • $\begingroup$ Thank You. I have further questions about this calculation and have asked a separate question here to try and address these. $\endgroup$
    – Jojo
    Commented Aug 5, 2015 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.