Indicator Aliases

Different people like different conventions when it comes to the naming of things: some people like names in lowercase, some with initial capitalization or all caps, or even long names.

That is why the indicators in the library have aliases which can be used to instantiate them.

Getting the aliases

Getting the aliases of each indicator can be done for example via the built-in docstring .

For the well-known sma

import btalib

print(btalib.sma.__doc__)

With the following output (focusing on the aliases section)

    Aliases: SMA

And it can also be done using the class attribute alias

import btalib

print(btalib.sma.alias)

which outputs

('SMA', 'SimpleMovingAverage')

Using the aliases is as easy as using the original, just use the aliased name. For example:

import btalib

# load the input into a dataframe named `df`

sma = btalib.SimpleMovingAverage(df, period=20)