0
$\begingroup$

I am using the QuantLib library to calculate accruals for a fixed rate leg, using the "Actual/Actual AFB" day count convention. The payment period is annual, and the cash flows occur between July 29, 2023 and July 29, 2024.

When calculating the accruals on January 15, 2024, I expect the denominator to be 366 to account for the leap year, but the library is using 365 instead. This is causing the calculated accruals to be incorrect.

Here's the code I'm using to perform the calculation:

import QuantLib as ql 
facevalue = 1000000 
daycount = ql.ActualActual(ql.ActualActual.AFB)
coupon = 8.95/100
issueDate = ql.Date(29,7,2023)
maturityDate = ql.Date(29,7,2025)
payfreq = ql.Annual
calendar = ql.NullCalendar()

payment_Schedule = ql.Schedule(issueDate,maturityDate,ql.Period(payfreq),calendar, ql.Following, ql.Unadjusted, ql.DateGeneration.Forward,False)

cashflows = ql.FixedRateLeg(payment_Schedule, dayCount=daycount,  nominals=[
                                          facevalue], couponRates=[coupon])
bond = ql.Bond(0, calendar, 100.0,
                    maturityDate, issueDate, cashflows) 
print("Accrued amount",bond.accruedAmount(ql.Date(15,1,2024)))

#which gives following amount```
**Accrued amount 41684.931506849265**

this value is getting calculated using 365 as denominator for year fraction.

is there a different method or approach I should use to calculate accruals in this situation?

Any guidance or advice would be greatly appreciated. Thank you!
$\endgroup$

0

Your Answer

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