Pay Dates - Python Implementation
The following code generates a set of dates following the specified convention. (Note, it incorporates date rolling)
import QuantLib as ql
today = ql.Date(19, 6, 2026)
ql.Settings.instance().evaluationDate = today
# 2. Define the schedule
effective_date = ql.Date(1, 1, 2026)
termination_date = ql.Date(1, 1, 2031)
calendar = ql.UnitedStates(ql.UnitedStates.Settlement)
convention = ql.ModifiedFollowing
schedule = ql.Schedule(
effective_date, termination_date,
ql.Period(ql.Semiannual), calendar,
convention, convention,
ql.DateGeneration.Backward, False
)
for date in schedule:
iso_string = date.ISO() # Returns '2026-06-19'
print(iso_string)