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.



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)
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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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