bamboo-ta


Namebamboo-ta JSON
Version 0.9.6 PyPI version JSON
download
home_pagehttps://github.com/DutchCryptoDad/bamboo-ta
SummaryTA library for Pandas
upload_time2025-07-01 09:10:13
maintainerNone
docs_urlNone
authorDutchCryptoDad (DCD)
requires_pythonNone
licenseNone
keywords python pandas numpy trading indicator technical analysis
VCS
bugtrack_url
requirements ta numpy pandas pandas_ta scipy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bamboo-TA: Technical Analysis Indicators Library

<p align="center">
  <a href="https://github.com/DutchCryptoDad/bamboo-ta">
    <img src="images/bamboo.png" alt="Bamboo TA" width="250">
  </a>
</p>

[![license](https://img.shields.io/github/license/DutchCryptoDad/bamboo-ta)](#license)
[![Python Version](https://img.shields.io/pypi/pyversions/bamboo-ta?style=flat)](https://pypi.org/project/bamboo-ta/)
[![PyPi Version](https://img.shields.io/pypi/v/bamboo-ta?style=flat)](https://pypi.org/project/bamboo-ta/)
[![Package Status](https://img.shields.io/pypi/status/bamboo-ta?style=flat)](https://pypi.org/project/bamboo-ta/)
[![Downloads](https://img.shields.io/pypi/dm/bamboo_ta?style=flat)](https://pypistats.org/packages/bamboo_ta)
[![Stars](https://img.shields.io/github/stars/DutchCryptoDad/bamboo-ta?style=flat)](#stars)
[![Forks](https://img.shields.io/github/forks/DutchCryptoDad/bamboo-ta?style=flat)](#forks)
[![Used By](https://img.shields.io/badge/used_by-0-orange.svg?style=flat)](#usedby)
[![Contributors](https://img.shields.io/github/contributors/DutchCryptoDad/bamboo-ta?style=flat)](#contributors)
[![Issues](https://img.shields.io/github/issues-raw/DutchCryptoDad/bamboo-ta?style=flat)](#issues)
[![Closed Issues](https://img.shields.io/github/issues-closed-raw/DutchCryptoDad/bamboo-ta?style=flat)](#closed-issues)
[![Support me on Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Ddutchalgotrading%26type%3Dpatrons&style=flat)](https://patreon.com/dutchalgotrading)
[![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UC-AOcefy1x7lTc17JiqaxqA)
](https://www.youtube.com/@dutchalgotrading)
[![YouTube Channel Views](https://img.shields.io/youtube/channel/views/UC-AOcefy1x7lTc17JiqaxqA)](https://www.youtube.com/@dutchalgotrading)

---

## About Bamboo-TA

**Bamboo-TA** is a personal library that consolidates various Technical Analysis (TA) indicators into one simple and modular package for analyzing financial market data. It is designed to help traders develop trading strategies based on candlestick data.

While this library includes popular TA indicators like **MACD**, **RSI**, **SMA**, **EMA**, it also provides lesser-known indicators like **Waddah Attar Explosion** and **Bollinger Bands Trend Indicator**. Bamboo-TA is complementary to other libraries like **TA-lib**, **Pandas-ta**, and **qtpylib**, and it is not intended to replace them.

If you're looking for a library to use for data analysis, backtesting, or integrating indicators into trading bots, Bamboo-TA is designed for simplicity and ease of use.

---

## Features

- **Modular Indicators**: Includes a wide range of trend, volatility, momentum, performance, volume, and other types of indicators.
- **Complementary to Other Libraries**: Works alongside popular TA libraries such as **TA-lib** and **Pandas-ta**.
- **Focus on Algorithmic Trading**: Useful for developing custom algorithmic trading strategies with backtesting capabilities.
- **Personal Project**: Built and maintained for personal use but shared with the community.

---

## Installation

### Stable Version

Install the latest stable version directly from PyPi:

```bash
pip install bamboo-ta
```

### Development Version

To install the bleeding-edge version from the GitHub repository:

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

## Usage

### Importing the Library

To start using Bamboo-TA, import the library in your Python scripts or notebooks:

```python
import bamboo_ta as bta
import pandas as pd
import numpy as np
```

### Preparing Data

Make sure to format your `DataFrame` correctly, like this:

Bamboo-TA expects a pandas DataFrame with specific column names. Here's how to prepare your data:
  
```python
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')
```
  
### Applying Indicators
  
You can apply indicators in various ways. Here's how to use **Alligator Bands**:

Most indicators in Bamboo-TA return a DataFrame with one or more columns. You can then add these columns to your original DataFrame. Here's an example using **Alligator Bands**:
  
```python
alligator_result = bta.alligator_bands(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']
```

For indicators that return a single value, you can simplify this:
  
```python
df['rsi'] = bta.relative_strength_index(df, column='close', period=14)['rsi']
```
  
### Importing Individual Indicators
  
You can also import and apply individual indicators. Here's how to the **Exponential Moving Average**::

You can also import individual indicators directly from their respective modules. When doing this, make sure to use the imported function name directly (not with the `bta.` prefix):
  
```python
from bamboo_ta.trend import exponential_moving_average
  
df['ema'] = bta.exponential_moving_average(df, "close", 21)
# Use the imported function directly
ema_result = exponential_moving_average(df, "close", 21)
df['ema'] = ema_result['ema']
```

### Chaining Multiple Indicators

You can easily apply multiple indicators to your DataFrame:

```python
# Add RSI
df['rsi'] = bta.relative_strength_index(df, column='close', period=14)['rsi']

# Add MACD
macd_result = bta.macd(df, 'close', 12, 26, 9)
df['macd'] = macd_result['macd']
df['macd_signal'] = macd_result['macd_signal']
df['macd_histogram'] = macd_result['macd_histogram']

# Add Bollinger Bands
bb_result = bta.bollinger_bands(df, 'close', 20, 2)
df['bb_upper'] = bb_result['upper']
df['bb_middle'] = bb_result['middle']
df['bb_lower'] = bb_result['lower']
```

### Accessing Indicator Documentation

Each indicator in Bamboo-TA comes with comprehensive documentation that includes a description, parameters, usage examples, and more. You can access this documentation in several ways:

#### Using the help() Function

The simplest way to access indicator documentation is to use Python's built-in `help()` function:

```python
# Get help for a specific indicator
help(bta.macd_v)
help(bta.relative_strength_index)
help(bta.awesome_oscillator)
```

This will display the indicator's docstring, which includes all the information you need to use it effectively.

#### Accessing Docstrings Directly

You can also access the docstring directly:

```python
# Print the docstring for a specific indicator
print(bta.macd_v.__doc__)
```

#### Using the test_indicators.py Script

When you run the `test_indicators.py` script, it automatically displays the indicator's documentation:

```bash
python test_indicators.py macd_v
```

This will show the indicator description along with the test results.

## Testing Indicators

Bamboo-TA includes a built-in testing system that allows you to quickly test any indicator in the library. This is useful for verifying that indicators are working correctly and producing the expected results, which you can compare with what you see on TradingView.

### Test all indicators in one go

Use the ``test_all_indicators.py`` script to test all the indicators in the module. Be warned, this test only works after all the requirements have been installed on the (virtual) system.

### Using the test_indicators.py Script

The easiest way to test an indicator is to use the `test_indicators.py` script:

```bash
python test_indicators.py [indicator_name] [timeframe]
```

For example:

```bash
python test_indicators.py relative_strength_index 1d
python test_indicators.py awesome_oscillator 4h
python test_indicators.py momentum_divergence 1h
```

This will:

1. Load the appropriate data file (e.g., BTC_USDT-1d.json or BTC_USDT-4h.json)
2. Apply the indicator to the data
3. Display the indicator description and the last 32 rows of data with the indicator values

### Testing Individual Indicator Files

Each indicator file also includes a `test()` function that can be run directly:

```bash
python -m bamboo_ta.momentum.relative_strength_index
```

This will run the test function in the indicator file, which uses the generic `test_indicator` function.

### Using the test_indicator Function Directly

You can also use the `test_indicator` function directly in your code:

```python
import bamboo_ta.bamboo_ta as bta
from bamboo_ta.momentum import relative_strength_index

bta.test_indicator(relative_strength_index)
```

This gives you more flexibility to test indicators with custom parameters.

## Indicator Categories

Bamboo-TA includes a wide range of technical analysis indicators organized into the following categories:

### Candles

Indicators for candlestick pattern analysis and transformations:

- Candlestick Patterns
- Dynamic Exhaustion Bars
- Exhaustion Bars
- Hansen Heiken Ashi
- Heiken Ashi
- Linear Regression Candles
- Smoothed Heiken Ashi

### Cycles

Indicators for analyzing market cycles:

- Even Better Sinewave

### Momentum

Indicators that measure the rate of change in price movements:

- Absolute Price Oscillator
- Awesome Oscillator
- Balance Of Power
- Bias
- Brar
- Calculate Intraday Momentum Index
- Center Of Gravity
- Chande Forecast Oscillator
- Chande Momentum Oscillator
- Commodity Channel Index
- Coppock Curve
- Correlation Trend Indicator
- Directional Movement
- Efficiency Ratio
- Ehlers Fisher Stochastic Center Of Gravity
- Ehlers Ray Index
- Elliott Wave Oscillator
- Fisher Transform
- Inertia
- Kaufmans Adaptive Moving Average
- Kdj
- Know Sure Thing
- Ma Streak
- Momentum
- Momentum Divergence
- Moving Average Convergence Divergence
- Moving Average Convergence Divergence Leader
- Moving Average Convergence Divergence V
- Percentage Price Oscillator
- Percentage Volume Oscillator
- Pretty Good Oscillator
- Psychological Line
- Qualitative Quantitative Estimation
- Rate Of Change
- Relative Momentum Index
- Relative Strength Index
- Relative Strength Index Exponential
- Relative Vigor Index
- Schaff Trend Cycle
- Smi Ergodic Indicator
- Smoothed Rate Of Change
- Stochastic Momentum Index
- Stochastic Rsi
- Stochastics Oscillator
- Td Sequential
- Triple Exponential Average
- True Strength Index
- Ttm Squeeze
- Ultimate Oscillator
- Waddah Attar Explosion
- Waddah Attar Explosion Atr
- Wave Trend
- Wave Trend Oscillator
- Williams R

### Performance

*Note: This category is currently under development.*


### Statistics

*Note: This category is currently under development.*


### Trend

Indicators that help identify the direction of market trends:

- Alligator Bands
- Archer Moving Averages Trends
- Arnaud Legoux Moving Average
- Aroon
- Average Directional Index
- Bollinger Trend
- Bollinger Trend Fast With Ma
- Breakouts
- Chande Kroll Stop
- Choppiness Index
- Cross Signals
- Decay
- Decreasing
- Detrended Price Oscillator
- Double Exponential Moving Average
- Exponential Moving Average
- Fractal Weighted Moving Average
- Gaussian Channel
- Holt Winters Moving Average
- Hull Moving Average
- Increasing
- Jurik Moving Average
- Least Squares Moving Average
- Long Run
- Mcginley Dynamic
- Parabolic Sar
- Pascals Weighted Moving Average
- Percent Price Channel
- Pmax
- Price Channel
- Q Stick
- Range Filter
- Rolling Moving Average
- Sequential Weighted Moving Average
- Short Run
- Simple Moving Average
- Sine Weighted Moving Average
- Ssl Channels
- Ssl Channels Atr
- Supertrend
- T3 Average
- Trend Signals
- Triangular Moving Average
- Triple Exponential Moving Average
- Ttm Trend
- Ut Bot
- Variable Index Dynamic Average
- Vertical Horizontal Filter
- Volumatic Variable Index Dynamic Average
- Volume Weighted Moving Average
- Vortex Indicator
- Weighted Moving Average
- Zero Exponential Moving Average
- Zero Lag Exponential Moving Average

### Utility

Utility functions and indicators for various calculations:

- Calculate Atr Stop Loss Take Profit
- Calculate Stop Loss Take Profit
- Compounded Annual Growth Rate
- Consecutive Count
- Consecutive Higher Highs
- Consecutive Lower Lows
- Cross
- Cross Value
- Cumulative Return
- Daily Log Return
- Daily Return
- Drawdown
- Drop Na
- Entropy
- Error Function
- Exhaustion Candles
- Exhaustion Lengths
- Filter By Dates
- First Crossed Above Second
- First Crossed Below Second
- Geometric Mean
- Get Min Max
- Indicator Mixin
- Is Above
- Is Above Value
- Is Below
- Is Below Value
- Kurtosis
- Linear Decay
- Linear Growth
- Linear Regression Slope
- Log Geometric Mean
- Log Return
- Mean Absolute Deviation
- Median
- Month To Date
- Overbought Oversold
- Pascals Triangle
- Percent Return
- Populate Leledc Major Minor
- Pump Dump Protection
- Quantile
- Quarter To Date
- Regression Slope
- Same Length
- Sharpe Ratio
- Skew
- St Dev
- Symmetric Triangle
- Top Percent Change
- Tos Standard Deviation All
- Variance
- Year To Date
- Z Score

### Volatility

Indicators that measure the rate and magnitude of price changes:

- Aberration Bands
- Acceleration Bands
- Average True Range
- Bbw Expansion
- Bollinger Bands
- Donchian Channel
- Hurst Winter Channel
- Keltner Channel
- Mass Index
- Normalized Average True Range
- Percentage Distance
- Relative Volatility Index
- Thermometer
- True Range
- Ulcer Index
- Williams Vix Fix

### Volume

Indicators that incorporate trading volume to confirm price movements:

- Accumulation Distribution Index
- Accumulation Distribution Oscillator
- Accumulation On Balance Volume
- Chaikin Money Flow
- Ease Of Movement
- Force Index
- Klinger Volume Oscillator
- Money Flow Index
- Negative Volume Index
- On Balance Volume
- On Balance Volume Oscillator
- Positive Volume Index
- Price Volume
- Price Volume Rank
- Price Volume Trend
- Relative Volume
- Time Relative Volume Oscillator
- Volume Profile
- Volume Weighted Average Price
- Volume Weighted Average Price Bands

To access detailed documentation for any indicator, use the `help()` function or access the docstring directly as described in the [Accessing Indicator Documentation](#accessing-indicator-documentation) section.

Or read [the indicator documentation page](documentation/indicators.md) for all the indicators on one page.

## Social & Community

- **YouTube**: Check out my [YouTube channel](https://www.youtube.com/@dutchalgotrading) for tutorials on [Freqtrade](https://www.youtube.com/watch?v=VHvikJmQrVM), [Tradingview](https://www.youtube.com/watch?v=aQSC-W8oYdw), and tested [trading strategies](https://www.youtube.com/watch?v=Jj9MSzHwa44).
- **Patreon**: For exclusive trading algorithms, backtests, and strategy codes, support me on [Patreon](https://www.patreon.com/dutchalgotrading).
- **Strategy League**: View the results of my tested strategies at [DutchAlgoTrading.com](https://www.dutchalgotrading.com).

## Support & Donations

If you find Bamboo-TA useful, consider supporting the project:

- **Patreon**: Support via [Patreon](https://www.patreon.com/dutchalgotrading).
- **Ko-fi**: Make a one-time donation on [Ko-fi](https://ko-fi.com/dutchcryptodad).

### Affiliates

- [Bybit Rewards](https://partner.bybit.com/b/dutchalgo)
- [Linode $100 Credit](https://bit.ly/Linode_Advantages)
- [TradingView Discount](https://www.tradingview.com/?aff_id=139223)
- [Saxo Bank (Dutch Only)](https://refer.saxo/fKnth)

## Disclaimer

Bamboo-TA is a personal project, and while I make every effort to ensure accuracy, I cannot guarantee the functionality of the indicators. They are tested against Binance (BTC/USDT) data and compared with similar indicators on [TradingView](https://www.tradingview.com/?aff_id=139223).

I personally use these indicators to build my own trading strategies, for backtesting and manual & bot trading using the [Freqtrade trading bot](https://www.youtube.com/watch?v=VHvikJmQrVM&list=PL8gq8aFDPpbNEx4lUvpmRjxtCkjvX-Jpg). So it is in my own personal best interest to make these indicators work as accurately as possible.

Suggestions and bug reports are welcome, but fixes will be handled on a best-effort basis. Please be patient!

## Indicator sources

- [ThinkOrSwim Tech indicators](https://tlc.thinkorswim.com/center/reference/Tech-Indicators)
- [Legendary TA](https://github.com/just-nilux/legendary_ta)
- [CryptoFrog Custom Indicators](https://github.com/froggleston/cryptofrog-strategies/blob/main/custom_indicators.py)
- [Linnsoft](https://www.linnsoft.com/techind/accumulation-distribution)
- [Profitspi](https://www.profitspi.com/stock/view.aspx?v=stock-chart-library)
- [Cybernetic Analysis](https://www.neuroshell.com/manuals/cyber/index.html)
- [TRradeStation](https://help.tradestation.com/10_00/eng/tradestationhelp/elanalysis/indicator/price_channel__percent_pc_indicator_.htm)
- [Sierra Chart](https://www.sierrachart.com/index.php?page=doc/TechnicalStudiesReference.php)
- [qtpylib](https://github.com/ranaroussi/qtpylib/blob/main/qtpylib/indicators.py)

## Creating the Python pip package (personal notes)

After creating and testing the code, make a Python pip package as follows:

Update the file ``setup.py`` and update version number.

In the library folder, create the package

``python3 setup.py sdist bdist_wheel``

Before uploading the package to Pypi it is wise to test the package on your system.

Load the package to the system with:

``pip install .``

After you've checked that everything is working correctly, then use the following command to upload to Pypi.
You'll have to install twine for this (``pip install twine`` or ``sudo apt install twine``)

When you get the error:

```
ImportError: cannot import name 'appengine' from 'requests.packages.urllib3.contrib' (/home/user/.local/lib/python3.10/site-packages/urllib3/contrib/__init__.py)
```

You should do a ``pip install --upgrade twine requests-toolbelt``.

### Before uploading

```
# Check first

twine check dist/*

# Test upload first

twine upload -r testpypi dist/*

# Upload to Pypi

twine upload dist/*
```

Note: uploading new versions requires to delete the older versions from the /dist folder.

Another option is to use the ``--skip-existing`` option like this:

```
# Testpypi
twine upload -r testpypi dist/* --skip-existing 

# ProductionPypi
twine upload -r pypi dist/* --skip-existing
```

### Uploading with 2FA enabled

First create an API token (at <https://test.pypi.org/manage/account/token/>).

Create a file .pypirc in your home folder (e.g. ``nano $HOME/.pypirc``)

Add the given token to the file like this:

```
[testpypi]
  username = __token__
  password =
pypi-AgENdGVzdC5weXtMjBjOS00ZjgxLWIyZDMtYWViMDAwOTk3MWZmAAIqWzMsImU3YjkzMGVmLWQzMGItNGFhYi1iNB6NZ-rSrzc8UXHRmWp5fzZwP


[pypi]
  username = __token__
  password =
pypi-AgEIcHlwaS5vcmcCJDgxYWFiYjYwLTMxYmUtNDczZC1hNjBhLTU0MDJhNmQ2NmZhMgAQ3NTAtOGVkNy0xN2U0NmU0MjEzMQFAYWNj0FcsP-Slnj9-wkEWWwQXkaw
```

Save the file and reload environment if necessary.

Now you an upload libraries without having to use the password.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DutchCryptoDad/bamboo-ta",
    "name": "bamboo-ta",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, pandas, numpy, trading, indicator, technical analysis",
    "author": "DutchCryptoDad (DCD)",
    "author_email": "<dutchcryptodad@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/17/d6/388594bbb5afb4a1c5f35fbc8931c56c51cd13ee8d77d5132d223f66acf1/bamboo-ta-0.9.6.tar.gz",
    "platform": null,
    "description": "# Bamboo-TA: Technical Analysis Indicators Library\n\n<p align=\"center\">\n  <a href=\"https://github.com/DutchCryptoDad/bamboo-ta\">\n    <img src=\"images/bamboo.png\" alt=\"Bamboo TA\" width=\"250\">\n  </a>\n</p>\n\n[![license](https://img.shields.io/github/license/DutchCryptoDad/bamboo-ta)](#license)\n[![Python Version](https://img.shields.io/pypi/pyversions/bamboo-ta?style=flat)](https://pypi.org/project/bamboo-ta/)\n[![PyPi Version](https://img.shields.io/pypi/v/bamboo-ta?style=flat)](https://pypi.org/project/bamboo-ta/)\n[![Package Status](https://img.shields.io/pypi/status/bamboo-ta?style=flat)](https://pypi.org/project/bamboo-ta/)\n[![Downloads](https://img.shields.io/pypi/dm/bamboo_ta?style=flat)](https://pypistats.org/packages/bamboo_ta)\n[![Stars](https://img.shields.io/github/stars/DutchCryptoDad/bamboo-ta?style=flat)](#stars)\n[![Forks](https://img.shields.io/github/forks/DutchCryptoDad/bamboo-ta?style=flat)](#forks)\n[![Used By](https://img.shields.io/badge/used_by-0-orange.svg?style=flat)](#usedby)\n[![Contributors](https://img.shields.io/github/contributors/DutchCryptoDad/bamboo-ta?style=flat)](#contributors)\n[![Issues](https://img.shields.io/github/issues-raw/DutchCryptoDad/bamboo-ta?style=flat)](#issues)\n[![Closed Issues](https://img.shields.io/github/issues-closed-raw/DutchCryptoDad/bamboo-ta?style=flat)](#closed-issues)\n[![Support me on Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Ddutchalgotrading%26type%3Dpatrons&style=flat)](https://patreon.com/dutchalgotrading)\n[![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UC-AOcefy1x7lTc17JiqaxqA)\n](https://www.youtube.com/@dutchalgotrading)\n[![YouTube Channel Views](https://img.shields.io/youtube/channel/views/UC-AOcefy1x7lTc17JiqaxqA)](https://www.youtube.com/@dutchalgotrading)\n\n---\n\n## About Bamboo-TA\n\n**Bamboo-TA** is a personal library that consolidates various Technical Analysis (TA) indicators into one simple and modular package for analyzing financial market data. It is designed to help traders develop trading strategies based on candlestick data.\n\nWhile this library includes popular TA indicators like **MACD**, **RSI**, **SMA**, **EMA**, it also provides lesser-known indicators like **Waddah Attar Explosion** and **Bollinger Bands Trend Indicator**. Bamboo-TA is complementary to other libraries like **TA-lib**, **Pandas-ta**, and **qtpylib**, and it is not intended to replace them.\n\nIf you're looking for a library to use for data analysis, backtesting, or integrating indicators into trading bots, Bamboo-TA is designed for simplicity and ease of use.\n\n---\n\n## Features\n\n- **Modular Indicators**: Includes a wide range of trend, volatility, momentum, performance, volume, and other types of indicators.\n- **Complementary to Other Libraries**: Works alongside popular TA libraries such as **TA-lib** and **Pandas-ta**.\n- **Focus on Algorithmic Trading**: Useful for developing custom algorithmic trading strategies with backtesting capabilities.\n- **Personal Project**: Built and maintained for personal use but shared with the community.\n\n---\n\n## Installation\n\n### Stable Version\n\nInstall the latest stable version directly from PyPi:\n\n```bash\npip install bamboo-ta\n```\n\n### Development Version\n\nTo install the bleeding-edge version from the GitHub repository:\n\n```bash\npip install -U git+https://github.com/DutchCryptoDad/bamboo-ta.git@development\n```\n\n## Usage\n\n### Importing the Library\n\nTo start using Bamboo-TA, import the library in your Python scripts or notebooks:\n\n```python\nimport bamboo_ta as bta\nimport pandas as pd\nimport numpy as np\n```\n\n### Preparing Data\n\nMake sure to format your `DataFrame` correctly, like this:\n\nBamboo-TA expects a pandas DataFrame with specific column names. Here's how to prepare your data:\n  \n```python\ndf = pd.read_json(\"./BTC_USDT-1d.json\")\ndf.columns = ['date', 'open', 'high', 'low', 'close', 'volume']\ndf['date'] = pd.to_datetime(df['date'], unit='ms')\n```\n  \n### Applying Indicators\n  \nYou can apply indicators in various ways. Here's how to use **Alligator Bands**:\n\nMost indicators in Bamboo-TA return a DataFrame with one or more columns. You can then add these columns to your original DataFrame. Here's an example using **Alligator Bands**:\n  \n```python\nalligator_result = bta.alligator_bands(df, 'close', 13, 8, 5, jaw_shift=8, teeth_shift=5, lips_shift=3)\ndf['jaw'] = alligator_result['jaw']\ndf['teeth'] = alligator_result['teeth']\ndf['lips'] = alligator_result['lips']\n```\n\nFor indicators that return a single value, you can simplify this:\n  \n```python\ndf['rsi'] = bta.relative_strength_index(df, column='close', period=14)['rsi']\n```\n  \n### Importing Individual Indicators\n  \nYou can also import and apply individual indicators. Here's how to the **Exponential Moving Average**::\n\nYou can also import individual indicators directly from their respective modules. When doing this, make sure to use the imported function name directly (not with the `bta.` prefix):\n  \n```python\nfrom bamboo_ta.trend import exponential_moving_average\n  \ndf['ema'] = bta.exponential_moving_average(df, \"close\", 21)\n# Use the imported function directly\nema_result = exponential_moving_average(df, \"close\", 21)\ndf['ema'] = ema_result['ema']\n```\n\n### Chaining Multiple Indicators\n\nYou can easily apply multiple indicators to your DataFrame:\n\n```python\n# Add RSI\ndf['rsi'] = bta.relative_strength_index(df, column='close', period=14)['rsi']\n\n# Add MACD\nmacd_result = bta.macd(df, 'close', 12, 26, 9)\ndf['macd'] = macd_result['macd']\ndf['macd_signal'] = macd_result['macd_signal']\ndf['macd_histogram'] = macd_result['macd_histogram']\n\n# Add Bollinger Bands\nbb_result = bta.bollinger_bands(df, 'close', 20, 2)\ndf['bb_upper'] = bb_result['upper']\ndf['bb_middle'] = bb_result['middle']\ndf['bb_lower'] = bb_result['lower']\n```\n\n### Accessing Indicator Documentation\n\nEach indicator in Bamboo-TA comes with comprehensive documentation that includes a description, parameters, usage examples, and more. You can access this documentation in several ways:\n\n#### Using the help() Function\n\nThe simplest way to access indicator documentation is to use Python's built-in `help()` function:\n\n```python\n# Get help for a specific indicator\nhelp(bta.macd_v)\nhelp(bta.relative_strength_index)\nhelp(bta.awesome_oscillator)\n```\n\nThis will display the indicator's docstring, which includes all the information you need to use it effectively.\n\n#### Accessing Docstrings Directly\n\nYou can also access the docstring directly:\n\n```python\n# Print the docstring for a specific indicator\nprint(bta.macd_v.__doc__)\n```\n\n#### Using the test_indicators.py Script\n\nWhen you run the `test_indicators.py` script, it automatically displays the indicator's documentation:\n\n```bash\npython test_indicators.py macd_v\n```\n\nThis will show the indicator description along with the test results.\n\n## Testing Indicators\n\nBamboo-TA includes a built-in testing system that allows you to quickly test any indicator in the library. This is useful for verifying that indicators are working correctly and producing the expected results, which you can compare with what you see on TradingView.\n\n### Test all indicators in one go\n\nUse the ``test_all_indicators.py`` script to test all the indicators in the module. Be warned, this test only works after all the requirements have been installed on the (virtual) system.\n\n### Using the test_indicators.py Script\n\nThe easiest way to test an indicator is to use the `test_indicators.py` script:\n\n```bash\npython test_indicators.py [indicator_name] [timeframe]\n```\n\nFor example:\n\n```bash\npython test_indicators.py relative_strength_index 1d\npython test_indicators.py awesome_oscillator 4h\npython test_indicators.py momentum_divergence 1h\n```\n\nThis will:\n\n1. Load the appropriate data file (e.g., BTC_USDT-1d.json or BTC_USDT-4h.json)\n2. Apply the indicator to the data\n3. Display the indicator description and the last 32 rows of data with the indicator values\n\n### Testing Individual Indicator Files\n\nEach indicator file also includes a `test()` function that can be run directly:\n\n```bash\npython -m bamboo_ta.momentum.relative_strength_index\n```\n\nThis will run the test function in the indicator file, which uses the generic `test_indicator` function.\n\n### Using the test_indicator Function Directly\n\nYou can also use the `test_indicator` function directly in your code:\n\n```python\nimport bamboo_ta.bamboo_ta as bta\nfrom bamboo_ta.momentum import relative_strength_index\n\nbta.test_indicator(relative_strength_index)\n```\n\nThis gives you more flexibility to test indicators with custom parameters.\n\n## Indicator Categories\n\nBamboo-TA includes a wide range of technical analysis indicators organized into the following categories:\n\n### Candles\n\nIndicators for candlestick pattern analysis and transformations:\n\n- Candlestick Patterns\n- Dynamic Exhaustion Bars\n- Exhaustion Bars\n- Hansen Heiken Ashi\n- Heiken Ashi\n- Linear Regression Candles\n- Smoothed Heiken Ashi\n\n### Cycles\n\nIndicators for analyzing market cycles:\n\n- Even Better Sinewave\n\n### Momentum\n\nIndicators that measure the rate of change in price movements:\n\n- Absolute Price Oscillator\n- Awesome Oscillator\n- Balance Of Power\n- Bias\n- Brar\n- Calculate Intraday Momentum Index\n- Center Of Gravity\n- Chande Forecast Oscillator\n- Chande Momentum Oscillator\n- Commodity Channel Index\n- Coppock Curve\n- Correlation Trend Indicator\n- Directional Movement\n- Efficiency Ratio\n- Ehlers Fisher Stochastic Center Of Gravity\n- Ehlers Ray Index\n- Elliott Wave Oscillator\n- Fisher Transform\n- Inertia\n- Kaufmans Adaptive Moving Average\n- Kdj\n- Know Sure Thing\n- Ma Streak\n- Momentum\n- Momentum Divergence\n- Moving Average Convergence Divergence\n- Moving Average Convergence Divergence Leader\n- Moving Average Convergence Divergence V\n- Percentage Price Oscillator\n- Percentage Volume Oscillator\n- Pretty Good Oscillator\n- Psychological Line\n- Qualitative Quantitative Estimation\n- Rate Of Change\n- Relative Momentum Index\n- Relative Strength Index\n- Relative Strength Index Exponential\n- Relative Vigor Index\n- Schaff Trend Cycle\n- Smi Ergodic Indicator\n- Smoothed Rate Of Change\n- Stochastic Momentum Index\n- Stochastic Rsi\n- Stochastics Oscillator\n- Td Sequential\n- Triple Exponential Average\n- True Strength Index\n- Ttm Squeeze\n- Ultimate Oscillator\n- Waddah Attar Explosion\n- Waddah Attar Explosion Atr\n- Wave Trend\n- Wave Trend Oscillator\n- Williams R\n\n### Performance\n\n*Note: This category is currently under development.*\n\n\n### Statistics\n\n*Note: This category is currently under development.*\n\n\n### Trend\n\nIndicators that help identify the direction of market trends:\n\n- Alligator Bands\n- Archer Moving Averages Trends\n- Arnaud Legoux Moving Average\n- Aroon\n- Average Directional Index\n- Bollinger Trend\n- Bollinger Trend Fast With Ma\n- Breakouts\n- Chande Kroll Stop\n- Choppiness Index\n- Cross Signals\n- Decay\n- Decreasing\n- Detrended Price Oscillator\n- Double Exponential Moving Average\n- Exponential Moving Average\n- Fractal Weighted Moving Average\n- Gaussian Channel\n- Holt Winters Moving Average\n- Hull Moving Average\n- Increasing\n- Jurik Moving Average\n- Least Squares Moving Average\n- Long Run\n- Mcginley Dynamic\n- Parabolic Sar\n- Pascals Weighted Moving Average\n- Percent Price Channel\n- Pmax\n- Price Channel\n- Q Stick\n- Range Filter\n- Rolling Moving Average\n- Sequential Weighted Moving Average\n- Short Run\n- Simple Moving Average\n- Sine Weighted Moving Average\n- Ssl Channels\n- Ssl Channels Atr\n- Supertrend\n- T3 Average\n- Trend Signals\n- Triangular Moving Average\n- Triple Exponential Moving Average\n- Ttm Trend\n- Ut Bot\n- Variable Index Dynamic Average\n- Vertical Horizontal Filter\n- Volumatic Variable Index Dynamic Average\n- Volume Weighted Moving Average\n- Vortex Indicator\n- Weighted Moving Average\n- Zero Exponential Moving Average\n- Zero Lag Exponential Moving Average\n\n### Utility\n\nUtility functions and indicators for various calculations:\n\n- Calculate Atr Stop Loss Take Profit\n- Calculate Stop Loss Take Profit\n- Compounded Annual Growth Rate\n- Consecutive Count\n- Consecutive Higher Highs\n- Consecutive Lower Lows\n- Cross\n- Cross Value\n- Cumulative Return\n- Daily Log Return\n- Daily Return\n- Drawdown\n- Drop Na\n- Entropy\n- Error Function\n- Exhaustion Candles\n- Exhaustion Lengths\n- Filter By Dates\n- First Crossed Above Second\n- First Crossed Below Second\n- Geometric Mean\n- Get Min Max\n- Indicator Mixin\n- Is Above\n- Is Above Value\n- Is Below\n- Is Below Value\n- Kurtosis\n- Linear Decay\n- Linear Growth\n- Linear Regression Slope\n- Log Geometric Mean\n- Log Return\n- Mean Absolute Deviation\n- Median\n- Month To Date\n- Overbought Oversold\n- Pascals Triangle\n- Percent Return\n- Populate Leledc Major Minor\n- Pump Dump Protection\n- Quantile\n- Quarter To Date\n- Regression Slope\n- Same Length\n- Sharpe Ratio\n- Skew\n- St Dev\n- Symmetric Triangle\n- Top Percent Change\n- Tos Standard Deviation All\n- Variance\n- Year To Date\n- Z Score\n\n### Volatility\n\nIndicators that measure the rate and magnitude of price changes:\n\n- Aberration Bands\n- Acceleration Bands\n- Average True Range\n- Bbw Expansion\n- Bollinger Bands\n- Donchian Channel\n- Hurst Winter Channel\n- Keltner Channel\n- Mass Index\n- Normalized Average True Range\n- Percentage Distance\n- Relative Volatility Index\n- Thermometer\n- True Range\n- Ulcer Index\n- Williams Vix Fix\n\n### Volume\n\nIndicators that incorporate trading volume to confirm price movements:\n\n- Accumulation Distribution Index\n- Accumulation Distribution Oscillator\n- Accumulation On Balance Volume\n- Chaikin Money Flow\n- Ease Of Movement\n- Force Index\n- Klinger Volume Oscillator\n- Money Flow Index\n- Negative Volume Index\n- On Balance Volume\n- On Balance Volume Oscillator\n- Positive Volume Index\n- Price Volume\n- Price Volume Rank\n- Price Volume Trend\n- Relative Volume\n- Time Relative Volume Oscillator\n- Volume Profile\n- Volume Weighted Average Price\n- Volume Weighted Average Price Bands\n\nTo access detailed documentation for any indicator, use the `help()` function or access the docstring directly as described in the [Accessing Indicator Documentation](#accessing-indicator-documentation) section.\n\nOr read [the indicator documentation page](documentation/indicators.md) for all the indicators on one page.\n\n## Social & Community\n\n- **YouTube**: Check out my [YouTube channel](https://www.youtube.com/@dutchalgotrading) for tutorials on [Freqtrade](https://www.youtube.com/watch?v=VHvikJmQrVM), [Tradingview](https://www.youtube.com/watch?v=aQSC-W8oYdw), and tested [trading strategies](https://www.youtube.com/watch?v=Jj9MSzHwa44).\n- **Patreon**: For exclusive trading algorithms, backtests, and strategy codes, support me on [Patreon](https://www.patreon.com/dutchalgotrading).\n- **Strategy League**: View the results of my tested strategies at [DutchAlgoTrading.com](https://www.dutchalgotrading.com).\n\n## Support & Donations\n\nIf you find Bamboo-TA useful, consider supporting the project:\n\n- **Patreon**: Support via [Patreon](https://www.patreon.com/dutchalgotrading).\n- **Ko-fi**: Make a one-time donation on [Ko-fi](https://ko-fi.com/dutchcryptodad).\n\n### Affiliates\n\n- [Bybit Rewards](https://partner.bybit.com/b/dutchalgo)\n- [Linode $100 Credit](https://bit.ly/Linode_Advantages)\n- [TradingView Discount](https://www.tradingview.com/?aff_id=139223)\n- [Saxo Bank (Dutch Only)](https://refer.saxo/fKnth)\n\n## Disclaimer\n\nBamboo-TA is a personal project, and while I make every effort to ensure accuracy, I cannot guarantee the functionality of the indicators. They are tested against Binance (BTC/USDT) data and compared with similar indicators on [TradingView](https://www.tradingview.com/?aff_id=139223).\n\nI personally use these indicators to build my own trading strategies, for backtesting and manual & bot trading using the [Freqtrade trading bot](https://www.youtube.com/watch?v=VHvikJmQrVM&list=PL8gq8aFDPpbNEx4lUvpmRjxtCkjvX-Jpg). So it is in my own personal best interest to make these indicators work as accurately as possible.\n\nSuggestions and bug reports are welcome, but fixes will be handled on a best-effort basis. Please be patient!\n\n## Indicator sources\n\n- [ThinkOrSwim Tech indicators](https://tlc.thinkorswim.com/center/reference/Tech-Indicators)\n- [Legendary TA](https://github.com/just-nilux/legendary_ta)\n- [CryptoFrog Custom Indicators](https://github.com/froggleston/cryptofrog-strategies/blob/main/custom_indicators.py)\n- [Linnsoft](https://www.linnsoft.com/techind/accumulation-distribution)\n- [Profitspi](https://www.profitspi.com/stock/view.aspx?v=stock-chart-library)\n- [Cybernetic Analysis](https://www.neuroshell.com/manuals/cyber/index.html)\n- [TRradeStation](https://help.tradestation.com/10_00/eng/tradestationhelp/elanalysis/indicator/price_channel__percent_pc_indicator_.htm)\n- [Sierra Chart](https://www.sierrachart.com/index.php?page=doc/TechnicalStudiesReference.php)\n- [qtpylib](https://github.com/ranaroussi/qtpylib/blob/main/qtpylib/indicators.py)\n\n## Creating the Python pip package (personal notes)\n\nAfter creating and testing the code, make a Python pip package as follows:\n\nUpdate the file ``setup.py`` and update version number.\n\nIn the library folder, create the package\n\n``python3 setup.py sdist bdist_wheel``\n\nBefore uploading the package to Pypi it is wise to test the package on your system.\n\nLoad the package to the system with:\n\n``pip install .``\n\nAfter you've checked that everything is working correctly, then use the following command to upload to Pypi.\nYou'll have to install twine for this (``pip install twine`` or ``sudo apt install twine``)\n\nWhen you get the error:\n\n```\nImportError: cannot import name 'appengine' from 'requests.packages.urllib3.contrib' (/home/user/.local/lib/python3.10/site-packages/urllib3/contrib/__init__.py)\n```\n\nYou should do a ``pip install --upgrade twine requests-toolbelt``.\n\n### Before uploading\n\n```\n# Check first\n\ntwine check dist/*\n\n# Test upload first\n\ntwine upload -r testpypi dist/*\n\n# Upload to Pypi\n\ntwine upload dist/*\n```\n\nNote: uploading new versions requires to delete the older versions from the /dist folder.\n\nAnother option is to use the ``--skip-existing`` option like this:\n\n```\n# Testpypi\ntwine upload -r testpypi dist/* --skip-existing \n\n# ProductionPypi\ntwine upload -r pypi dist/* --skip-existing\n```\n\n### Uploading with 2FA enabled\n\nFirst create an API token (at <https://test.pypi.org/manage/account/token/>).\n\nCreate a file .pypirc in your home folder (e.g. ``nano $HOME/.pypirc``)\n\nAdd the given token to the file like this:\n\n```\n[testpypi]\n  username = __token__\n  password =\npypi-AgENdGVzdC5weXtMjBjOS00ZjgxLWIyZDMtYWViMDAwOTk3MWZmAAIqWzMsImU3YjkzMGVmLWQzMGItNGFhYi1iNB6NZ-rSrzc8UXHRmWp5fzZwP\n\n\n[pypi]\n  username = __token__\n  password =\npypi-AgEIcHlwaS5vcmcCJDgxYWFiYjYwLTMxYmUtNDczZC1hNjBhLTU0MDJhNmQ2NmZhMgAQ3NTAtOGVkNy0xN2U0NmU0MjEzMQFAYWNj0FcsP-Slnj9-wkEWWwQXkaw\n```\n\nSave the file and reload environment if necessary.\n\nNow you an upload libraries without having to use the password.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "TA library for Pandas",
    "version": "0.9.6",
    "project_urls": {
        "Homepage": "https://github.com/DutchCryptoDad/bamboo-ta"
    },
    "split_keywords": [
        "python",
        " pandas",
        " numpy",
        " trading",
        " indicator",
        " technical analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3339579b93161108fb478a7392630eb761bc1e843abeac6818c6929a2bcaaeb9",
                "md5": "cf2fa86b6399a6ea066cbf934b4f1b2b",
                "sha256": "999ba227d49d8c6c7ecaae31cc87a7ca760c5d975634199df4ead0c25a46ddc2"
            },
            "downloads": -1,
            "filename": "bamboo_ta-0.9.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cf2fa86b6399a6ea066cbf934b4f1b2b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 404468,
            "upload_time": "2025-07-01T09:10:12",
            "upload_time_iso_8601": "2025-07-01T09:10:12.409023Z",
            "url": "https://files.pythonhosted.org/packages/33/39/579b93161108fb478a7392630eb761bc1e843abeac6818c6929a2bcaaeb9/bamboo_ta-0.9.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17d6388594bbb5afb4a1c5f35fbc8931c56c51cd13ee8d77d5132d223f66acf1",
                "md5": "c41e9f5389076ddd4603c9d30ee29444",
                "sha256": "c6eea69dc19971402a1eb7c6ef5b22c09ea21ac3499376a8d5560a236e905dec"
            },
            "downloads": -1,
            "filename": "bamboo-ta-0.9.6.tar.gz",
            "has_sig": false,
            "md5_digest": "c41e9f5389076ddd4603c9d30ee29444",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 193453,
            "upload_time": "2025-07-01T09:10:13",
            "upload_time_iso_8601": "2025-07-01T09:10:13.895654Z",
            "url": "https://files.pythonhosted.org/packages/17/d6/388594bbb5afb4a1c5f35fbc8931c56c51cd13ee8d77d5132d223f66acf1/bamboo-ta-0.9.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-01 09:10:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DutchCryptoDad",
    "github_project": "bamboo-ta",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "ta",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "pandas_ta",
            "specs": []
        },
        {
            "name": "scipy",
            "specs": []
        }
    ],
    "lcname": "bamboo-ta"
}
        
Elapsed time: 0.43221s