Skip to main content

TA library for Pandas

Project description

bamboo-ta

Bamboo TA

license Python Version PyPi Version Package Status Downloads Stars Forks Used By Contributors Issues Closed Issues Support me on Patreon YouTube Channel Subscribers YouTube Channel Views

Why this library

Bamboo-ta is a personal project that consolidates various Technical Analysis Indicators for trading into a single library. It’s primarily built for personal use, with a focus on data analysis of candlestick data to develop new (algorithmic) trading strategies. It can also serve as an auxiliary library for indicators in trading bots.

This library includes not only some of the most popular indicators (like MACD, RSI, SMA, EMA, and more), but also more obscure (and possibly brand new) indicators such as ‘Waddah Attar Explosion’ and ‘Bollinger Bands Trend Indicator’. For more information on the available indicators, please refer to the indicator category pages.

While Bamboo-ta complements other popular TA libraries like TA-lib, Pandas-ta, qtpylib, and others, it is not intended to replace them. There will likely be many indicators that are better served by these other libraries.

Bamboo-ta is designed with a focus on simplicity and modularity. It aims to be easy to use and maintain. If you’re seeking a library for complex indicator applications, you might want to consider other options.

Social

See my Youtube channel for Freqtrade tutorials, Tradingview knowledge and video's about trading strategies and algorithms I tested.

See my Patreon page for all the algorithmic strategies code (trading algorithms and automated backtests). These are all based on the Freqtrade trading bot btw.

For the Strategy League (an overview of all the trading strategies/algorithms I tested) go to dutchalgotrading.com. Ths league contains a ranked list with all the tested strategies I present on my Youtube channel and Patreon page

Support and donations

Sometimes, the best motivation a person can receive is a small contribution that shows appreciation for their work.

You can support my work by becoming a Patron on Patreon.

For one-time donations you can visit Ko-fi.com

Affiliates

Unlock up to $30,020 in exclusive rewards and be invited to exclusive events on Bybit:

Receive a $100, 60-day credit on Linode for your cloud server:

Receive a $15 discount with purchase Tradingview subscription:

EUR 100 transactiekostentegoed (Dutch Only!) bij openen van een rekening:

Installation

Stable version

Install bamboo-ta from Pypi with:

pip install bamboo-ta

Or you can install this directly from the Github repository with the following command:

$ pip install -U git+https://github.com/DutchCryptoDad/bamboo-ta

Development version

The bleeding edge development version can be installed with:

$ pip install -U git+https://github.com/DutchCryptoDad/bamboo-ta.git@development

How to Use This Module

Using the complete module all at once.

  1. Importing the complete library: Import the library into your Python scripts or Notebook.

    import bamboo_ta as bta
    

    Additionally import Pandas and Numpy too:

    import pandas as pd
    from pandas import DataFrame
    import numpy as np
    
  2. Build the dataframe: The dataframe should be build as follows for the fastest results.

    df = pd.read_json("./BTC_USDT-1d.json")
    df.columns = ['date', 'open', 'high', 'low', 'close', 'volume']
    df['date'] = (pd.to_datetime(df['date'], unit='ms'))
    
  3. Applying Indicators: Use the imported indicators on your data.

    df['ao'] = bta.AwesomeOscillator(df, 'high', 'low', 5, 34)['ao']
    

    Or

    lr_df = bta.LinRegCandles(df)
    df['lrc_open'] = lr_df['bopen']
    df['lrc_high'] = lr_df['bhigh']
    df['lrc_low'] = lr_df['blow']
    df['lrc_close'] = lr_df['bclose']
    df['lrc_signal'] = lr_df['signal']
    

Or individual indicators.

  1. Importing Indicators: Import the necessary submodules or individual indicators directly from bamboo_ta.

    from bamboo_ta.trend import AlligatorBands
    
  2. Applying Indicators: Use the imported indicators on your data.

     alligator_result = bta.AlligatorBands(df, 'close', 13, 8, 5, jaw_shift=8, teeth_shift=5, lips_shift=3)
     df['jaw'] = alligator_result['jaw']
     df['teeth'] = alligator_result['teeth']
     df['lips'] = alligator_result['lips']
    

