How QuantLib Separates Coupon Accrual Dates from Payment Dates
Summary
The document explains why a fixed-rate bond coupon can accrue through an unadjusted schedule date while its cash payment occurs on the next business day. In the example, May 1 is a holiday: the coupon accrual period still ends on May 1, but the cash flow is paid on May 2. The schedule convention governs the accrual dates, while the coupon’s payment-date rules determine when funds are delivered.
It also shows how inspecting the cash flows as coupon objects reveals accrual start, accrual end, payment date, and amount separately. The example demonstrates the distinction in QuantLib, but does not explore how to configure payment-date conventions or whether a particular business-day rule is appropriate for a given bond. Users should check both accrual and payment dates when validating generated cash flows.
Key ideas
- An unadjusted schedule can retain a holiday as a coupon accrual boundary.
- A coupon’s payment date can move to the next business day even when its accrual end date does not.
- Inspect coupon objects to distinguish accrual start, accrual end, payment date, and amount.
- Schedule dates alone do not establish when a coupon will be paid.
Tags
Full text
# QuantLib FixedRateLeg cashflow date shifting issue with Unadjusted convention
# QuantLib FixedRateLeg cashflow date shifting issue with Unadjusted convention
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.
## Answer by Luigi Ballabio (score 2)
https://quant.stackexchange.com/a/75354
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
```Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.