知行迭代
导航
首页
最近更改
随机页面
常用
分类目录
Linux命令
Mediawiki常用
电脑技巧
工具
链入页面
相关更改
特殊页面
页面信息
登录
查看“TA-Lib”的源代码
←
TA-Lib
页面
讨论
阅读
查看源代码
查看历史
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:[
[1]
]
您可以查看和复制此页面的源代码。
TA-Lib(Technical Analysis Library)是一个多平台的[[技术分析]]库,多种编程语言的开源API,包括[[C]]/[[C++]]、[[Java]]、[[Perl]]、[[Python]]版等。包含200多个技术指标,如[[ADX]]、[[MACD]]、[[RSI]]、[[布林带]]等,还支持烛台模式识别。Ta-Lib使用[[BSD]]许可,允许将它集成到您自己的开源或商业应用程序中。 TA-Lib的Python版本是使用 [[SWIG]] 封装C/C++版本的API,难安装,速度稍慢。开源项目[https://github.com/mrjbq7/ta-lib mrjbq7/ta-lib]使用[[Cython]]和[[Numpy]]封装TA-Lib的C/C++版,速度比TA-Lib的Python版快,所以在Python中一般使用该版本。 ==简介== ===时间轴=== ===安装=== ====使用pip安装==== [https://github.com/mrjbq7/ta-lib mrjbq7/ta-lib]有发布在[[PyPI]]上,可以使用[[pip]]安装: pip install TA-Lib {{了解更多 |[http://mrjbq7.github.io/ta-lib/install.html mrjbq7/ta-lib:安装] }} ====故障排除==== {{了解更多 |[https://github.com/mrjbq7/ta-lib#troubleshooting mrjbq7/ta-lib:故障排除] }} ==函数== ===Overlap Studies 重叠指标=== {| class="wikitable sortable" style="width: 100%; ! 函数名 ! 描述 ! 代码 |- | '''[[MA]]'''</code> <br \>Moving average | 移动平均线<br \>按照计算方法可分多种,一般指简单移动平均(SMA)。<br \> 参数:<br \>matype:默认0(简单移动平均),0=SMA,1=EMA,2=WMA,3=DEMA,4=TEMA,5=TRIMA,6=KAMA,7=MAMA,8=T3 | MA(close, timeperiod=30, matype=0) |- | '''SMA''' <br \>Simple Moving Average | 简单移动平均 | SMA(close, timeperiod=30) |- | '''[[EMA]]''' <br \>Exponential Moving Average | 指数移动平均<br \>是以指数式递减加权的移动平均。 | EMA(close, timeperiod=30) |- | '''WMA''' <br \>Weighted Moving Average | |WMA(close, timeperiod=30) |- | '''DEMA'''<br \>Double Exponential Moving Average | | DEMA(close, timeperiod=30) |- | '''TEMA''' <br \>Triple Exponential Moving Average | | TEMA(close, timeperiod=30) |- | '''TRIMA''' <br \>Triangular Moving Average | | TRIMA(close, timeperiod=30) |- | '''KAMA'''<br \>Kaufman Adaptive Moving Average | | KAMA(close, timeperiod=30) |- | '''MAMA'''<br \>MESA Adaptive Moving Average | | mama, fama = MAMA(close, fastlimit=0, slowlimit=0) |- | '''T3'''<br \>Triple Exponential Moving Average (T3) | | T3(close, timeperiod=5, vfactor=0) |- | '''BBANDS'''<br \>Bollinger Bands | | upperband, middleband, lowerband = BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0) |- | '''HT_TRENDLINE'''<br \>Hilbert Transform | | HT_TRENDLINE(close) |- | '''MAVP'''<br \>Moving average with variable period | | MAVP(close, periods, minperiod=2, maxperiod=30, matype=0) |- | '''MIDPOINT'''<br \>MidPoint over period | | MIDPOINT(close, timeperiod=14) |- | '''MIDPRICE'''<br \>Midpoint Price over period | | MIDPRICE(high, low, timeperiod=14) |- | '''[[SAR]]'''<br \>Parabolic SAR | | SAR(high, low, acceleration=0, maximum=0) |- | '''SAREXT'''<br \>Parabolic SAR | | SAREXT(high, low, startvalue=0, offsetonreverse=0, accelerationinitlong=0, accelerationlong=0, accelerationmaxlong=0, accelerationinitshort=0, accelerationshort=0, accelerationmaxshort=0) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/overlap_studies.html mrjbq7/ta-lib 文档:Overlap Studies] |[https://github.com/mrjbq7/ta-lib/blob/master/talib/_common.pxi mrjbq7/ta-lib GitHub: ta-lib/talib/_common.pxi]}} === Momentum Indicator 动量指标 === {| class="wikitable sortable" style="width: 100%;" ! 函数名 ! 描述 ! 代码 |- | '''ADX'''<br />Average Directional Movement Index | | ADX(high, low, close, timeperiod=14) |- | '''ADXR'''<br />Average Directional Movement Index Rating | | ADXR(high, low, close, timeperiod=14) |- | '''APO'''<br />Absolute Price Oscillator | | APO(close, fastperiod=12, slowperiod=26, matype=0) |- | '''AROON'''<br />Aroon | | oondown, aroonup = AROON(high, low, timeperiod=14) |- | '''AROONOSC'''<br />Aroon Oscillator | | AROONOSC(high, low, timeperiod=14) |- | '''BOP'''<br />Balance Of Power | | BOP(open, high, low, close) |- | '''CCI'''<br />Commodity Channel Index | | CCI(high, low, close, timeperiod=14) |- | '''CMO'''<br />Chande Momentum Oscillator | | CMO(close, timeperiod=14) |- | '''DX'''<br />Directional Movement Index | | DX(high, low, close, timeperiod=14) |- | '''MACD'''<br />Moving Average Convergence/Divergence | | macd, macdsignal, macdhist = MACD(close, fastperiod=12, slowperiod=26, signalperiod=9) |- | '''MACDEXT'''<br />MACD with controllable MA type | | macd, macdsignal, macdhist = MACDEXT(close, fastperiod=12, fastmatype=0, slowperiod=26, slowmatype=0, signalperiod=9, signalmatype=0) |- | '''MACDFIX'''<br />Moving Average Convergence/Divergence Fix 12/26 | | macd, macdsignal, macdhist = MACDFIX(close, signalperiod=9) |- | '''MFI'''<br />Money Flow Index | | MFI(high, low, close, volume, timeperiod=14) |- | '''MINUS_DI'''<br />Minus Directional Indicator | | MINUS_DI(high, low, close, timeperiod=14) |- | '''MINUS_DM'''<br />Minus Directional Movement | | MINUS_DM(high, low, timeperiod=14) |- | '''MOM'''<br />Momentum | | MOM(close, timeperiod=10) |- | '''PLUS_DI'''<br />Plus Directional Indicator | | PLUS_DI(high, low, close, timeperiod=14) |- | '''PLUS_DM'''<br />Plus Directional Movement | | PLUS_DM(high, low, timeperiod=14) |- | '''PPO'''<br />Percentage Price Oscillator | | PPO(close, fastperiod=12, slowperiod=26, matype=0) |- | '''ROC'''<br />Rate of change : ((price/prevPrice) | | ROC(close, timeperiod=10) |- | '''ROCP'''<br />Rate of change Percentage: (price | | ROCP(close, timeperiod=10) |- | '''ROCR'''<br />Rate of change ratio: (price/prevPrice) | | ROCR(close, timeperiod=10) |- | '''ROCR100'''<br />Rate of change ratio 100 scale: (price/prevPrice)*100 | | ROCR100(close, timeperiod=10) |- | '''RSI'''<br />Relative Strength Index | | RSI(close, timeperiod=14) |- | '''STOCH'''<br />Stochastic | | slowk, slowd = STOCH(high, low, close, fastk_period=5, slowk_period=3, slowk_matype=0, slowd_period=3, slowd_matype=0) |- | '''STOCHF'''<br />Stochastic Fast | | fastk, fastd = STOCHF(high, low, close, fastk_period=5, fastd_period=3, fastd_matype=0) |- | '''STOCHRSI'''<br />Stochastic Relative Strength Index | | fastk, fastd = STOCHRSI(close, timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=0) |- | '''TRIX'''<br />1-day Rate-Of-Change (ROC) of a Triple Smooth EMA | | TRIX(close, timeperiod=30) |- | '''ULTOSC'''<br />Ultimate Oscillator | | ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28) |- | '''WILLR'''<br />Williams' %R | | WILLR(high, low, close, timeperiod=14) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/momentum_indicators.html mrjbq7/ta-lib 文档:Momentum Indicator Functions]}} ===Volume Indicators=== {| class="wikitable sortable" style="width: 100%; !函数名 !描述 !代码 |- | '''AD'''<br />Chaikin A/D Line | | AD(high, low, close, volume) |- | '''ADOSC'''<br />Chaikin A/D Oscillator | | ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10) |- | '''OBV'''<br />On Balance Volume | | OBV(close, volume) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/volume_indicators.html mrjbq7/ta-lib 文档:Volume Indicators]}} ===Volatility Indicators=== {| class="wikitable sortable" style="width: 100%; !函数名 !描述 !代码 |- | '''ATR'''<br />Average True Range | | ATR(high, low, close, timeperiod=14) |- | '''NATR'''<br />Normalized Average True Range | | NATR(high, low, close, timeperiod=14) |- | '''TRANGE'''<br />True Range | | TRANGE(high, low, close) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/volatility_indicators.html mrjbq7/ta-lib 文档:Volatility Indicators]}} ===Price Transform=== {| class="wikitable sortable" style="width: 100%; !函数名 !描述 !代码 |- | '''AVGPRICE'''<br />Average Price | | AVGPRICE(open, high, low, close) |- | '''MEDPRICE'''<br />Median Price | | MEDPRICE(high, low) |- | '''TYPPRICE'''<br />Typical Price | | TYPPRICE(high, low, close) |- | '''WCLPRICE'''<br />Weighted Close Price | | WCLPRICE(high, low, close) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/price_transform.html mrjbq7/ta-lib 文档:Price Transform]}} ===Cycle Indicators=== {| class="wikitable sortable" style="width: 100%; !函数名 !描述 !代码 |- | '''HT_DCPERIOD'''<br />Hilbert Transform - Dominant Cycle Period | | HT_DCPERIOD(close) |- | '''HT_DCPHASE'''<br />Hilbert Transform - Dominant Cycle Phase | | HT_DCPHASE(close) |- | '''HT_PHASOR'''<br />Hilbert Transform - Phasor Components | | inphase, quadrature = HT_PHASOR(close) |- | '''HT_SINE'''<br />Hilbert Transform - SineWave | | sine, leadsine = HT_SINE(close) |- | '''HT_TRENDMODE'''<br />Hilbert Transform - Trend vs Cycle Mode | |HT_TRENDMODE(close) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/cycle_indicators.html mrjbq7/ta-lib 文档:Cycle Indicators]}} ===Pattern Recognition=== {| class="wikitable sortable" style="width: 100%; !函数名 !描述 !代码 |- | '''CDL2CROWS'''<br />Two Crows | |CDL2CROWS(open, high, low, close) |- | '''CDL3BLACKCROWS'''<br />Three Black Crows | |CDL3BLACKCROWS(open, high, low, close) |- | '''CDL3INSIDE'''<br />Three Inside Up/Down | |CDL3INSIDE(open, high, low, close) |- | '''CDL3LINESTRIKE'''<br />Three-Line Strike | |CDL3LINESTRIKE(open, high, low, close) |- | '''CDL3OUTSIDE'''<br />Three Outside Up/Down | |CDL3OUTSIDE(open, high, low, close) |- | '''CDL3STARSINSOUTH'''<br />Three Stars In The South | |CDL3STARSINSOUTH(open, high, low, close) |- | '''CDL3WHITESOLDIERS'''<br />Three Advancing White Soldiers | |CDL3WHITESOLDIERS(open, high, low, close) |- | '''CDLABANDONEDBABY'''<br />Abandoned Baby | |CDLABANDONEDBABY(open, high, low, close, penetration=0) |- | '''CDLADVANCEBLOCK'''<br />Advance Block | |CDLADVANCEBLOCK(open, high, low, close) |- | '''CDLBELTHOLD'''<br />Belt-hold | |CDLBELTHOLD(open, high, low, close) |- | '''CDLBREAKAWAY'''<br />Breakaway | |CDLBREAKAWAY(open, high, low, close) |- | '''CDLCLOSINGMARUBOZU'''<br />Closing Marubozu | |CDLCLOSINGMARUBOZU(open, high, low, close) |- | '''CDLCONCEALBABYSWALL'''<br />Concealing Baby Swallow | |CDLCONCEALBABYSWALL(open, high, low, close) |- | '''CDLCOUNTERATTACK'''<br />Counterattack | |CDLCOUNTERATTACK(open, high, low, close) |- | '''CDLDARKCLOUDCOVER'''<br />Dark Cloud Cover | |CDLDARKCLOUDCOVER(open, high, low, close, penetration=0) |- | '''CDLDOJI'''<br />Doji | |CDLDOJI(open, high, low, close) |- | '''CDLDOJISTAR'''<br />Doji Star | |CDLDOJISTAR(open, high, low, close) |- | '''CDLDRAGONFLYDOJI'''<br />Dragonfly Doji | |CDLDRAGONFLYDOJI(open, high, low, close) |- | '''CDLENGULFING'''<br />Engulfing Pattern | |CDLENGULFING(open, high, low, close) |- | '''CDLEVENINGDOJISTAR'''<br />Evening Doji Star | |CDLEVENINGDOJISTAR(open, high, low, close, penetration=0) |- | '''CDLEVENINGSTAR'''<br />Evening Star | |CDLEVENINGSTAR(open, high, low, close, penetration=0) |- | '''CDLGAPSIDESIDEWHITE'''<br />Up/Down-gap side-by-side white lines | |CDLGAPSIDESIDEWHITE(open, high, low, close) |- | '''CDLGRAVESTONEDOJI'''<br />Gravestone Doji | |CDLGRAVESTONEDOJI(open, high, low, close) |- | '''CDLHAMMER'''<br />Hammer | |CDLHAMMER(open, high, low, close) |- | '''CDLHANGINGMAN'''<br />Hanging Man | |CDLHANGINGMAN(open, high, low, close) |- | '''CDLHARAMI'''<br />Harami Pattern | |CDLHARAMI(open, high, low, close) |- | '''CDLHARAMICROSS'''<br />Harami Cross Pattern | |CDLHARAMICROSS(open, high, low, close) |- | '''CDLHIGHWAVE'''<br />High-Wave Candle | |CDLHIGHWAVE(open, high, low, close) |- | '''CDLHIKKAKE'''<br />Hikkake Pattern | |CDLHIKKAKE(open, high, low, close) |- | '''CDLHIKKAKEMOD'''<br />Modified Hikkake Pattern | |CDLHIKKAKEMOD(open, high, low, close) |- | '''CDLHOMINGPIGEON'''<br />Homing Pigeon | |CDLHOMINGPIGEON(open, high, low, close) |- | '''CDLIDENTICAL3CROWS'''<br />Identical Three Crows | |CDLIDENTICAL3CROWS(open, high, low, close) |- | '''CDLINNECK'''<br />In-Neck Pattern | |CDLINNECK(open, high, low, close) |- | '''CDLINVERTEDHAMMER'''<br />Inverted Hammer | |CDLINVERTEDHAMMER(open, high, low, close) |- | '''CDLKICKING'''<br />Kicking | |CDLKICKING(open, high, low, close) |- | '''CDLKICKINGBYLENGTH'''<br />Kicking - bull/bear determined by the longer marubozu | |CDLKICKINGBYLENGTH(open, high, low, close) |- | '''CDLLADDERBOTTOM'''<br />Ladder Bottom | |CDLLADDERBOTTOM(open, high, low, close) |- | '''CDLLONGLEGGEDDOJI'''<br />Long Legged Doji | |CDLLONGLEGGEDDOJI(open, high, low, close) |- | '''CDLLONGLINE'''<br />Long Line Candle | |CDLLONGLINE(open, high, low, close) |- | '''CDLMARUBOZU'''<br />Marubozu | |CDLMARUBOZU(open, high, low, close) |- | '''CDLMATCHINGLOW'''<br />Matching Low | |CDLMATCHINGLOW(open, high, low, close) |- | '''CDLMATHOLD'''<br />Mat Hold | |CDLMATHOLD(open, high, low, close, penetration=0) |- | '''CDLMORNINGDOJISTAR'''<br />Morning Doji Star | |CDLMORNINGDOJISTAR(open, high, low, close, penetration=0) |- | '''CDLMORNINGSTAR'''<br />Morning Star | |CDLMORNINGSTAR(open, high, low, close, penetration=0) |- | '''CDLONNECK'''<br />On-Neck Pattern | |CDLONNECK(open, high, low, close) |- | '''CDLPIERCING'''<br />Piercing Pattern | |CDLPIERCING(open, high, low, close) |- | '''CDLRICKSHAWMAN'''<br />Rickshaw Man | |CDLRICKSHAWMAN(open, high, low, close) |- | '''CDLRISEFALL3METHODS'''<br />Rising/Falling Three Methods | |CDLRISEFALL3METHODS(open, high, low, close) |- | '''CDLSEPARATINGLINES'''<br />Separating Lines | |CDLSEPARATINGLINES(open, high, low, close) |- | '''CDLSHOOTINGSTAR'''<br />Shooting Star | |CDLSHOOTINGSTAR(open, high, low, close) |- | '''CDLSHORTLINE'''<br />Short Line Candle | |CDLSHORTLINE(open, high, low, close) |- | '''CDLSPINNINGTOP'''<br />Spinning Top | |CDLSPINNINGTOP(open, high, low, close) |- | '''CDLSTALLEDPATTERN'''<br />Stalled Pattern | |CDLSTALLEDPATTERN(open, high, low, close) |- | '''CDLSTICKSANDWICH'''<br />Stick Sandwich | |CDLSTICKSANDWICH(open, high, low, close) |- | '''CDLTAKURI'''<br />Takuri (Dragonfly Doji with very long lower shadow) | |CDLTAKURI(open, high, low, close) |- | '''CDLTASUKIGAP'''<br />Tasuki Gap | |CDLTASUKIGAP(open, high, low, close) |- | '''CDLTHRUSTING'''<br />Thrusting Pattern | |CDLTHRUSTING(open, high, low, close) |- | '''CDLTRISTAR'''<br />Tristar Pattern | |CDLTRISTAR(open, high, low, close) |- | '''CDLUNIQUE3RIVER'''<br />Unique 3 River | |CDLUNIQUE3RIVER(open, high, low, close) |- | '''CDLUPSIDEGAP2CROWS'''<br />Upside Gap Two Crows | |CDLUPSIDEGAP2CROWS(open, high, low, close) |- | '''CDLXSIDEGAP3METHODS'''<br />Upside/Downside Gap Three Methods | |CDLXSIDEGAP3METHODS(open, high, low, close) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/pattern_recognition.html mrjbq7/ta-lib 文档:Pattern Recognition]}} ===Statistic Functions=== {| class="wikitable sortable" style="width: 100%; !函数名 !描述 !代码 |- | '''BETA'''<br />Beta | | BETA(high, low, timeperiod=5) |- | '''CORREL'''<br />Pearson's Correlation Coefficient (r) | | CORREL(high, low, timeperiod=30) |- | '''LINEARREG'''<br />Linear Regression | | LINEARREG(close, timeperiod=14) |- | '''LINEARREG_ANGLE'''<br />Linear Regression Angle | | LINEARREG_ANGLE(close, timeperiod=14) |- | '''LINEARREG_INTERCEPT'''<br />Linear Regression Intercept | | LINEARREG_INTERCEPT(close, timeperiod=14) |- | '''LINEARREG_SLOPE'''<br />Linear Regression Slope | | LINEARREG_SLOPE(close, timeperiod=14) |- | '''STDDEV'''<br />Standard Deviation | | STDDEV(close, timeperiod=5, nbdev=1) |- | '''TSF'''<br />Time Series Forecast | | TSF(close, timeperiod=14) |- | '''VAR'''<br />Variance | | VAR(close, timeperiod=5, nbdev=1) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/statistic_functions.html mrjbq7/ta-lib 文档:Statistic Functions]}} ===Math Transform=== {| class="wikitable sortable" style="width: 100%; !函数名 !描述 !代码 |- | '''ACOS'''<br />Vector Trigonometric ACos | | ACOS(close) |- | '''ASIN'''<br />Vector Trigonometric ASin | | ASIN(close) |- | '''ATAN'''<br />Vector Trigonometric ATan | | ATAN(close) |- | '''CEIL'''<br />Vector Ceil | | CEIL(close) |- | '''COS'''<br />Vector Trigonometric Cos | | COS(close) |- | '''COSH'''<br />Vector Trigonometric Cosh | | COSH(close) |- | '''EXP'''<br />Vector Arithmetic Exp | | EXP(close) |- | '''FLOOR'''<br />Vector Floor | | FLOOR(close) |- | '''LN'''<br />Vector Log Natural | | LN(close) |- | '''LOG10'''<br />Vector Log10 | | LOG10(close) |- | '''SIN'''<br />Vector Trigonometric Sin | | SIN(close) |- | '''SINH'''<br />Vector Trigonometric Sinh | | SINH(close) |- | '''SQRT'''<br />Vector Square Root | | SQRT(close) |- | '''TAN'''<br />Vector Trigonometric Tan | | TAN(close) |- | '''TANH'''<br />Vector Trigonometric Tanh | | TANH(close) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/math_transform.html mrjbq7/ta-lib 文档:Math Transform]}} ===Math Operators=== {| class="wikitable sortable" style="width: 100%; !函数名 !描述 !代码 |- | '''ADD'''<br />Vector Arithmetic Add | | ADD(high, low) |- | '''DIV'''<br />Vector Arithmetic Div | | DIV(high, low) |- | '''MAX'''<br />Highest value over a specified period | | MAX(close, timeperiod=30) |- | '''MAXINDEX'''<br />Index of highest value over a specified period | |MAXINDEX(close, timeperiod=30) |- | '''MIN'''<br />Lowest value over a specified period | | MIN(close, timeperiod=30) |- | '''MININDEX'''<br />Index of lowest value over a specified period | |MININDEX(close, timeperiod=30) |- | '''MINMAX'''<br />Lowest and highest values over a specified period | | min, max = MINMAX(close, timeperiod=30) |- | '''MINMAXINDEX'''<br />Indexes of lowest and highest values over a specified period | | minidx, maxidx = MINMAXINDEX(close, timeperiod=30) |- | '''MULT'''<br />Vector Arithmetic Mult | | MULT(high, low) |- | '''SUB'''<br />Vector Arithmetic Substraction | | SUB(high, low) |- | '''SUM'''<br />Summation | | SUM(close, timeperiod=30) |} {{了解更多 |[https://mrjbq7.github.io/ta-lib/func_groups/math_operators.html mrjbq7/ta-lib 文档:Math Operators]}} ==资源== ===官网=== *[https://ta-lib.org/ TA-Lib 官网] *[https://sourceforge.net/projects/ta-lib/ TA-Lib 源代码] *[https://mrjbq7.github.io/ta-lib/doc_index.html mrjbq7/ta-lib 文档] *[https://mrjbq7.github.io/ta-lib/ Python包装器 mrjbq7/ta-lib 的 Github] [[分类:技术分析]]
本页使用的模板:
模板:了解更多
(
查看源代码
)
返回至“
TA-Lib
”。