Module indicators

Classes

class IndicatorSet (*indicators: Indicator, streaming: bool = False)

Args:

indicators: Indicators passed as arguments
streaming: Whether to use the streaming capabilities of the indicators or not. (Note that if true, indicators will have the choice to use it or not.) Streaming can improve backtest run time. This parameter is handled in the Backtest object.

Instance variables

var indicators : Dict[str, Indicator]

Get the indicators in the IndicatorSet as a dictionary with the indicator name as the key. IF there are multiple indicators with the same name, the name of the indicator will be appended with a number. Example, if I have two SMA, the first one will be SMA_1, and the second one SMA_2

Returns:

The dictionary of indicators
var out : list[str]

Returns:

The name of the columns added to the chart
var streaming : bool

Returns:

Whether the IndicatorSet is set to use streaming capabilities or not.

Methods

def add(self, indicators: Union[Indicator, List[Indicator]])

Add an indicator or list of indicators to the IndicatorSet.

Args:

indicators: A single indicator or a list of indicators

Returns:

None
def run_all(self, data: pandas.core.frame.DataFrame, previous_data: Optional[pandas.core.frame.DataFrame] = None) ‑> pandas.core.frame.DataFrame

Run all the indicators in the IndicatorSet on the data and return the results as a DataFrame. It concatenates the input data with the results of the indicators. (The index should be a datetime index)

Args:

data: A dataframe containing the previously calculated values of the indicators. (Used when streaming) If streaming is False, this parameter is ignored. This should be a dataframe with the same index as the data. This means that the indicators points that needs to be calculated should be nan, and one already calculated should be the previously calculated values. The columns should be the output columns names of the indicators.

Returns:

The data concatenated with the indicator results
def toList(self) ‑> List[str]

Convert the IndicatorSet to a list of string representations of the indicators.

Returns:

List of string representations of the indicators