It is a Technical Analysis library useful to do feature engineering from financial time series datasets (Open, Close, High, Low, Volume). It is built on Pandas and Numpy.
The library has implemented 42 indicators:
https://technical-analysis-library-in-python.readthedocs.io/en/latest/
$ pip install --upgrade ta
To use this library you should have a financial time series dataset including Timestamp
, Open
, High
, Low
, Close
and Volume
columns.
You should clean or fill NaN values in your dataset before add technical analysis features.
You can get code examples in examples_to_use folder.
You can visualize the features in this notebook.
import pandas as pd
from ta import add_all_ta_features
from ta.utils import dropna
# Load datas
df = pd.read_csv('ta/tests/data/datas.csv', sep=',')
# Clean NaN values
df = dropna(df)
# Add all ta features
df = add_all_ta_features(
df, open="Open", high="High", low="Low", close="Close", volume="Volume_BTC")
import pandas as pd
from ta.utils import dropna
from ta.volatility import BollingerBands
# Load datas
df = pd.read_csv('ta/tests/data/datas.csv', sep=',')
# Clean NaN values
df = dropna(df)
# Initialize Bollinger Bands Indicator
indicator_bb = BollingerBands(close=df["Close"], window=20, window_dev=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()
$ git clone https://github.com/bukosabino/ta.git
$ cd ta
$ pip install -r requirements-play.txt
$ make test
Thank you to OpenSistemas! It is because of your contribution that I am able to continue the development of this open source library.
Check the changelog of project.
If you think ta
library help you, please consider buying me a coffee.
Developed by Darío López Padial (aka Bukosabino) and other contributors.
Please, let me know about any comment or feedback.
Also, I am a software engineer freelance focused on Data Science using Python tools such as Pandas, Scikit-Learn, Backtrader, Zipline or Catalyst. Don’t hesitate to contact me if you need to develop something related with this library, Python, Technical Analysis, AlgoTrading, Machine Learning, etc.
Author: bukosabino
The Demo/Documentation: View The Demo/Documentation
Download Link: Download The Source Code
Official Website: https://github.com/bukosabino/ta
License: MIT
#data-analysis #python #pandas #numpy