BySecurity#

class backtest_lib.market.BySecurity#

Security-axis accessor for a PastView.

Indexing by security name returns a timeseries for that security, while slicing by multiple names returns a new PastView.

abstract property plot: BySecurityPlotAccessor#

Return the plotting accessor for this axis view.

abstractmethod to_dataframe(*, show_periods: bool = True, lazy: Literal[False] = False, backend: Literal['polars'] = 'polars') pl.DataFrame#
abstractmethod to_dataframe(*, show_periods: bool = True, lazy: Literal[True], backend: Literal['polars'] = 'polars') pl.LazyFrame
abstractmethod to_dataframe(*, show_periods: bool = True, lazy: bool = False, backend: Literal['pandas']) pd.DataFrame

Convert the view to a DataFrame.

Parameters:
  • show_periods – Whether to include the period labels as a column.

  • lazy – Whether to return a lazy frame for supported backends.

  • backend – Target DataFrame backend.

Returns:

DataFrame containing per-security series data.