Frequency#

class rateslib.scheduling.Frequency(args)#

Bases: object

Enumerable type for a scheduling frequency.

Variants

In [1]: variants
Out[1]: 
['BusDays(int, calendar)',
 'CalDays(int)',
 'Months(int, rollday | None)',
 'Zero()']

Methods Summary

infer_ustub(ueffective, utermination, short, ...)

Infer an unadjusted stub date from given schedule endpoints.

is_stub(ustart, uend, front)

Check whether unadjusted dates define a stub period.

next(date)

Return the next unadjusted date under the schedule frequency.

periods_per_annum()

Return an average number of coupons per annum measured over 50 years.

previous(date)

Return the previous unadjusted date under the schedule frequency.

string()

Return a string representation of the Frequency.

to_json()

Return a JSON representation of the object.

unext(udate)

Return the next unadjusted date under the schedule frequency.

uprevious(udate)

Return the previous unadjusted date under the schedule frequency.

uregular(ueffective, utermination)

Return a list of unadjusted regular schedule dates.

Methods Documentation

infer_ustub(ueffective, utermination, short, front)#

Infer an unadjusted stub date from given schedule endpoints.

Parameters:
  • ueffective (datetime) – The unadjusted effective date of the schedule.

  • utermination (datetime) – The unadjusted termination date of the frequency period. If this is not a valid unadjusted date aligned with the Frequency then it will raise.

  • short (bool) – Whether to infer a short or a long stub.

  • front (bool) – Whether to infer a front or a back stub.

Return type:

datetime or None

Notes

This function will return None if the dates define a regular schedule and no stub is required.

is_stub(ustart, uend, front)#

Check whether unadjusted dates define a stub period.

Parameters:
  • ustart (datetime) – The unadjusted start date of the period.

  • uend (datetime) – The unadjusted end date of the period.

  • front (bool) – Test for either a front or a back stub.

Return type:

bool

next(date)#

Return the next unadjusted date under the schedule frequency.

Parameters:

date (datetime) – Any unchecked date, which may or may not align with the Frequency.

Return type:

datetime

periods_per_annum()#

Return an average number of coupons per annum measured over 50 years.

Return type:

float

previous(date)#

Return the previous unadjusted date under the schedule frequency.

Parameters:

date (datetime) – Any unchecked date, which may or may not align with the Frequency.

Return type:

datetime

string()#

Return a string representation of the Frequency.

Return type:

str

to_json()#

Return a JSON representation of the object.

Return type:

str

unext(udate)#

Return the next unadjusted date under the schedule frequency.

Parameters:

udate (datetime) – The unadjusted start date of the frequency period. If this is not a valid unadjusted date aligned with the Frequency then it will raise.

Return type:

datetime

uprevious(udate)#

Return the previous unadjusted date under the schedule frequency.

Parameters:

udate (datetime) – The unadjusted end date of the frequency period. If this is not a valid unadjusted date aligned with the Frequency then it will raise.

Return type:

datetime

uregular(ueffective, utermination)#

Return a list of unadjusted regular schedule dates.

Parameters:
  • ueffective (datetime) – The unadjusted effective date of the schedule. If this is not a valid unadjusted date aligned with the Frequency then it will raise.

  • utermination (datetime) – The unadjusted termination date of the frequency period. If this is not a valid unadjusted date aligned with the Frequency then it will raise.

Return type:

list[datetime]