tensortrade.pipeline.transformers.lagging module

class tensortrade.pipeline.transformers.lagging.LaggingTransformer(lags: List[int], columns: List[str] | None = None)[source]

Bases: AbstractTransformer

Initialized the lagging transformer.

Parameters:
  • lags (List[int]) – List of lags to be added.

  • columns (Optional[List[str]]) – List of columns to lag. If none, all columns are used.

transform(df: DataFrame) DataFrame[source]

Adds lagged features to the dataframe.

Parameters:

df (DataFrame) – The dataframe to add the lagged features to.

Returns:

The dataframe with the lags.

Return type:

DataFrame