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.4.tar.gz (41.5 kB view details)

Uploaded Source

Built Distribution

bamboo_ta-0.1.4-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bamboo-ta-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a1c3f49760ba3d96b8d5ad03e3d02d8ceb1893bb4ad0027192bee1a19acf1207
MD5 14e3246eb01148c66742241e90c77810
BLAKE2b-256 ffcc90f875f61ee5ffb0c45da32b16e653780bafcd6e85baa64d84e972595f87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bamboo_ta-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 40.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dbd62e6c55b27bc34ab6597c156759eae5b61b0b2a608c817bae7aa67adf66ae
MD5 3dd139b68cd4ebfd6fbcc1f72a1878e3
BLAKE2b-256 6d5c307f26a9085957d16cf5ef89b882970c893bc11136a135051d1e3e26c848

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