bamboo-ta


Namebamboo-ta JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/DutchCryptoDad/bamboo-ta
SummaryTA library for Pandas
upload_time2023-10-27 08:02:59
maintainer
docs_urlNone
authorDutchCryptoDad (DCD)
requires_python
license
keywords python pandas numpy trading indicator technical analysis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # bamboo-ta

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


A library with technical analysis indicators for trading. Especially made for use with Pandas dataframes.

[![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)


## 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``

## Using the library

Import the library into your Python scripts or Notebook as follows:

``import bamboo_ta as bta``

After this, you can use the libraries technical indicators with:

``df['lsma'] = bta.calculate_lsma(df, 14)``

Example script:

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

# create dataframe and read the json data in the datasets directory
df = pd.read_json("./testdata/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'))

print(df)  # This command outputs the dataframe

# Using the pandas_ta library
df['imi_ema'] = pta.ema(close=df['close'], length=7)

df['lsma'] = bta.calculate_lsma(df, 14)  # Using the bamboo_ta library

print(df)
```

Output:

```
 /dev
➜  python test.py 
           date      open      high       low     close         volume
0    2017-08-17   4261.48   4485.39   4200.74   4285.08     795.150377
1    2017-08-18   4285.08   4371.52   3938.77   4108.37    1199.888264
2    2017-08-19   4108.37   4184.69   3850.00   4139.98     381.309763
3    2017-08-20   4120.98   4211.08   4032.62   4086.29     467.083022
4    2017-08-21   4069.13   4119.62   3911.79   4016.00     691.743060
...         ...       ...       ...       ...       ...            ...
1967 2023-01-05  16850.36  16879.82  16753.00  16831.85  163473.566410
1968 2023-01-06  16831.85  17041.00  16679.00  16950.65  207401.284150
1969 2023-01-07  16950.31  16981.91  16908.00  16943.57  104526.568800
1970 2023-01-08  16943.83  17176.99  16911.00  17127.83  135155.896950
1971 2023-01-09  17127.83  17398.80  17104.66  17178.26  266211.527230

[1972 rows x 6 columns]
           date      open      high       low     close         volume       imi_ema          lsma
0    2017-08-17   4261.48   4485.39   4200.74   4285.08     795.150377           NaN           NaN
1    2017-08-18   4285.08   4371.52   3938.77   4108.37    1199.888264           NaN           NaN
2    2017-08-19   4108.37   4184.69   3850.00   4139.98     381.309763           NaN           NaN
3    2017-08-20   4120.98   4211.08   4032.62   4086.29     467.083022           NaN           NaN
4    2017-08-21   4069.13   4119.62   3911.79   4016.00     691.743060           NaN           NaN
...         ...       ...       ...       ...       ...            ...           ...           ...
1967 2023-01-05  16850.36  16879.82  16753.00  16831.85  163473.566410  16737.537534  16633.800286
1968 2023-01-06  16831.85  17041.00  16679.00  16950.65  207401.284150  16790.815651  16678.202286
1969 2023-01-07  16950.31  16981.91  16908.00  16943.57  104526.568800  16829.004238  16746.722286
1970 2023-01-08  16943.83  17176.99  16911.00  17127.83  135155.896950  16903.710678  16816.734571
1971 2023-01-09  17127.83  17398.80  17104.66  17178.26  266211.527230  16972.348009  16930.485143

[1972 rows x 8 columns]
```


## Creating the Python pip package (personal notes)

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

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 worknig 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``).

```
# 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:

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

### 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-AgENdalaljdljhdalkHTaddsdSQtMjBjOS00ZjgxLWIyZDMtYWViMDAwOTk3MWZmAAIqWzMsImU3YjkzMGVmLWQzMFmZkZCJdAAAGIB6NZ-rSrzc8UXj38ijwCRmZwkFLnhhNP
```

Save the file and reload environment if necessary.

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

## Other sources

* [ThinkOrSwim Tech indicators](https://tlc.thinkorswim.com/center/reference/Tech-Indicators)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DutchCryptoDad/bamboo-ta",
    "name": "bamboo-ta",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,pandas,numpy,trading,indicator,technical analysis",
    "author": "DutchCryptoDad (DCD)",
    "author_email": "<dutchcryptodad@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/26/65/6d15a098271cff3b0de461052638f698a36f07c6115a1796b90d62830a0d/bamboo-ta-0.0.3.tar.gz",
    "platform": null,
    "description": "# bamboo-ta\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\nA library with technical analysis indicators for trading. Especially made for use with Pandas dataframes.\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## Installation\n\n### Stable version\n\nInstall bamboo-ta from Pypi with:\n\n``pip install bamboo-ta``\n\nOr you can install this directly from the Github repository with the following command:\n\n``$ pip install -U git+https://github.com/DutchCryptoDad/bamboo-ta``\n\n### Development version\n\nThe bleeding edge development version can be installed with:\n\n``$ pip install -U git+https://github.com/DutchCryptoDad/bamboo-ta.git@development``\n\n## Using the library\n\nImport the library into your Python scripts or Notebook as follows:\n\n``import bamboo_ta as bta``\n\nAfter this, you can use the libraries technical indicators with:\n\n``df['lsma'] = bta.calculate_lsma(df, 14)``\n\nExample script:\n\n```\n# -*- coding: utf-8 -*-\n# Import necessary libraries\nimport pandas_ta as pta\nimport bamboo_ta as bta\nimport pandas as pd\nfrom pandas import DataFrame\nimport numpy as np\n\n# create dataframe and read the json data in the datasets directory\ndf = pd.read_json(\"./testdata/BTC_USDT-1d.json\")\n# name the columns that are loaded into the dataframe\ndf.columns = ['date', 'open', 'high', 'low', 'close', 'volume']\n# the date column consists of unix time in milliseconds, so this command changes this data into human readable form.\ndf['date'] = (pd.to_datetime(df['date'], unit='ms'))\n\nprint(df)  # This command outputs the dataframe\n\n# Using the pandas_ta library\ndf['imi_ema'] = pta.ema(close=df['close'], length=7)\n\ndf['lsma'] = bta.calculate_lsma(df, 14)  # Using the bamboo_ta library\n\nprint(df)\n```\n\nOutput:\n\n```\n\ueb06 /dev\n\u279c  python test.py \n           date      open      high       low     close         volume\n0    2017-08-17   4261.48   4485.39   4200.74   4285.08     795.150377\n1    2017-08-18   4285.08   4371.52   3938.77   4108.37    1199.888264\n2    2017-08-19   4108.37   4184.69   3850.00   4139.98     381.309763\n3    2017-08-20   4120.98   4211.08   4032.62   4086.29     467.083022\n4    2017-08-21   4069.13   4119.62   3911.79   4016.00     691.743060\n...         ...       ...       ...       ...       ...            ...\n1967 2023-01-05  16850.36  16879.82  16753.00  16831.85  163473.566410\n1968 2023-01-06  16831.85  17041.00  16679.00  16950.65  207401.284150\n1969 2023-01-07  16950.31  16981.91  16908.00  16943.57  104526.568800\n1970 2023-01-08  16943.83  17176.99  16911.00  17127.83  135155.896950\n1971 2023-01-09  17127.83  17398.80  17104.66  17178.26  266211.527230\n\n[1972 rows x 6 columns]\n           date      open      high       low     close         volume       imi_ema          lsma\n0    2017-08-17   4261.48   4485.39   4200.74   4285.08     795.150377           NaN           NaN\n1    2017-08-18   4285.08   4371.52   3938.77   4108.37    1199.888264           NaN           NaN\n2    2017-08-19   4108.37   4184.69   3850.00   4139.98     381.309763           NaN           NaN\n3    2017-08-20   4120.98   4211.08   4032.62   4086.29     467.083022           NaN           NaN\n4    2017-08-21   4069.13   4119.62   3911.79   4016.00     691.743060           NaN           NaN\n...         ...       ...       ...       ...       ...            ...           ...           ...\n1967 2023-01-05  16850.36  16879.82  16753.00  16831.85  163473.566410  16737.537534  16633.800286\n1968 2023-01-06  16831.85  17041.00  16679.00  16950.65  207401.284150  16790.815651  16678.202286\n1969 2023-01-07  16950.31  16981.91  16908.00  16943.57  104526.568800  16829.004238  16746.722286\n1970 2023-01-08  16943.83  17176.99  16911.00  17127.83  135155.896950  16903.710678  16816.734571\n1971 2023-01-09  17127.83  17398.80  17104.66  17178.26  266211.527230  16972.348009  16930.485143\n\n[1972 rows x 8 columns]\n```\n\n\n## Creating the Python pip package (personal notes)\n\nAfter creating and testing the code, make a Python pip package as follows:\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 worknig 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\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```\ntwine upload -r --skip-existing testpypi dist/*\ntwine upload --skip-existing dist/*\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 = pypi-AgENdalaljdljhdalkHTaddsdSQtMjBjOS00ZjgxLWIyZDMtYWViMDAwOTk3MWZmAAIqWzMsImU3YjkzMGVmLWQzMFmZkZCJdAAAGIB6NZ-rSrzc8UXj38ijwCRmZwkFLnhhNP\n```\n\nSave the file and reload environment if necessary.\n\nNow you an upload libraries without having to use the password.\n\n## Other sources\n\n* [ThinkOrSwim Tech indicators](https://tlc.thinkorswim.com/center/reference/Tech-Indicators)\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "TA library for Pandas",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/DutchCryptoDad/bamboo-ta"
    },
    "split_keywords": [
        "python",
        "pandas",
        "numpy",
        "trading",
        "indicator",
        "technical analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4073b05bd59d3ed6937d514d94d2b2d193be11a653da5e960781cff1fd73c56",
                "md5": "fd4bd12a51bbfd1b90d972f7d2a1f21b",
                "sha256": "5e68d272d86d13a4e00d1306aff080b2ada644073e49a4f8b07c444ef14f4fa2"
            },
            "downloads": -1,
            "filename": "bamboo_ta-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fd4bd12a51bbfd1b90d972f7d2a1f21b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12524,
            "upload_time": "2023-10-27T08:02:56",
            "upload_time_iso_8601": "2023-10-27T08:02:56.449234Z",
            "url": "https://files.pythonhosted.org/packages/e4/07/3b05bd59d3ed6937d514d94d2b2d193be11a653da5e960781cff1fd73c56/bamboo_ta-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "26656d15a098271cff3b0de461052638f698a36f07c6115a1796b90d62830a0d",
                "md5": "04ac739346abb5fa9a2f0c0815c25a52",
                "sha256": "f7b8bda961f69750bccd687e8f44fe9a514197fad8a4af2ec7ff0dd8388b8604"
            },
            "downloads": -1,
            "filename": "bamboo-ta-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "04ac739346abb5fa9a2f0c0815c25a52",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12605,
            "upload_time": "2023-10-27T08:02:59",
            "upload_time_iso_8601": "2023-10-27T08:02:59.057969Z",
            "url": "https://files.pythonhosted.org/packages/26/65/6d15a098271cff3b0de461052638f698a36f07c6115a1796b90d62830a0d/bamboo-ta-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-27 08:02:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DutchCryptoDad",
    "github_project": "bamboo-ta",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "bamboo-ta"
}
        
Elapsed time: 0.12866s