0
$\begingroup$

I'm using the QuantLib library in Python to generate a payment schedule and cashflows for a fixed-rate bond. I added a holiday to the calendar and used the ql.Unadjusted convention in the ql.Schedule() function. However, I noticed that the cashflow dates are shifting to the next business day after the payment dates. For example, the payment date is 1,5,2022, but the corresponding cashflow date is 2,5,2022. But if i am checking schedule its giving correct 1,5,2022. below is the code:

import QuantLib as ql
import pandas as pd


issuedate = ql.Date(1,3,2022)
maturityDate = ql.Date(1,6,2022)
pay_freq = ql.Period(ql.Monthly)
calendar = ql.NullCalendar()
calendar.addHoliday(ql.Date(1,5,2022))
payment_Schedule = ql.Schedule(issuedate,maturityDate,pay_freq,calendar,ql.Unadjusted, ql.Unadjusted, ql.DateGeneration.Forward,False)
rate = [0.05]
daycount = ql.Actual365Fixed()
nominals =[2500000]
cashflows = ql.FixedRateLeg(payment_Schedule,daycount,nominals,rate)
cfs = pd.DataFrame([(a.date(),a.amount()) for a in cashflows])
cfs.columns = ["Date","Amount"]
print('Schedule',list(payment_Schedule))
print(cfs)

which prints Scedule [Date(1,3,2022), Date(1,4,2022), Date(1,5,2022), Date(1,6,2022)] and cfs

              Date        Amount
0  April 1st, 2022  10616.438356
1    May 2nd, 2022  10273.972603
2   June 1st, 2022  10616.438356

Can anyone help me understand why the cashflow dates are shifting to the next business day after the payment dates, even though I'm using the ql.Unadjusted convention and I've added the holiday to the calendar? Is there something I'm missing in my code?

Thank you.

$\endgroup$

1 Answer 1

2
$\begingroup$

The second coupon accrues interest from April 1st to May 1st as you expect, because the convention is unadjusted, but the amount is paid on the next business day.

FixedRateLeg returns the coupons as a list of CashFlow instances, so all they have are the date and amount methods; but if you use the available qk.as_coupon function to downcast them, you can get more information. For instance,

cfs = pd.DataFrame([(a.accrualStartDate(), a.accrualEndDate(), a.date(),a.amount())
                    for a in [ql.as_coupon(c) for c in cashflows]])
cfs.columns = ["Start date", "End date", "Payment date", "Amount"]
print(cfs)

prints out

        Start date         End date     Payment date        Amount
0  March 1st, 2022  April 1st, 2022  April 1st, 2022  10616.438356
1  April 1st, 2022    May 1st, 2022    May 2nd, 2022  10273.972603
2    May 1st, 2022   June 1st, 2022   June 1st, 2022  10616.438356
$\endgroup$

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.