top of page
Trading-Logo.png

API at a glance

The tti.indicators package implements 62 Trading Technical indicators. The constructor for each indicator is like the one below:

<indicator_object>(input_data, **kwargs, fill_missing_values=True)

input_data (pandas.DataFrame): Index is of DateTimeIndex type, and contains some or all of the following columns, depending the indicator (high, low, open, close, volume)

fill_missing_values (bool)If set to True, missing values in the input data are being filled.

**kwargs (args or None): Additional input arguments which required for some indicators.

An example of a valid input_data pandas.DataFrame is the one below:

date         open     high     low      close    volume

2012-09-12   140.92   141.28   140.14   140.41   488800

2012-09-11   142.57   142.57   140.53   140.95   443500

2012-09-10   143.27   144.08   141.22   141.25   1000800

2012-09-07   144      144.92   143.81   144.36   340100

...          ...      ...      ...      ...      ...

Each indicator provides an implementation for the below methods:

getTiData(): Returns a pandas.DataFrame object with the calculated indicator.

getTiValue(date=None): Returns a list(numeric) with the indicator values of the given date. If date is None, then the latest values are being returned.

getTiSignal(): Returns a tuple (string, integer), the Trading signal for the calculated indicator. Possible values are ('hold', 0), ('buy', -1), ('sell', 1). 

getTiGraph(): Returns a matplotlib.pyplot object with a graph, customized for each indicator.

getTiSimulation(close_values, max_exposure=None, short_exposure_factor=1.5): Returns a pandas.DataFrame, a dictionary object and a matplotlib.pyplot graph with details about the executed simulation.

bottom of page