tensortrade.features.indicators.simple_moving_average module

class tensortrade.features.indicators.simple_moving_average.SimpleMovingAverage(columns=None, window_size=20, inplace=True, **kwargs)[source]

Bases: tensortrade.features.feature_transformer.FeatureTransformer

A transformer to add the simple moving average of a column to a feature pipeline.

__init__(columns=None, window_size=20, inplace=True, **kwargs)[source]
Parameters
  • columns (optional) – A list of column names to normalize.

  • window_size (optional) – The length of the moving average window. Defaults to 20.

  • inplace (optional) – If False, a new column will be added to the output for each input column.

transform(X, input_space)[source]

Transform the data set and return a new data frame.

Parameters
  • X (DataFrame) – The set of data to transform.

  • input_space (Space) – A gym.Space matching the shape of the pipeline’s input.

Return type

DataFrame

Returns

A transformed data frame.