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

Or send some crypto to the following addresses:

  • BTC : bc1qrtmdycvzc2vntx5jmg86qysnsm6h3xa9valu0e
  • ETH : 0xa27966A67F8B1225116509f6503EDf0534DE2927
  • DOGE: DEPuQLhViQDtZcyXtaqqLSPQWmMs5cckht
  • SOL : FDiyWgFRsLAMCuzAiuDe9yZ8BYsVnn244zYfqEz7bWom
  • ADA : addr1qxyr5xxvp52vf9zmpt8gtxfnkfjs5gzxh0sm2j504wgsr2vg8gvvcrg5cj29kzkwskvn8vn9pgsydwlpk49gl2u3qx5spl8gf4
  • PEPE: 0xa27966A67F8B1225116509f6503EDf0534DE2927
  • SHIB: 0xa27966A67F8B1225116509f6503EDf0534DE2927

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

Uploaded Source

Built Distribution

bamboo_ta-0.1.0-py3-none-any.whl (37.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bamboo-ta-0.1.0.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for bamboo-ta-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ddeb57c49d5b246d91390273ef152f1c9e81f2a3d2dbc4fa31a7a392aa82553
MD5 5add0a886951665bc11c5faf624afd7c
BLAKE2b-256 3df362aebc3c417f8d95ba8eb7fcc492108ccdf3d6e8aed5362599694f284428

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bamboo_ta-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for bamboo_ta-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60de77df67503854a7412b7b0e491e77e51af9a168c45fc701943444720f9ee2
MD5 1a9373908c1971ddf7bce21400d50bc8
BLAKE2b-256 29ecbc336941543710e4f56d83de0f1c582efe4d188fd51b7618e4a4daad7e58

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