Skip to content

State


dataclass backtide.backtest.State

The simulation state passed to a strategy's evaluate method on every tick.

Contains metadata about the current position in the simulation: the UTC timestamp of the bar being processed, the zero-based bar index, the total number of bars in the dataset, and whether the engine is still in the warmup phase (where indicators are computed but no orders are placed).

Attributes

timestamp : int

UTC timestamp of the current bar in seconds since the Unix epoch.

bar_index : int
Zero-based index of the current bar in the dataset.

total_bars : int
Total number of bars in the dataset.

is_warmup : bool
Whether the engine is currently in the warmup phase. During warmup indicators are computed but orders are not executed.

datetime : datetime.datetime
The timestamp as a timezone-aware datetime. Uses the timezone from config.display.timezone. Falls back to the system's local timezone if none is configured.


See Also

ExperimentConfig

Complete configuration for a single backtest experiment.

Order

A trading order submitted during the simulation.

Portfolio

A snapshot of the portfolio's holdings at a point in time.