https://github.com/bukosabino/ta
Raw File
Tip revision: 71c7193e50015387c2f1bca884c6fc42cce51763 authored by Bukosabino on 16 August 2018, 23:34:25 UTC
New version 0.1.8: Some minor changes for readability. Consolidated EMA and added Daily Log Return. Fixed Detrended Price Oscillator (DPO) https://github.com/bukosabino/ta/pull/13
Tip revision: 71c7193
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