原文地址: TA-LIB document
翻譯地址:https://github.com/HuaRongSAO/talib-document
Function API Examples
Similar to TA-Lib, the function interface provides a lightweight wrapper of
the exposed TA-Lib indicators.
類似于TA庫,對函數接口進行了一個輕量級的封裝,用于公開的ta-lib的指標。
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
.
每個函數都默認需要輸入數組,并為它們提供默認值。 參數,除非指定為關鍵字參數。通常,這些函數 會有一個初步的“lookback”時期(觀測所需數量 在生成一個輸出之前),設置為“NaN”。
All of the following examples use the function API:
所有的API函數的使用,都需引入庫文件:
import numpy
import talib
close = numpy.random.random(100)
計算收盤價的一個簡單移動平均數SMA:
output = talib.SMA(close)
計算布林線,三指數移動平均:
from talib import MA_Type
upper, middle, lower = talib.BBANDS(close, matype=MA_Type.T3)
計算收盤價的動量,時間為5:
output = talib.MOM(close, timeperiod=5)
方法類型分組: