Skip to content
All library documents

Creating Two Stub Periods in a QuantLib Schedule

Article Quant Q&A · Author: AnonymousJ

Summary

The document addresses how to build a vanilla swap schedule with both a front stub and a back stub, each of which may be short or long. It explains that a single forward or backward date-generation rule does not need to encode both stub choices. Instead, the suggested approach is to provide the dates that define the stubs explicitly: `firstDate` for the first coupon boundary and `nextToLastDate` for the last interior boundary, alongside the effective date, termination date, and payment frequency.

A Python QuantLib example constructs a schedule this way and lists the resulting accrual periods, showing the two end periods around regular six-month intervals. This illustrates the mechanics, but the text does not discuss calendar adjustments, business-day conventions, end-of-month rules, or how to choose stub dates for a particular contract. Those details still need to match the swap terms.

Key ideas

  • A schedule can represent front and back stubs by explicitly supplying their boundary dates.
  • Use `firstDate` and `nextToLastDate` to define the first and final interior coupon boundaries.
  • The schedule still takes the effective date, termination date, and payment frequency.
  • The example demonstrates date generation but leaves contractual calendar and business-day choices unspecified.

Tags

Full text
# Which object in DateGeneration object when there are two short, long or combination in Schedule object for py QuantLib?


# Which object in DateGeneration object when there are two short, long or combination in Schedule object for py QuantLib?












I'm pricing a vanilla swap. I have two stubs, front and back, and they can be short, long or a combination. In this case, what do I use in `ql.Schedule` object for `Rule` parameter? I use `ql.DateGeneration.Forward`, but I wasn't sure for two stubs. In the QuantLib for python under Schedule Class, I didn't see for two stubs.

Thanks.

## Answer by David Duarte (score 2, accepted)

https://quant.stackexchange.com/a/54241

One possibility would be to explicitly define your stubs with the firstDate and nextToLastDate.

```
effectiveDate = ql.Date(27,6,2020)
firstDate = ql.Date(15,12,2020)
nextToLastDate=ql.Date(15,12,2021)
terminationDate = ql.Date(2,6,2022)
frequency = ql.Period('6M')

schedule = ql.MakeSchedule(
    effectiveDate, terminationDate, frequency,
    firstDate=firstDate, nextToLastDate=nextToLastDate
)

dates = list(schedule)
for start, end in zip(dates[:-1], dates[1:]):
    print(f"{start.ISO()}, {end.ISO()}, {end-start} days")
```

2020-06-27, 2020-12-15, 171 days 2020-12-15, 2021-06-15, 182 dyas 2021-06-15, 2021-12-15, 183 days 2021-12-15, 2022-06-02, 169 days

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.