Practical example

Example script:

# -*- coding: utf-8 -*-
# Import necessary libraries
# Importeer necessary libraries
import bamboo_ta.bamboo_ta as bta
#import pandas_ta as pta
import pandas as pd
from pandas import DataFrame
import numpy as np

# Create dataframe
# create dataframe and read the json data in the datasets directory
df = pd.read_json("./BTC_USDT-1d.json")
# name the columns that are loaded into the dataframe
df.columns = ['date', 'open', 'high', 'low', 'close', 'volume']
# the date column consists of unix time in milliseconds, so this command changes this data into human readable form.
df['date'] = (pd.to_datetime(df['date'], unit='ms'))

fscg = bta.EhlersFisherStochasticCenterOfGravity(df)
df['CG'] = fscg['CG']
df['Trigger'] = fscg['Trigger']

print(df.tail(40))

Output:

 python test.py
1962 2022-12-31  16607.48  16644.09  16470.00  16542.40  114490.42864 -0.75    -0.21
1963 2023-01-01  16541.77  16628.00  16499.01  16616.75   96925.41374 -1.28    -0.75
1964 2023-01-02  16617.17  16799.23  16548.70  16672.87  121888.57191 -1.07    -1.28
1965 2023-01-03  16672.78  16778.40  16605.28  16675.18  159541.53733 -0.23    -1.07
1966 2023-01-04  16675.65  16991.87  16652.66  16850.36  220362.18862  0.37    -0.23
1967 2023-01-05  16850.36  16879.82  16753.00  16831.85  163473.56641  0.96     0.37
1968 2023-01-06  16831.85  17041.00  16679.00  16950.65  207401.28415  1.78     0.96
1969 2023-01-07  16950.31  16981.91  16908.00  16943.57  104526.56880  2.65     1.78
1970 2023-01-08  16943.83  17176.99  16911.00  17127.83  135155.89695  2.65     2.65
1971 2023-01-09  17127.83  17398.80  17104.66  17178.26  266211.52723  2.65     2.65

Indicator categories

Sources on which some indicators are based on

Disclaimer !!!

Most of the indicators I configured are tested agains a dataset from Binance (BTC/USDT) and verified with the same indicators on Tradingview. However I will and cannot guarantee the workings and accuracy.

I personally use these indicators to build my own trading strategies, for backtesting and manual & bot trading using the Freqtrade trading bot. So it is in my own personal best interest to make these indicators work as accurately as possible.

You are welcome to do suggestions and report bugs if you find these. But I will handle these on a 'best effort' base. I believe that the pressure of maintaining larger and popular libraries will lead to abandonment of the project by the original developer(s) at some point in time. And I do not want this to happen with this project (although no guarantees here too...).
So be patient and the proposed suggestions might be handled all in good time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bamboo-ta-0.1.5.tar.gz (41.5 kB view details)

Uploaded Source

Built Distribution

bamboo_ta-0.1.5-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file bamboo-ta-0.1.5.tar.gz.

File metadata

  • Download URL: bamboo-ta-0.1.5.tar.gz
  • Upload date:
  • Size: 41.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for bamboo-ta-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6047a033f48f870ff54658657b5d9694b263e0c8e7d1bf35f1b1895eb7ec30bc
MD5 381ff4e367540b85cb78e93078b06083
BLAKE2b-256 2cd8b8cbf11a94c73985263a9e11dff03ae4a67fb4fc9a4466b03f4b4773c4ac

See more details on using hashes here.

File details

Details for the file bamboo_ta-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: bamboo_ta-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for bamboo_ta-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d1dbdb8ead15fa1118b268279842bafcc93a2629ffce301a43856f5f649b2ab1
MD5 754e2472810fb4172feecf3944f9b851
BLAKE2b-256 63c7b00c8b052feddd08116cb599043658f7a3adf7983182c26ba0e0e38a78a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page