TimeSelection

time.TimeSelection(self, time_frame, selection, grouping, aggregation)

A kind of TimeStrategy describing a sub-selection of a time frame. A selection performs no grouping or aggregation.

Typically you will create one of these by calling methods on a TimeSelector instance.

TimeSelection is a frozen dataclass.

Parameters

time_frame: TimeFrame

The original simulation time frame.

selection: tuple[slice, int | None]

The selected subset of the time frame: described as a date slice and an optional tau step index.

Attributes

time_frame: TimeFrame

The original time frame.

selection: tuple[slice, int | None]

The selected subset of the time frame: described as a date slice and an optional tau step index.

group_format: Literal['tick']

What scale describes the result of the grouping? Are the group keys dates? Simulation ticks? Simulation days? Or some arbitrary other type?

date_bounds: tuple[date, date]

The bounds of the selection, given as the first and last date included.

Methods

Name Description
to_time_frame Creates a TimeFrame that has the same bounds as this TimeStrategy. NOTE: this does not mean the TimeFrame contains the same number of entries (group keys) as the result of applying this strategy – groups can skip days whereas TimeFrames are contiguous.
selection_ticks Converts this into a slice for which ticks are selected (by index).
group Groups the time series using the specified grouping.
agg Aggregates the time series using the specified methods.