PyAlgoTradeの日本語解説ブログ

PyAlgoTrade の勝手に日本語解説ブログ。日本語の内容に関して保証はいたしておりません。必ず本家のサイトをご確認ください。

2015年9月6日日曜日

PyAlgoTradeではTA-libを売買時に使うことができる

チャートに関しての様々な指標のほとんどは手計算を行っていた時代に考えられたものなので、今どきのコンピュータなら一瞬で答えが出てくる。とはいえ、計算式をプログラムにするときにバグが入り込みやすく、本人の勉強以外ですでにある指標を自作することはあまり得策ではない。
TA-Libはさまざまな指標を計算することができるライブラリで、これを活用することで時間を節約することができる。
TA-Lib
http://ta-lib.org/

組み込みテスト
以下のプログラムが動いたらTA-libが使えるようになっている。 ちなみに、乱数をボリンジャーバンドに当てはめただけなので結果にに意味はない
import numpy
import talib

data=numpy.random.random(100)
upper,middle,lower = talib.BBANDS(data,matype=talib.MA_Type.T3)

print(upper)
print(middle)
print(lower)
TA-Libがサポートしている指標は以下の通り。すいません、半分もわかりません。www
pyalgotrade.talibext.indicator.AD(barDscount)
Chaikin A/D Line
pyalgotrade.talibext.indicator.ADOSC(barDscountfastperiod=-2147483648slowperiod=-2147483648)
Chaikin A/D Oscillator
pyalgotrade.talibext.indicator.ADX(barDscounttimeperiod=-2147483648)
Average Directional Movement Index
pyalgotrade.talibext.indicator.ADXR(barDscounttimeperiod=-2147483648)
Average Directional Movement Index Rating
pyalgotrade.talibext.indicator.APO(dscountfastperiod=-2147483648slowperiod=-2147483648matype=0)
Absolute Price Oscillator
pyalgotrade.talibext.indicator.AROON(barDscounttimeperiod=-2147483648)
Aroon
pyalgotrade.talibext.indicator.AROONOSC(barDscounttimeperiod=-2147483648)
Aroon Oscillator
pyalgotrade.talibext.indicator.ATR(barDscounttimeperiod=-2147483648)
Average True Range
pyalgotrade.talibext.indicator.AVGPRICE(barDscount)
Average Price
pyalgotrade.talibext.indicator.BBANDS(dscounttimeperiod=-2147483648nbdevup=-4e+37nbdevdn=-4e+37matype=0)
Bollinger Bands
pyalgotrade.talibext.indicator.BETA(ds1ds2counttimeperiod=-2147483648)
Beta
pyalgotrade.talibext.indicator.BOP(barDscount)
Balance Of Power
pyalgotrade.talibext.indicator.CCI(barDscounttimeperiod=-2147483648)
Commodity Channel Index
pyalgotrade.talibext.indicator.CDL2CROWS(barDscount)
Two Crows
pyalgotrade.talibext.indicator.CDL3BLACKCROWS(barDscount)
Three Black Crows
pyalgotrade.talibext.indicator.CDL3INSIDE(barDscount)
Three Inside Up/Down
pyalgotrade.talibext.indicator.CDL3LINESTRIKE(barDscount)
Three-Line Strike
pyalgotrade.talibext.indicator.CDL3OUTSIDE(barDscount)
Three Outside Up/Down
pyalgotrade.talibext.indicator.CDL3STARSINSOUTH(barDscount)
Three Stars In The South
pyalgotrade.talibext.indicator.CDL3WHITESOLDIERS(barDscount)
Three Advancing White Soldiers
pyalgotrade.talibext.indicator.CDLABANDONEDBABY(barDscountpenetration=-4e+37)
Abandoned Baby
pyalgotrade.talibext.indicator.CDLADVANCEBLOCK(barDscount)
Advance Block
pyalgotrade.talibext.indicator.CDLBELTHOLD(barDscount)
Belt-hold
pyalgotrade.talibext.indicator.CDLBREAKAWAY(barDscount)
Breakaway
pyalgotrade.talibext.indicator.CDLCLOSINGMARUBOZU(barDscount)
Closing Marubozu
pyalgotrade.talibext.indicator.CDLCONCEALBABYSWALL(barDscount)
Concealing Baby Swallow
pyalgotrade.talibext.indicator.CDLCOUNTERATTACK(barDscount)
Counterattack
pyalgotrade.talibext.indicator.CDLDARKCLOUDCOVER(barDscountpenetration=-4e+37)
Dark Cloud Cover
pyalgotrade.talibext.indicator.CDLDOJI(barDscount)
Doji
pyalgotrade.talibext.indicator.CDLDOJISTAR(barDscount)
Doji Star
pyalgotrade.talibext.indicator.CDLDRAGONFLYDOJI(barDscount)
Dragonfly Doji
pyalgotrade.talibext.indicator.CDLENGULFING(barDscount)
Engulfing Pattern
pyalgotrade.talibext.indicator.CDLEVENINGDOJISTAR(barDscountpenetration=-4e+37)
Evening Doji Star
pyalgotrade.talibext.indicator.CDLEVENINGSTAR(barDscountpenetration=-4e+37)
Evening Star
pyalgotrade.talibext.indicator.CDLGAPSIDESIDEWHITE(barDscount)
Up/Down-gap side-by-side white lines
pyalgotrade.talibext.indicator.CDLGRAVESTONEDOJI(barDscount)
Gravestone Doji
pyalgotrade.talibext.indicator.CDLHAMMER(barDscount)
Hammer
pyalgotrade.talibext.indicator.CDLHANGINGMAN(barDscount)
Hanging Man
pyalgotrade.talibext.indicator.CDLHARAMI(barDscount)
Harami Pattern
pyalgotrade.talibext.indicator.CDLHARAMICROSS(barDscount)
Harami Cross Pattern
pyalgotrade.talibext.indicator.CDLHIGHWAVE(barDscount)
High-Wave Candle
pyalgotrade.talibext.indicator.CDLHIKKAKE(barDscount)
Hikkake Pattern
pyalgotrade.talibext.indicator.CDLHIKKAKEMOD(barDscount)
Modified Hikkake Pattern
pyalgotrade.talibext.indicator.CDLHOMINGPIGEON(barDscount)
Homing Pigeon
pyalgotrade.talibext.indicator.CDLIDENTICAL3CROWS(barDscount)
Identical Three Crows
pyalgotrade.talibext.indicator.CDLINNECK(barDscount)
In-Neck Pattern
pyalgotrade.talibext.indicator.CDLINVERTEDHAMMER(barDscount)
Inverted Hammer
pyalgotrade.talibext.indicator.CDLKICKING(barDscount)
Kicking
pyalgotrade.talibext.indicator.CDLKICKINGBYLENGTH(barDscount)
Kicking - bull/bear determined by the longer marubozu
pyalgotrade.talibext.indicator.CDLLADDERBOTTOM(barDscount)
Ladder Bottom
pyalgotrade.talibext.indicator.CDLLONGLEGGEDDOJI(barDscount)
Long Legged Doji
pyalgotrade.talibext.indicator.CDLLONGLINE(barDscount)
Long Line Candle
pyalgotrade.talibext.indicator.CDLMARUBOZU(barDscount)
Marubozu
pyalgotrade.talibext.indicator.CDLMATCHINGLOW(barDscount)
Matching Low
pyalgotrade.talibext.indicator.CDLMATHOLD(barDscountpenetration=-4e+37)
Mat Hold
pyalgotrade.talibext.indicator.CDLMORNINGDOJISTAR(barDscountpenetration=-4e+37)
Morning Doji Star
pyalgotrade.talibext.indicator.CDLMORNINGSTAR(barDscountpenetration=-4e+37)
Morning Star
pyalgotrade.talibext.indicator.CDLONNECK(barDscount)
On-Neck Pattern
pyalgotrade.talibext.indicator.CDLPIERCING(barDscount)
Piercing Pattern
pyalgotrade.talibext.indicator.CDLRICKSHAWMAN(barDscount)
Rickshaw Man
pyalgotrade.talibext.indicator.CDLRISEFALL3METHODS(barDscount)
Rising/Falling Three Methods
pyalgotrade.talibext.indicator.CDLSEPARATINGLINES(barDscount)
Separating Lines
pyalgotrade.talibext.indicator.CDLSHOOTINGSTAR(barDscount)
Shooting Star
pyalgotrade.talibext.indicator.CDLSHORTLINE(barDscount)
Short Line Candle
pyalgotrade.talibext.indicator.CDLSPINNINGTOP(barDscount)
Spinning Top
pyalgotrade.talibext.indicator.CDLSTALLEDPATTERN(barDscount)
Stalled Pattern
pyalgotrade.talibext.indicator.CDLSTICKSANDWICH(barDscount)
Stick Sandwich
pyalgotrade.talibext.indicator.CDLTAKURI(barDscount)
Takuri (Dragonfly Doji with very long lower shadow)
pyalgotrade.talibext.indicator.CDLTASUKIGAP(barDscount)
Tasuki Gap
pyalgotrade.talibext.indicator.CDLTHRUSTING(barDscount)
Thrusting Pattern
pyalgotrade.talibext.indicator.CDLTRISTAR(barDscount)
Tristar Pattern
pyalgotrade.talibext.indicator.CDLUNIQUE3RIVER(barDscount)
Unique 3 River
pyalgotrade.talibext.indicator.CDLUPSIDEGAP2CROWS(barDscount)
Upside Gap Two Crows
pyalgotrade.talibext.indicator.CDLXSIDEGAP3METHODS(barDscount)
Upside/Downside Gap Three Methods
pyalgotrade.talibext.indicator.CMO(dscounttimeperiod=-2147483648)
Chande Momentum Oscillator
pyalgotrade.talibext.indicator.CORREL(ds1ds2counttimeperiod=-2147483648)
Pearson’s Correlation Coefficient (r)
pyalgotrade.talibext.indicator.DEMA(dscounttimeperiod=-2147483648)
Double Exponential Moving Average
pyalgotrade.talibext.indicator.DX(barDscounttimeperiod=-2147483648)
Directional Movement Index
pyalgotrade.talibext.indicator.EMA(dscounttimeperiod=-2147483648)
Exponential Moving Average
pyalgotrade.talibext.indicator.HT_DCPERIOD(dscount)
Hilbert Transform - Dominant Cycle Period
pyalgotrade.talibext.indicator.HT_DCPHASE(dscount)
Hilbert Transform - Dominant Cycle Phase
pyalgotrade.talibext.indicator.HT_PHASOR(dscount)
Hilbert Transform - Phasor Components
pyalgotrade.talibext.indicator.HT_SINE(dscount)
Hilbert Transform - SineWave
pyalgotrade.talibext.indicator.HT_TRENDLINE(dscount)
Hilbert Transform - Instantaneous Trendline
pyalgotrade.talibext.indicator.HT_TRENDMODE(dscount)
Hilbert Transform - Trend vs Cycle Mode
pyalgotrade.talibext.indicator.KAMA(dscounttimeperiod=-2147483648)
Kaufman Adaptive Moving Average
pyalgotrade.talibext.indicator.LINEARREG(dscounttimeperiod=-2147483648)
Linear Regression
pyalgotrade.talibext.indicator.LINEARREG_ANGLE(dscounttimeperiod=-2147483648)
Linear Regression Angle
pyalgotrade.talibext.indicator.LINEARREG_INTERCEPT(dscounttimeperiod=-2147483648)
Linear Regression Intercept
pyalgotrade.talibext.indicator.LINEARREG_SLOPE(dscounttimeperiod=-2147483648)
Linear Regression Slope
pyalgotrade.talibext.indicator.MA(dscounttimeperiod=-2147483648matype=0)
All Moving Average
pyalgotrade.talibext.indicator.MACD(dscountfastperiod=-2147483648slowperiod=-2147483648,signalperiod=-2147483648)
Moving Average Convergence/Divergence
pyalgotrade.talibext.indicator.MACDEXT(dscountfastperiod=-2147483648fastmatype=0slowperiod=-2147483648,slowmatype=0signalperiod=-2147483648signalmatype=0)
MACD with controllable MA type
pyalgotrade.talibext.indicator.MACDFIX(dscountsignalperiod=-2147483648)
Moving Average Convergence/Divergence Fix 12/26
pyalgotrade.talibext.indicator.MAMA(dscountfastlimit=-4e+37slowlimit=-4e+37)
MESA Adaptive Moving Average
pyalgotrade.talibext.indicator.MAX(dscounttimeperiod=-2147483648)
Highest value over a specified period
pyalgotrade.talibext.indicator.MAXINDEX(dscounttimeperiod=-2147483648)
Index of highest value over a specified period
pyalgotrade.talibext.indicator.MEDPRICE(barDscount)
Median Price
pyalgotrade.talibext.indicator.MFI(barDscounttimeperiod=-2147483648)
Money Flow Index
pyalgotrade.talibext.indicator.MIDPOINT(dscounttimeperiod=-2147483648)
MidPoint over period
pyalgotrade.talibext.indicator.MIDPRICE(barDscounttimeperiod=-2147483648)
Midpoint Price over period
pyalgotrade.talibext.indicator.MIN(dscounttimeperiod=-2147483648)
Lowest value over a specified period
pyalgotrade.talibext.indicator.MININDEX(dscounttimeperiod=-2147483648)
Index of lowest value over a specified period
pyalgotrade.talibext.indicator.MINMAX(dscounttimeperiod=-2147483648)
Lowest and highest values over a specified period
pyalgotrade.talibext.indicator.MINMAXINDEX(dscounttimeperiod=-2147483648)
Indexes of lowest and highest values over a specified period
pyalgotrade.talibext.indicator.MINUS_DI(barDscounttimeperiod=-2147483648)
Minus Directional Indicator
pyalgotrade.talibext.indicator.MINUS_DM(barDscounttimeperiod=-2147483648)
Minus Directional Movement
pyalgotrade.talibext.indicator.MOM(dscounttimeperiod=-2147483648)
Momentum
pyalgotrade.talibext.indicator.NATR(barDscounttimeperiod=-2147483648)
Normalized Average True Range
pyalgotrade.talibext.indicator.OBV(ds1volumeDscount)
On Balance Volume
pyalgotrade.talibext.indicator.PLUS_DI(barDscounttimeperiod=-2147483648)
Plus Directional Indicator
pyalgotrade.talibext.indicator.PLUS_DM(barDscounttimeperiod=-2147483648)
Plus Directional Movement
pyalgotrade.talibext.indicator.PPO(dscountfastperiod=-2147483648slowperiod=-2147483648matype=0)
Percentage Price Oscillator
pyalgotrade.talibext.indicator.ROC(dscounttimeperiod=-2147483648)
Rate of change : ((price/prevPrice)-1)*100
pyalgotrade.talibext.indicator.ROCP(dscounttimeperiod=-2147483648)
Rate of change Percentage: (price-prevPrice)/prevPrice
pyalgotrade.talibext.indicator.ROCR(dscounttimeperiod=-2147483648)
Rate of change ratio: (price/prevPrice)
pyalgotrade.talibext.indicator.ROCR100(dscounttimeperiod=-2147483648)
Rate of change ratio 100 scale: (price/prevPrice)*100
pyalgotrade.talibext.indicator.RSI(dscounttimeperiod=-2147483648)
Relative Strength Index
pyalgotrade.talibext.indicator.SAR(barDscountacceleration=-4e+37maximum=-4e+37)
Parabolic SAR
pyalgotrade.talibext.indicator.SAREXT(barDscountstartvalue=-4e+37offsetonreverse=-4e+37,accelerationinitlong=-4e+37accelerationlong=-4e+37accelerationmaxlong=-4e+37accelerationinitshort=-4e+37,accelerationshort=-4e+37accelerationmaxshort=-4e+37)
Parabolic SAR - Extended
pyalgotrade.talibext.indicator.SMA(dscounttimeperiod=-2147483648)
Simple Moving Average
pyalgotrade.talibext.indicator.STDDEV(dscounttimeperiod=-2147483648nbdev=-4e+37)
Standard Deviation
pyalgotrade.talibext.indicator.STOCH(barDscountfastk_period=-2147483648slowk_period=-2147483648slowk_matype=0,slowd_period=-2147483648slowd_matype=0)
Stochastic
pyalgotrade.talibext.indicator.STOCHF(barDscountfastk_period=-2147483648fastd_period=-2147483648,fastd_matype=0)
Stochastic Fast
pyalgotrade.talibext.indicator.STOCHRSI(dscounttimeperiod=-2147483648fastk_period=-2147483648,fastd_period=-2147483648fastd_matype=0)
Stochastic Relative Strength Index
pyalgotrade.talibext.indicator.SUM(dscounttimeperiod=-2147483648)
Summation
pyalgotrade.talibext.indicator.T3(dscounttimeperiod=-2147483648vfactor=-4e+37)
Triple Exponential Moving Average (T3)
pyalgotrade.talibext.indicator.TEMA(dscounttimeperiod=-2147483648)
Triple Exponential Moving Average
pyalgotrade.talibext.indicator.TRANGE(barDscount)
True Range
pyalgotrade.talibext.indicator.TRIMA(dscounttimeperiod=-2147483648)
Triangular Moving Average
pyalgotrade.talibext.indicator.TRIX(dscounttimeperiod=-2147483648)
1-day Rate-Of-Change (ROC) of a Triple Smooth EMA
pyalgotrade.talibext.indicator.TSF(dscounttimeperiod=-2147483648)
Time Series Forecast
pyalgotrade.talibext.indicator.TYPPRICE(barDscount)
Typical Price
pyalgotrade.talibext.indicator.ULTOSC(barDscounttimeperiod1=-2147483648timeperiod2=-2147483648,timeperiod3=-2147483648)
Ultimate Oscillator
pyalgotrade.talibext.indicator.VAR(dscounttimeperiod=-2147483648nbdev=-4e+37)
Variance
pyalgotrade.talibext.indicator.WCLPRICE(barDscount)
Weighted Close Price
pyalgotrade.talibext.indicator.WILLR(barDscounttimeperiod=-2147483648)
Williams’ %R
pyalgotrade.talibext.indicator.WMA(dscounttimeperiod=-2147483648)
Weighted Moving Average

0 件のコメント:

コメントを投稿