bukosabino / ta

Technical Analysis Library using Pandas and Numpy
https://technical-analysis-library-in-python.readthedocs.io/en/latest/
MIT License
4.34k stars 916 forks source link

Comparison to ta-lib #162

Open pedrovgp opened 4 years ago

pedrovgp commented 4 years ago

What are the advantages and disadvantages of this library compared to https://ta-lib.org

bukosabino commented 4 years ago

Hi @pedrovgp ,

Thank you for your question.

Well, to be honest, I started to develop this library two years ago as a way to learn about Pandas and Numpy tools. I didn't find any pure Python library to do technical analysis on financial datasets, so I created this one. It was just a "game". Over time, the financial community starts to use more and more Python packages. So, during this time, I have worked building this useful tool for them. I will try to explore the advantages and disadvantages of the use of this library:

Advantages for ta

ta-lib

from talib import MA_Type

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

ta

from ta.volatility import BollingerBands

# Initialize Bollinger Bands Indicator
indicator_bb = BollingerBands(close=df["Close"], n=20, ndev=2)

# Add Bollinger Bands features
df['bb_bbm'] = indicator_bb.bollinger_mavg()
df['bb_bbh'] = indicator_bb.bollinger_hband()
df['bb_bbl'] = indicator_bb.bollinger_lband()

# Add Bollinger Band high indicator
df['bb_bbhi'] = indicator_bb.bollinger_hband_indicator()

# Add Bollinger Band low indicator
df['bb_bbli'] = indicator_bb.bollinger_lband_indicator()

# Add Width Size Bollinger Bands
df['bb_bbw'] = indicator_bb.bollinger_wband()

# Add Percentage Bollinger Bands
df['bb_bbp'] = indicator_bb.bollinger_pband()

Advantages for ta-lib

It is a personal vision. Probably, the community can provide us with more views about this question.

Best, Dario