Skip to content
Open Trading edited this page Feb 22, 2016 · 4 revisions

TALIB

We recommend that you install the Cython version of ta-lib: ta-lib

Function API Examples

Similar to TA-Lib, the function interface provides a lightweight wrapper of the exposed TA-Lib indicators.

Each function returns an output array and have default values for their parameters, unless specified as keyword arguments. Typically, these functions will have an initial "lookback" period (a required number of observations before an output is generated) set to ``NaN``.

All of the following examples use the function API:

import numpy
import talib

close = numpy.random.random(100)

Calculate a simple moving average of the close prices:

output = talib.SMA(close)

Calculating bollinger bands, with triple exponential moving average:

from talib import MA_Type

upper, middle, lower = talib.BBANDS(close, matype=MA_Type.T3)

Calculating momentum of the close prices, with a time period of 5:

output = talib.MOM(close, timeperiod=5)

Documentation for all functions:


Parent: Components

Clone this wiki locally