Schedule#

The rateslib.scheduling module generates common financial instrument schedules. Scheduling is a surprisingly complex issue, especially when one wants to infer some necessary parameters from the given information.

The Schedule object has an original set of available input types, used since the initial version of rateslib and a core set of available input types which more closely align with the Rust re-implementation after version 2.0. These can be intermixed, but for demonstration purposes this page uses core inputs.

The original inputs allow for a more UI friendly input for the most common schedules.

In [1]: s = Schedule(
   ...:     dt(2000, 1, 15),
   ...:     dt(2001, 1, 1),
   ...:     "Q",
   ...:     stub="ShortFront",
   ...:     modifier="MF",
   ...:     payment_lag=2,
   ...:     calendar="tgt",
   ...: )
   ...: 

In [2]: print(s)
freq: 3M (roll: 1), accrual adjuster: MF, payment adjuster: 2B,
    Period Unadj Acc Start Unadj Acc End  Acc Start    Acc End    Payment
0     Stub      2000-01-15    2000-04-01 2000-01-17 2000-04-03 2000-04-05
1  Regular      2000-04-01    2000-07-01 2000-04-03 2000-07-03 2000-07-05
2  Regular      2000-07-01    2000-10-01 2000-07-03 2000-10-02 2000-10-04
3  Regular      2000-10-01    2001-01-01 2000-10-02 2001-01-02 2001-01-04

Summary#

Classes#

rateslib.scheduling.Schedule(effective, ...)

Generate a schedule of dates according to a regular pattern and calendar inference.

rateslib.scheduling.Frequency(args)

Enumerable type for a scheduling frequency.

rateslib.scheduling.RollDay(args)

Enumerable type for roll days.

rateslib.scheduling.Adjuster(args)

Enumerable type for date adjustment rules.

rateslib.scheduling.StubInference(item)

Enumerable type for Schedule stub inference.

Scheduling Examples#

The following scheduling patterns are possible to construct in rateslib.

  • A regular schedule, which does not contain any stub periods.

  • Irregular schedules, which consist of the following:

    • A single stub period, be it a short or long stub.

    • Two stub periods, combining any short and long varieties.

    • A front stub and a regular schedule.

    • A regular schedule and a back stub.

    • A front stub and a regular schedule and a back stub.

The below tabs give an example of each construction type. To minimise the complexity of these examples all dates are given in their unadjusted form, which is how they should be given to avoid any inference.

The unadjusted effective and termination dates perfectly divide the frequency. In this instance any stub inference parameter is unused.

In [5]: s = Schedule(
   ...:     dt(2000, 1, 1),
   ...:     dt(2001, 1, 1),
   ...:     Frequency.Months(3, RollDay.Day(1)),
   ...:     stub=StubInference.ShortFront,
   ...: )
   ...: 

In [6]: print(s)
freq: 3M (roll: 1), accrual adjuster: MF, payment adjuster: 2B,
    Period Unadj Acc Start Unadj Acc End  Acc Start    Acc End    Payment
0  Regular      2000-01-01    2000-04-01 2000-01-01 2000-04-01 2000-04-03
1  Regular      2000-04-01    2000-07-01 2000-04-01 2000-07-01 2000-07-03
2  Regular      2000-07-01    2000-10-01 2000-07-01 2000-10-01 2000-10-03
3  Regular      2000-10-01    2001-01-01 2000-10-01 2001-01-01 2001-01-03

Construction elements#

A Schedule in rateslib is characterised by three major attributes:

  • its uschedule which is a list of unadjusted dates defining its unambiguous skeletal structure.

  • its aschedule which applies the modifier as an accrual Adjuster to adjust the unadjusted dates into adjusted accrual dates for defining its accrual periods.

  • its pschedule which applies the payment_lag as a secondary Adjuster to adjust each accrual date to determine a physical payment, or cashflow settlement, date.Adjuster

All of the input arguments to a Schedule fit into the logic for yielding these three components.