TA-Lib学习研究笔记(一)
1.介绍
TA-Lib,英文全称“Technical Analysis Library”,是一个用于金融量化的第三方库,涵盖了150多种交易软件中常用的技术分析指标,如RSI,KDJ,MACD, MACDEXT, MACDFIX, SAR, SAREXT, MA,SMA, T3, TEMA, TRIMA等 。
TA-Lib可分为10个函数组:
- Overlap Studies(重叠研究)
- Momentum Indicators(动量指标)
- Volume Indicators(交易量指标)
- Cycle Indicators(周期指标)
- Price Transform(价格变换)
- Volatility Indicators(波动率指标)
- Pattern Recognition(模式识别)
- Statistic Functions(统计函数)
- Math Transform(数学变换)
- Math Operators(数学运算)
2.指标介绍
每个函数组下都是多个指标,可以查询:
import talib as tlb
print('Version:',tlb.__version__)
print(tlb.get_function_groups())
执行结果如下:
Version: 0.4.18
{‘Cycle Indicators’: [‘HT_DCPERIOD’, ‘HT_DCPHASE’, ‘HT_PHASOR’, ‘HT_SINE’, ‘HT_TRENDMODE’], ‘Math Operators’: [‘ADD’, ‘DIV’, ‘MAX’, ‘MAXINDEX’, ‘MIN’, ‘MININDEX’, ‘MINMAX’, ‘MINMAXINDEX’, ‘MULT’, ‘SUB’, ‘SUM’], ‘Math Transform’: [‘ACOS’, ‘ASIN’, ‘ATAN’, ‘CEIL’, ‘COS’, ‘COSH’, ‘EXP’, ‘FLOOR’, ‘LN’, ‘LOG10’, ‘SIN’, ‘SINH’, ‘SQRT’, ‘TAN’, ‘TANH’], ‘Momentum Indicators’: [‘ADX’, ‘ADXR’, ‘APO’, ‘AROON’, ‘AROONOSC’, ‘BOP’, ‘CCI’, ‘CMO’, ‘DX’, ‘MACD’, ‘MACDEXT’, ‘MACDFIX’, ‘MFI’, ‘MINUS_DI’, ‘MINUS_DM’, ‘MOM’, ‘PLUS_DI’, ‘PLUS_DM’, ‘PPO’, ‘ROC’, ‘ROCP’, ‘ROCR’, ‘ROCR100’, ‘RSI’, ‘STOCH’, ‘STOCHF’, ‘STOCHRSI’, ‘TRIX’, ‘ULTOSC’, ‘WILLR’], ‘Overlap Studies’: [‘BBANDS’, ‘DEMA’, ‘EMA’, ‘HT_TRENDLINE’, ‘KAMA’, ‘MA’, ‘MAMA’, ‘MAVP’, ‘MIDPOINT’, ‘MIDPRICE’, ‘SAR’, ‘SAREXT’, ‘SMA’, ‘T3’, ‘TEMA’, ‘TRIMA’, ‘WMA’], ‘Pattern Recognition’: [‘CDL2CROWS’, ‘CDL3BLACKCROWS’, ‘CDL3INSIDE’, ‘CDL3LINESTRIKE’, ‘CDL3OUTSIDE’, ‘CDL3STARSINSOUTH’, ‘CDL3WHITESOLDIERS’, ‘CDLABANDONEDBABY’, ‘CDLADVANCEBLOCK’, ‘CDLBELTHOLD’, ‘CDLBREAKAWAY’, ‘CDLCLOSINGMARUBOZU’, ‘CDLCONCEALBABYSWALL’, ‘CDLCOUNTERATTACK’, ‘CDLDARKCLOUDCOVER’, ‘CDLDOJI’, ‘CDLDOJISTAR’, ‘CDLDRAGONFLYDOJI’, ‘CDLENGULFING’, ‘CDLEVENINGDOJISTAR’, ‘CDLEVENINGSTAR’, ‘CDLGAPSIDESIDEWHITE’, ‘CDLGRAVESTONEDOJI’, ‘CDLHAMMER’, ‘CDLHANGINGMAN’, ‘CDLHARAMI’, ‘CDLHARAMICROSS’, ‘CDLHIGHWAVE’, ‘CDLHIKKAKE’, ‘CDLHIKKAKEMOD’, ‘CDLHOMINGPIGEON’, ‘CDLIDENTICAL3CROWS’, ‘CDLINNECK’, ‘CDLINVERTEDHAMMER’, ‘CDLKICKING’, ‘CDLKICKINGBYLENGTH’, ‘CDLLADDERBOTTOM’, ‘CDLLONGLEGGEDDOJI’, ‘CDLLONGLINE’, ‘CDLMARUBOZU’, ‘CDLMATCHINGLOW’, ‘CDLMATHOLD’, ‘CDLMORNINGDOJISTAR’, ‘CDLMORNINGSTAR’, ‘CDLONNECK’, ‘CDLPIERCING’, ‘CDLRICKSHAWMAN’, ‘CDLRISEFALL3METHODS’, ‘CDLSEPARATINGLINES’, ‘CDLSHOOTINGSTAR’, ‘CDLSHORTLINE’, ‘CDLSPINNINGTOP’, ‘CDLSTALLEDPATTERN’, ‘CDLSTICKSANDWICH’, ‘CDLTAKURI’, ‘CDLTASUKIGAP’, ‘CDLTHRUSTING’, ‘CDLTRISTAR’, ‘CDLUNIQUE3RIVER’, ‘CDLUPSIDEGAP2CROWS’, ‘CDLXSIDEGAP3METHODS’], ‘Price Transform’: [‘AVGPRICE’, ‘MEDPRICE’, ‘TYPPRICE’, ‘WCLPRICE’], ‘Statistic Functions’: [‘BETA’, ‘CORREL’, ‘LINEARREG’, ‘LINEARREG_ANGLE’, ‘LINEARREG_INTERCEPT’, ‘LINEARREG_SLOPE’, ‘STDDEV’, ‘TSF’, ‘VAR’], ‘Volatility Indicators’: [‘ATR’, ‘NATR’, ‘TRANGE’], ‘Volume Indicators’: [‘AD’, ‘ADOSC’, ‘OBV’]}
3.关于版本
官网地址
可以看到3周前还在更新,当前最新的版本是0.4.29 。
测试的是用的0.4.18 ,未升级到最新版本。