tsa.block_staircase#

mainsource.block_staircase(name, from_value_date=None, to_value_date=None, revision_freq=None, revision_time=None, revision_tz='UTC', maturity_offset=None, maturity_time=None, revision_date=None, keepnans=False)#

Staircase a series by block

This is a more sophisticated and controllable version of the staircase method.

Computes a series rebuilt from successive blocks of history, each linked to a distinct revision date. The revision dates are taken at regular time intervals determined by revision_freq, revision_time and revision_tz. The time lag between revision dates and value dates of each block is determined by maturity_offset and maturity_time.

name: str unique identifier of the series

from_value_date: pandas.Timestamp from which values are retrieved

to_value_date: pandas.Timestamp to which values are retrieved

revision_freq: dict giving revision frequency, of which keys must be taken from

[‘years’, ‘months’, ‘weeks’, ‘bdays’, ‘days’, ‘hours’, ‘minutes’, ‘seconds’] and values as integers. Default is daily frequency, i.e. {‘days’: 1}

revision_time: dict giving revision time, of which keys should be taken from

[‘year’, ‘month’, ‘day’, ‘weekday’, ‘hour’, ‘minute’, ‘second’] and values must be integers. It is only used for revision date initialisation. The next revision dates are then obtained by successively adding revision_freq. Default is {‘hour’: 0}

revision_tz: str giving time zone in which revision date and time are expressed.

Default is ‘UTC’

maturity_offset: dict giving time lag between each revision date and start time

of related block values. Its keys must be taken from [‘years’, ‘months’, ‘weeks’, ‘bdays’, ‘days’, ‘hours’, ‘minutes’, ‘seconds’] and values as integers. Default is {}, i.e. the revision date is the block start date

maturity_time: dict fixing start time of each block, of which keys should be

taken from [‘year’, ‘month’, ‘day’, ‘weekday’, ‘hour’, ‘minute’, ‘second’] and values must be integers. The start date of each block is thus obtained by adding maturity_offset to revision date and then applying maturity_time. Default is {}, i.e. block start date is just the revision date shifted by maturity_offset

Parameters:
  • from_value_date (datetime | None)

  • to_value_date (datetime | None)

  • revision_freq (Dict[str, int] | None)

  • revision_time (Dict[str, int] | None)

  • revision_tz (str)

  • maturity_offset (Dict[str, int] | None)

  • maturity_time (Dict[str, int] | None)

  • revision_date (datetime | None)

  • keepnans (bool)