https://github.com/bukosabino/ta
Raw File
Tip revision: 37cb28d97710662fb68107fe17315eb30544b6cb authored by Dario Lopez Padial on 07 November 2019, 21:40:59 UTC
readme
Tip revision: 37cb28d
bollinger_band_features_example.py
"""This is a example adding bollinger band features.
"""
import pandas as pd
from ta import *

# Load data
df = pd.read_csv('../data/datas.csv', sep=',')

# Clean nan values
df = utils.dropna(df)

print(df.columns)

# Add bollinger band high indicator filling nans values
df['bb_high_indicator'] = bollinger_hband_indicator(df["Close"], n=20, ndev=2,
                                                        fillna=True)

# Add bollinger band low indicator filling nans values
df['bb_low_indicator'] = bollinger_lband_indicator(df["Close"], n=20, ndev=2,
                                                        fillna=True)

print(df.columns)
back to top