Function schedule
pub(crate) fn schedule(
effective: NaiveDate,
termination: NaiveDate,
frequency: Named<Period>,
calendar: &PyCalendar,
business_day_convention: Named<BusinessDayConvention>,
roll_convention: Named<RollConvention>,
stub: &str,
end_of_month: bool,
terminal_business_day_convention: Option<Named<BusinessDayConvention>>,
date_generation: Option<&str>,
first_regular_start: Option<NaiveDate>,
last_regular_end: Option<NaiveDate>,
) -> PyResult<PySchedule>Expand description
Generates a calculation-period schedule.
The same generator every instrument’s accrual schedule is built by, so the boundaries this returns are the boundaries a trade on these terms accrues on.
effective and termination are unadjusted anchors, not the adjusted
boundaries this returns. One of the two is the seed regular boundaries are
measured from and the other is only a boundary, and which is which follows
stub:
| stub | seed | boundary only |
|---|---|---|
"ShortFinal" / "LongFinal" | effective | termination |
"ShortInitial" / "LongInitial" | termination | effective |
Passing an already-adjusted date in place of the seed moves every interior
boundary and raises nothing; in place of the other date it is harmless. Note
that Calendar.advance adjusts, so resolving a tenor with it produces an
adjusted termination — use the free add_period for an unadjusted one.
Holding only adjusted dates, pass the roll that generated them: roll
snaps interior boundaries after generation and so supersedes the seed’s day
of month. An adjusted effective of 2000-01-03 under roll="1" gives the same
dates as the unadjusted 2000-01-01 under roll="None".
first_regular_start and last_regular_end state the stub dates (FpML’s
firstRegularPeriodStartDate / lastRegularPeriodEndDate): the regular
periods run between them, a front stub from effective and a back stub to
termination; state both
for a double stub. Either raises ValueError outside the term or out of
order, and does not combine with date_generation="Cds".
To state boundary dates outright instead of generating them, use
Schedule.from_dates, which applies no calendar, roll or adjustment at all.