├── .circleci └── config.yml ├── .coveragerc ├── .coveralls.yml ├── .github └── FUNDING.yml ├── .gitignore ├── .prospector.yaml ├── LICENSE ├── MANIFEST ├── Makefile ├── README.md ├── RELEASE.md ├── docs ├── Makefile ├── conf.py ├── index.rst ├── make.bat └── ta.rst ├── examples_to_use ├── all_features_example.py ├── bollinger_band_features_example.py ├── roc.py ├── visualize_features.ipynb └── volume_features_example.py ├── pylintrc ├── requirements-core.txt ├── requirements-coverage.txt ├── requirements-doc.txt ├── requirements-play.txt ├── requirements-test.txt ├── requirements.txt ├── setup.cfg ├── setup.py ├── static ├── figure.png ├── logo_neuroons_byOS_blue.png └── logo_neuroons_byOS_white.png ├── ta ├── __init__.py ├── momentum.py ├── others.py ├── trend.py ├── utils.py ├── volatility.py ├── volume.py └── wrapper.py └── test ├── __init__.py ├── data ├── cs-accum.csv ├── cs-adx.csv ├── cs-atr.csv ├── cs-atr2.csv ├── cs-bbands.csv ├── cs-cci.csv ├── cs-dc.csv ├── cs-dc2.csv ├── cs-easeofmovement.csv ├── cs-fi.csv ├── cs-kama.csv ├── cs-kc.csv ├── cs-macd.csv ├── cs-mfi.csv ├── cs-obv.csv ├── cs-percentr.csv ├── cs-ppo.csv ├── cs-psar.csv ├── cs-pvo.csv ├── cs-roc.csv ├── cs-rsi.csv ├── cs-soo.csv ├── cs-stc.csv ├── cs-stochrsi.csv ├── cs-tsi.csv ├── cs-ui.csv ├── cs-ultosc.csv ├── cs-vortex.csv ├── cs-vpt.csv ├── cs-vwap.csv ├── cs-wma.csv └── datas.csv ├── integration └── wrapper.py └── unit ├── momentum.py ├── trend.py ├── volatility.py └── volume.py /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | jobs: 4 | test_py36: &test-template # See https://discuss.circleci.com/t/run-tests-on-multiple-versions-of-python/15462/2 5 | docker: 6 | - image: circleci/python:3.6 7 | working_directory: ~/ta 8 | steps: 9 | - checkout 10 | - run: 11 | name: Install dependencies 12 | command: | 13 | pip install --upgrade pip 14 | python3 -m venv venv 15 | . venv/bin/activate 16 | pip install --upgrade pip 17 | pip install -r requirements-test.txt 18 | - run: 19 | name: Run linter 20 | command: | 21 | . venv/bin/activate 22 | pycodestyle --max-line-length=119 ta && isort --check-only --recursive ta 23 | - run: 24 | name: Run test 25 | command: | 26 | . venv/bin/activate 27 | python -m unittest discover 28 | 29 | test_py35: 30 | <<: *test-template 31 | docker: 32 | - image: circleci/python:3.5 33 | 34 | test_py37: 35 | <<: *test-template 36 | docker: 37 | - image: circleci/python:3.7 38 | 39 | test_py38: 40 | <<: *test-template 41 | docker: 42 | - image: circleci/python:3.8 43 | 44 | coverage: 45 | docker: 46 | - image: circleci/python:3.7 47 | working_directory: ~/ta 48 | steps: 49 | - checkout 50 | - run: 51 | name: Install dependencies 52 | command: | 53 | pip install --upgrade pip 54 | python3 -m venv venv 55 | . venv/bin/activate 56 | sudo pip install -r requirements-coverage.txt 57 | - run: 58 | name: Run coverage 59 | command: | 60 | coverage run -m unittest discover 61 | coverage report -m 62 | - run: 63 | name: Publish coverage 64 | command: | 65 | export COVERALLS_REPO_TOKEN=ec4rvBLjmegWPIejLkGXntb92iyWF7tnR 66 | coveralls 67 | 68 | doc: 69 | docker: 70 | - image: circleci/python:3.7 71 | working_directory: ~/ta 72 | steps: 73 | - checkout 74 | - run: 75 | name: Install dependencies 76 | command: | 77 | pip install --upgrade pip 78 | python3 -m venv venv 79 | . venv/bin/activate 80 | sudo pip install -r requirements-doc.txt 81 | - run: 82 | name: Build documentation 83 | command: | 84 | cd docs 85 | make html 86 | 87 | workflows: 88 | version: 2 89 | build: 90 | jobs: 91 | - test_py36 92 | # - test_py38 # not working yet 93 | # - test_py37 94 | # - test_py35 95 | - coverage 96 | - doc 97 | 98 | 99 | ########################################### 100 | # Testing CircleCI in local 101 | ########################################### 102 | # circleci local execute --job test_py36 103 | # circleci local execute --job test_py37 104 | # circleci local execute --job test_py38 105 | # circleci local execute --job test_py35 106 | # circleci local execute --job coverage 107 | # circleci local execute --job doc 108 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = ta 4 | -------------------------------------------------------------------------------- /.coveralls.yml: -------------------------------------------------------------------------------- 1 | repo_token: ec4rvBLjmegWPIejLkGXntb92iyWF7tnR 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [bukosabino] 2 | tidelift: pypi/ta 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | .DS_Store 10 | 11 | # Distribution / packaging 12 | .Python 13 | env/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | wheels/ 26 | *.egg-info/ 27 | .installed.cfg 28 | *.egg 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | .hypothesis/ 50 | 51 | # Translations 52 | *.mo 53 | *.pot 54 | 55 | # Django stuff: 56 | *.log 57 | local_settings.py 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # dotenv 85 | .env 86 | 87 | # virtualenv 88 | .venv 89 | venv/ 90 | ENV/ 91 | env/** 92 | env* 93 | 94 | # Spyder project settings 95 | .spyderproject 96 | .spyproject 97 | 98 | # Rope project settings 99 | .ropeproject 100 | 101 | # mkdocs documentation 102 | /site 103 | 104 | # mypy 105 | .mypy_cache/ 106 | 107 | # vscode settings 108 | .vscode/** 109 | 110 | # Original Source (Dev) 111 | ta/_wrapper.py 112 | -------------------------------------------------------------------------------- /.prospector.yaml: -------------------------------------------------------------------------------- 1 | output-format: grouped 2 | 3 | strictness: veryhigh 4 | doc-warnings: true 5 | test-warnings: true 6 | max-line-length: 120 7 | 8 | mypy: 9 | run: true 10 | options: 11 | ignore-missing-imports: true 12 | 13 | bandit: 14 | run: true 15 | 16 | pep8: 17 | disable: 18 | - E203 19 | 20 | pep257: 21 | run: false 22 | disable: 23 | - D213 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2020 Darío López Padial (Bukosabino) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | # file GENERATED by distutils, do NOT edit 2 | setup.cfg 3 | setup.py 4 | ta/__init__.py 5 | ta/momentum.py 6 | ta/others.py 7 | ta/trend.py 8 | ta/utils.py 9 | ta/volatility.py 10 | ta/volume.py 11 | ta/wrapper.py 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | init: 2 | pip install -r requirements.txt 3 | 4 | isort: 5 | isort --check-only --recursive ta test 6 | 7 | format: isort 8 | black --target-version py36 ta test 9 | 10 | isort-fix: 11 | isort --recursive ta test 12 | 13 | lint: isort 14 | prospector --no-autodetect test/ 15 | prospector --no-autodetect ta/ 16 | 17 | test: lint 18 | coverage run -m unittest discover 19 | coverage report -m 20 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | | Date | Version | Comment | 2 | |------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 3 | | 2023/11/02 | 0.11.0 | Fixing Volume Price Trend indicator [PR](https://github.com/bukosabino/ta/pull/311) | 4 | | 2023/10/29 | 0.10.3 | Fixing Aroon indicator [PR](https://github.com/bukosabino/ta/pull/316); Fixing future warnings; Improving documentation [PR](https://github.com/bukosabino/ta/pull/318); Fix future data leakage [PR](https://github.com/bukosabino/ta/pull/324) | 5 | | 2022/08/23 | 0.10.2 | Fixing bug on KAMA indicator https://github.com/bukosabino/ta/pull/303 | 6 | | 2022/04/16 | 0.10.1 | Fixing future warning https://github.com/bukosabino/ta/pull/293 | 7 | | 2022/04/16 | 0.10.0 | Customize Keltner Channel ATRs multiplier | 8 | | 2022/01/09 | 0.9.0 | Fixing wrong name version | 9 | | 2022/01/09 | 0.8.2 | Bumping pandas and numpy because of a external vulnerability issue | 10 | | 2022/01/09 | 0.8.1 | Fixing bug on name columns (PVO - PPO) | 11 | | 2021/11/18 | 0.8.0 | Add option to get just the most efficient indicators (vectorized), also solved some security dependency | 12 | | 2020/11/27 | 0.7.0 | Cleaning code (prospector, black) https://github.com/bukosabino/ta/pull/209 | 13 | | 2020/11/17 | 0.6.1 | Fixing Wrapper https://github.com/bukosabino/ta/pull/204 | 14 | | 2020/11/09 | 0.6.0 | Adding new indicators (Ulcer Index, Weighted Moving Average, Schaff Trend Cycle, Stochastic RSI, Percentage Price Oscillator, Percentage Volume Oscillator) https://github.com/bukosabino/ta/pull/167; Update wrapper https://github.com/bukosabino/ta/pull/166 | 15 | | 2020/05/12 | 0.5.25 | fixing bug: min_periods when fillna=False https://github.com/bukosabino/ta/pull/158 | 16 | | 2020/05/11 | 0.5.24 | Adding extra methods for IchimokuIndicator https://github.com/bukosabino/ta/pull/156 | 17 | | 2020/05/10 | 0.5.23 | Fixing bug when dataset with timestamp as index https://github.com/bukosabino/ta/pull/154 | 18 | | 2020/05/04 | 0.5.22 | 1. Keltner Channel: adding tests; adding n atr input parametr; fixing some minor bug; adding unittests for adx https://github.com/bukosabino/ta/pull/148 | 19 | | | | 2. Refactor tests code and speed up the tests https://github.com/bukosabino/ta/pull/149 | 20 | | | | 3. Refactor tests code https://github.com/bukosabino/ta/pull/150 | 21 | | | | 4. Donchian Channel: Fixing bug https://github.com/bukosabino/ta/pull/151 | 22 | | 2020/05/03 | 0.5.21 | Donchian Channel: adding tests; adding some useful functions; fixing some minor bug https://github.com/bukosabino/ta/pull/147 https://github.com/bukosabino/ta/issues/133 | 23 | | 2020/04/20 | 0.5.20 | remove fstring compatibility for python versions < 3.6 | 24 | | 2020/04/20 | 0.5.19 | adding fstring compatibility for python versions < 3.6 https://github.com/bukosabino/ta/pull/141 | 25 | | 2020/04/16 | 0.5.18 | Adding VWAP indicator https://github.com/bukosabino/ta/issues/130 | 26 | | 2020/03/29 | 0.5.17 | Keltner Channels improvements and adding SMA Indicator https://github.com/bukosabino/ta/pull/135 | 27 | | 2020/03/21 | 0.5.15 | Keltner Channels improvements and volume indicators isolation. Based on: https://github.com/bukosabino/ta/pull/131 | 28 | | 2020/03/12 | 0.5.13 | fixing bug: hard-coded values. Based on: https://github.com/bukosabino/ta/issues/114 and https://github.com/bukosabino/ta/issues/115 | 29 | | 2020/03/11 | 0.5.12 | Improve Bollinger Bands Indicator - `BandWidth` normalization and adding `BandPercentage`. Based on: https://github.com/bukosabino/ta/issues/121 | 30 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = TechnicalAnalysisLibraryinPython 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Configuration file for the Sphinx documentation builder. 4 | # 5 | # This file does only contain a selection of the most common options. For a 6 | # full list see the documentation: 7 | # http://www.sphinx-doc.org/en/stable/config 8 | 9 | # -- Path setup -------------------------------------------------------------- 10 | 11 | # If extensions (or modules to document with autodoc) are in another directory, 12 | # add these directories to sys.path here. If the directory is relative to the 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. 14 | # 15 | # import os 16 | # import sys 17 | # sys.path.insert(0, os.path.abspath('.')) 18 | 19 | import sys 20 | 21 | sys.path.append("..") # Adds higher directory to python modules path. 22 | from ta import * 23 | 24 | # -- Project information ----------------------------------------------------- 25 | 26 | project = "Technical Analysis Library in Python" 27 | copyright = "2018, Dario Lopez Padial (Bukosabino)" 28 | author = "Dario Lopez Padial (Bukosabino)" 29 | 30 | # The short X.Y version 31 | version = "" 32 | # The full version, including alpha/beta/rc tags 33 | release = "0.1.4" 34 | 35 | 36 | # -- General configuration --------------------------------------------------- 37 | 38 | # If your documentation needs a minimal Sphinx version, state it here. 39 | # 40 | # needs_sphinx = '1.0' 41 | 42 | # Add any Sphinx extension module names here, as strings. They can be 43 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 44 | # ones. 45 | extensions = [ 46 | "sphinx.ext.autodoc", 47 | "sphinx.ext.napoleon", 48 | ] 49 | 50 | napoleon_google_docstring = True 51 | napoleon_use_param = False 52 | napoleon_use_ivar = True 53 | 54 | # Add any paths that contain templates here, relative to this directory. 55 | templates_path = ["_templates"] 56 | 57 | # The suffix(es) of source filenames. 58 | # You can specify multiple suffix as a list of string: 59 | # 60 | # source_suffix = ['.rst', '.md'] 61 | source_suffix = ".rst" 62 | 63 | # The master toctree document. 64 | master_doc = "index" 65 | 66 | # The language for content autogenerated by Sphinx. Refer to documentation 67 | # for a list of supported languages. 68 | # 69 | # This is also used if you do content translation via gettext catalogs. 70 | # Usually you set "language" from the command line for these cases. 71 | language = None 72 | 73 | # List of patterns, relative to source directory, that match files and 74 | # directories to ignore when looking for source files. 75 | # This pattern also affects html_static_path and html_extra_path . 76 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] 77 | 78 | # The name of the Pygments (syntax highlighting) style to use. 79 | pygments_style = "sphinx" 80 | 81 | 82 | # -- Options for HTML output ------------------------------------------------- 83 | 84 | # The theme to use for HTML and HTML Help pages. See the documentation for 85 | # a list of builtin themes. 86 | # 87 | html_theme = "sphinx_rtd_theme" 88 | 89 | # Theme options are theme-specific and customize the look and feel of a theme 90 | # further. For a list of options available for each theme, see the 91 | # documentation. 92 | # 93 | # html_theme_options = {} 94 | 95 | # Add any paths that contain custom static files (such as style sheets) here, 96 | # relative to this directory. They are copied after the builtin static files, 97 | # so a file named "default.css" will overwrite the builtin "default.css". 98 | html_static_path = ["_static"] 99 | 100 | # Custom sidebar templates, must be a dictionary that maps document names 101 | # to template names. 102 | # 103 | # The default sidebars (for documents that don't match any pattern) are 104 | # defined by theme itself. Builtin themes are using these templates by 105 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', 106 | # 'searchbox.html']``. 107 | # 108 | # html_sidebars = {} 109 | 110 | 111 | # -- Options for HTMLHelp output --------------------------------------------- 112 | 113 | # Output file base name for HTML help builder. 114 | htmlhelp_basename = "TechnicalAnalysisLibraryinPythondoc" 115 | 116 | 117 | # -- Options for LaTeX output ------------------------------------------------ 118 | 119 | latex_elements = { 120 | # The paper size ('letterpaper' or 'a4paper'). 121 | # 122 | # 'papersize': 'letterpaper', 123 | # The font size ('10pt', '11pt' or '12pt'). 124 | # 125 | # 'pointsize': '10pt', 126 | # Additional stuff for the LaTeX preamble. 127 | # 128 | # 'preamble': '', 129 | # Latex figure (float) alignment 130 | # 131 | # 'figure_align': 'htbp', 132 | } 133 | 134 | # Grouping the document tree into LaTeX files. List of tuples 135 | # (source start file, target name, title, 136 | # author, documentclass [howto, manual, or own class]). 137 | latex_documents = [ 138 | ( 139 | master_doc, 140 | "TechnicalAnalysisLibraryinPython.tex", 141 | "Technical Analysis Library in Python Documentation", 142 | "Dario Lopez Padial (Bukosabino)", 143 | "manual", 144 | ), 145 | ] 146 | 147 | 148 | # -- Options for manual page output ------------------------------------------ 149 | 150 | # One entry per manual page. List of tuples 151 | # (source start file, name, description, authors, manual section). 152 | man_pages = [ 153 | ( 154 | master_doc, 155 | "technicalanalysislibraryinpython", 156 | "Technical Analysis Library in Python Documentation", 157 | [author], 158 | 1, 159 | ) 160 | ] 161 | 162 | 163 | # -- Options for Texinfo output ---------------------------------------------- 164 | 165 | # Grouping the document tree into Texinfo files. List of tuples 166 | # (source start file, target name, title, author, 167 | # dir menu entry, description, category) 168 | texinfo_documents = [ 169 | ( 170 | master_doc, 171 | "TechnicalAnalysisLibraryinPython", 172 | "Technical Analysis Library in Python Documentation", 173 | author, 174 | "TechnicalAnalysisLibraryinPython", 175 | "One line description of project.", 176 | "Miscellaneous", 177 | ), 178 | ] 179 | 180 | 181 | # -- Extension configuration ------------------------------------------------- 182 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. Technical Analysis Library in Python documentation master file, created by 2 | sphinx-quickstart on Tue Apr 10 15:47:09 2018. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Technical Analysis Library in Python's documentation! 7 | ================================================================ 8 | 9 | It is a Technical Analysis library to financial time series datasets (open, close, high, low, volume). You can use it to do feature engineering from financial datasets. It is built on Python Pandas library. 10 | 11 | Installation (python >= v3.6) 12 | ================================================================ 13 | 14 | .. code-block:: bash 15 | 16 | > virtualenv -p python3 virtualenvironment 17 | > source virtualenvironment/bin/activate 18 | > pip install ta 19 | 20 | Examples 21 | ================== 22 | 23 | Example adding all features: 24 | 25 | .. code-block:: python 26 | 27 | import pandas as pd 28 | from ta import add_all_ta_features 29 | from ta.utils import dropna 30 | 31 | # Load datas 32 | df = pd.read_csv('ta/tests/data/datas.csv', sep=',') 33 | 34 | # Clean NaN values 35 | df = dropna(df) 36 | 37 | # Add ta features filling NaN values 38 | df = add_all_ta_features( 39 | df, open="Open", high="High", low="Low", close="Close", volume="Volume_BTC", fillna=True) 40 | 41 | 42 | Example adding a particular feature: 43 | 44 | .. code-block:: python 45 | 46 | import pandas as pd 47 | from ta.utils import dropna 48 | from ta.volatility import BollingerBands 49 | 50 | 51 | # Load datas 52 | df = pd.read_csv('ta/tests/data/datas.csv', sep=',') 53 | 54 | # Clean NaN values 55 | df = dropna(df) 56 | 57 | # Initialize Bollinger Bands Indicator 58 | indicator_bb = BollingerBands(close=df["Close"], window=20, window_dev=2) 59 | 60 | # Add Bollinger Bands features 61 | df['bb_bbm'] = indicator_bb.bollinger_mavg() 62 | df['bb_bbh'] = indicator_bb.bollinger_hband() 63 | df['bb_bbl'] = indicator_bb.bollinger_lband() 64 | 65 | # Add Bollinger Band high indicator 66 | df['bb_bbhi'] = indicator_bb.bollinger_hband_indicator() 67 | 68 | # Add Bollinger Band low indicator 69 | df['bb_bbli'] = indicator_bb.bollinger_lband_indicator() 70 | 71 | Motivation 72 | ================== 73 | 74 | * English: https://towardsdatascience.com/technical-analysis-library-to-financial-datasets-with-pandas-python-4b2b390d3543 75 | * Spanish: https://medium.com/datos-y-ciencia/biblioteca-de-an%C3%A1lisis-t%C3%A9cnico-sobre-series-temporales-financieras-para-machine-learning-con-cb28f9427d0 76 | 77 | 78 | Contents 79 | ================== 80 | .. toctree:: 81 | TA 82 | 83 | 84 | Indices and tables 85 | ================== 86 | 87 | * :ref:`genindex` 88 | * :ref:`modindex` 89 | * :ref:`search` 90 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | set SPHINXPROJ=TechnicalAnalysisLibraryinPython 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 20 | echo.installed, then set the SPHINXBUILD environment variable to point 21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 22 | echo.may add the Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /docs/ta.rst: -------------------------------------------------------------------------------- 1 | Documentation 2 | ************************** 3 | 4 | .. automodule:: ta 5 | 6 | 7 | Momentum Indicators 8 | ========================= 9 | 10 | Momentum Indicators. 11 | 12 | .. automodule:: ta.momentum 13 | :members: 14 | 15 | Volume Indicators 16 | ========================= 17 | 18 | Volume Indicators. 19 | 20 | .. automodule:: ta.volume 21 | :members: 22 | 23 | Volatility Indicators 24 | ========================= 25 | 26 | Volatility Indicators. 27 | 28 | .. automodule:: ta.volatility 29 | :members: 30 | 31 | Trend Indicators 32 | ========================= 33 | 34 | Trend Indicators. 35 | 36 | .. automodule:: ta.trend 37 | :members: 38 | 39 | Others Indicators 40 | ========================= 41 | 42 | Others Indicators. 43 | 44 | .. automodule:: ta.others 45 | :members: 46 | -------------------------------------------------------------------------------- /examples_to_use/all_features_example.py: -------------------------------------------------------------------------------- 1 | """This is a example adding all technical analysis features implemented in 2 | this library. 3 | """ 4 | import pandas as pd 5 | import ta 6 | 7 | # Load data 8 | df = pd.read_csv("../test/data/datas.csv", sep=",") 9 | 10 | # Clean nan values 11 | df = ta.utils.dropna(df) 12 | 13 | print(df.columns) 14 | 15 | # Add all ta features filling nans values 16 | df = ta.add_all_ta_features( 17 | df, "Open", "High", "Low", "Close", "Volume_BTC", fillna=True 18 | ) 19 | 20 | print(df.columns) 21 | print(len(df.columns)) 22 | -------------------------------------------------------------------------------- /examples_to_use/bollinger_band_features_example.py: -------------------------------------------------------------------------------- 1 | """This is a example adding bollinger band features. 2 | """ 3 | import pandas as pd 4 | import ta 5 | 6 | # Load data 7 | df = pd.read_csv("../test/data/datas.csv", sep=",") 8 | 9 | # Clean nan values 10 | df = ta.utils.dropna(df) 11 | 12 | print(df.columns) 13 | 14 | # Add bollinger band high indicator filling nans values 15 | df["bb_high_indicator"] = ta.volatility.bollinger_hband_indicator( 16 | df["Close"], window=20, window_dev=2, fillna=True 17 | ) 18 | 19 | # Add bollinger band low indicator filling nans values 20 | df["bb_low_indicator"] = ta.volatility.bollinger_lband_indicator( 21 | df["Close"], window=20, window_dev=2, fillna=True 22 | ) 23 | 24 | print(df.columns) 25 | -------------------------------------------------------------------------------- /examples_to_use/roc.py: -------------------------------------------------------------------------------- 1 | """This is a example adding volume features. 2 | """ 3 | import pandas as pd 4 | import ta 5 | 6 | # Load data 7 | df = pd.read_csv("../test/data/datas.csv", sep=",") 8 | 9 | # Clean nan values 10 | df = ta.utils.dropna(df) 11 | 12 | window = 12 13 | df[f"roc_{window}"] = ta.momentum.ROCIndicator(close=df["Close"], window=window).roc() 14 | -------------------------------------------------------------------------------- /examples_to_use/volume_features_example.py: -------------------------------------------------------------------------------- 1 | """This is a example adding volume features. 2 | """ 3 | import pandas as pd 4 | import ta 5 | 6 | # Load data 7 | df = pd.read_csv("../test/data/datas.csv", sep=",") 8 | 9 | # Clean nan values 10 | df = ta.utils.dropna(df) 11 | 12 | print(df.columns) 13 | 14 | # Add all volume features filling nans values 15 | df = ta.add_volume_ta(df, "High", "Low", "Close", "Volume_BTC", fillna=True) 16 | 17 | print(df.columns) 18 | -------------------------------------------------------------------------------- /pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | 3 | # Specify a configuration file. 4 | #rcfile= 5 | 6 | # Python code to execute, usually for sys.path manipulation such as 7 | # pygtk.require(). 8 | #init-hook= 9 | 10 | # Add files or directories to the blacklist. They should be base names, not 11 | # paths. 12 | ignore=CVS 13 | 14 | # Pickle collected data for later comparisons. 15 | persistent=yes 16 | 17 | # List of plugins (as comma separated values of python modules names) to load, 18 | # usually to register additional checkers. 19 | load-plugins= 20 | pylint.extensions.check_elif 21 | 22 | # Use multiple processes to speed up Pylint. 23 | jobs=1 24 | 25 | # Allow loading of arbitrary C extensions. Extensions are imported into the 26 | # active Python interpreter and may run arbitrary code. 27 | unsafe-load-any-extension=no 28 | 29 | # A comma-separated list of package or module names from where C extensions may 30 | # be loaded. Extensions are loading into the active Python interpreter and may 31 | # run arbitrary code 32 | extension-pkg-whitelist= 33 | 34 | 35 | [MESSAGES CONTROL] 36 | 37 | # Only show warnings with the listed confidence levels. Leave empty to show 38 | # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED 39 | confidence= 40 | 41 | # Enable the message, report, category or checker with the given id(s). You can 42 | # either give multiple identifier separated by comma (,) or put this option 43 | # multiple time. See also the "--disable" option for examples. 44 | enable=use-symbolic-message-instead,useless-supression,fixme 45 | 46 | # Disable the message, report, category or checker with the given id(s). You 47 | # can either give multiple identifiers separated by comma (,) or put this 48 | # option multiple times (only on the command line, not in the configuration 49 | # file where it should appear only once).You can also use "--disable=all" to 50 | # disable everything first and then reenable specific checks. For example, if 51 | # you want to run only the similarities checker, you can use "--disable=all 52 | # --enable=similarities". If you want to run only the classes checker, but have 53 | # no Warning level messages displayed, use"--disable=all --enable=classes 54 | # --disable=W" 55 | 56 | disable= 57 | missing-docstring, 58 | too-few-public-methods, 59 | too-many-arguments, 60 | too-many-instance-attributes, 61 | 62 | # handled by black 63 | format 64 | 65 | 66 | [REPORTS] 67 | 68 | # Set the output format. Available formats are text, parseable, colorized, msvs 69 | # (visual studio) and html. You can also give a reporter class, eg 70 | # mypackage.mymodule.MyReporterClass. 71 | output-format=text 72 | 73 | # Put messages in a separate file for each module / package specified on the 74 | # command line instead of printing them on stdout. Reports (if any) will be 75 | # written in a file name "pylint_global.[txt|html]". 76 | files-output=no 77 | 78 | # Tells whether to display a full report or only the messages 79 | reports=no 80 | 81 | # Python expression which should return a note less than 10 (10 is the highest 82 | # note). You have access to the variables errors warning, statement which 83 | # respectively contain the number of errors / warnings messages and the total 84 | # number of statements analyzed. This is used by the global evaluation report 85 | # (RP0004). 86 | evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) 87 | 88 | # Template used to display messages. This is a python new-style format string 89 | # used to format the message information. See doc for all details 90 | #msg-template= 91 | 92 | 93 | [LOGGING] 94 | 95 | # Logging modules to check that the string format arguments are in logging 96 | # function parameter format 97 | logging-modules=logging 98 | 99 | 100 | [MISCELLANEOUS] 101 | 102 | # List of note tags to take in consideration, separated by a comma. 103 | notes=FIXME,XXX,TODO 104 | 105 | 106 | [SIMILARITIES] 107 | 108 | # Minimum lines number of a similarity. 109 | min-similarity-lines=4 110 | 111 | # Ignore comments when computing similarities. 112 | ignore-comments=yes 113 | 114 | # Ignore docstrings when computing similarities. 115 | ignore-docstrings=yes 116 | 117 | # Ignore imports when computing similarities. 118 | ignore-imports=no 119 | 120 | 121 | [VARIABLES] 122 | 123 | # Tells whether we should check for unused import in __init__ files. 124 | init-import=no 125 | 126 | # A regular expression matching the name of dummy variables (i.e. expectedly 127 | # not used). 128 | dummy-variables-rgx=_$|dummy 129 | 130 | # List of additional names supposed to be defined in builtins. Remember that 131 | # you should avoid defining new builtins when possible. 132 | additional-builtins= 133 | 134 | # List of strings which can identify a callback function by name. A callback 135 | # name must start or end with one of those strings. 136 | callbacks=cb_,_cb 137 | 138 | 139 | [FORMAT] 140 | 141 | # Maximum number of characters on a single line. 142 | max-line-length=100 143 | 144 | # Regexp for a line that is allowed to be longer than the limit. 145 | ignore-long-lines=^\s*(# )??$ 146 | 147 | # Allow the body of an if to be on the same line as the test if there is no 148 | # else. 149 | single-line-if-stmt=no 150 | 151 | # List of optional constructs for which whitespace checking is disabled 152 | no-space-check=trailing-comma,dict-separator 153 | 154 | # Maximum number of lines in a module 155 | max-module-lines=2000 156 | 157 | # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 158 | # tab). 159 | indent-string=' ' 160 | 161 | # Number of spaces of indent required inside a hanging or continued line. 162 | indent-after-paren=4 163 | 164 | # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. 165 | expected-line-ending-format= 166 | 167 | 168 | [BASIC] 169 | 170 | # List of builtins function names that should not be used, separated by a comma 171 | bad-functions=map,filter,input 172 | 173 | # Good variable names which should always be accepted, separated by a comma 174 | good-names=i,j,k,ex,Run,_,x,df 175 | 176 | # Bad variable names which should always be refused, separated by a comma 177 | bad-names=foo,bar,baz,toto,tutu,tata 178 | 179 | # Colon-delimited sets of names that determine each other's naming style when 180 | # the name regexes allow several styles. 181 | name-group= 182 | 183 | # Include a hint for the correct naming format with invalid-name 184 | include-naming-hint=no 185 | 186 | # Regular expression matching correct function names 187 | function-rgx=[a-z_][a-z0-9_]{2,30}$ 188 | 189 | # Naming hint for function names 190 | function-name-hint=[a-z_][a-z0-9_]{2,30}$ 191 | 192 | # Regular expression matching correct variable names 193 | variable-rgx=[a-z_][a-z0-9_]{2,30}$ 194 | 195 | # Naming hint for variable names 196 | variable-name-hint=[a-z_][a-z0-9_]{2,30}$ 197 | 198 | # Regular expression matching correct constant names 199 | const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ 200 | 201 | # Naming hint for constant names 202 | const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ 203 | 204 | # Regular expression matching correct attribute names 205 | attr-rgx=[a-z_][a-z0-9_]{2,}$ 206 | 207 | # Naming hint for attribute names 208 | attr-name-hint=[a-z_][a-z0-9_]{2,}$ 209 | 210 | # Regular expression matching correct argument names 211 | argument-rgx=[a-z_][a-z0-9_]{2,30}$ 212 | 213 | # Naming hint for argument names 214 | argument-name-hint=[a-z_][a-z0-9_]{2,30}$ 215 | 216 | # Regular expression matching correct class attribute names 217 | class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ 218 | 219 | # Naming hint for class attribute names 220 | class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ 221 | 222 | # Regular expression matching correct inline iteration names 223 | inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ 224 | 225 | # Naming hint for inline iteration names 226 | inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ 227 | 228 | # Regular expression matching correct class names 229 | class-rgx=[A-Z_][a-zA-Z0-9]+$ 230 | 231 | # Naming hint for class names 232 | class-name-hint=[A-Z_][a-zA-Z0-9]+$ 233 | 234 | # Regular expression matching correct module names 235 | module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ 236 | 237 | # Naming hint for module names 238 | module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ 239 | 240 | # Regular expression matching correct method names 241 | method-rgx=[a-z_][a-z0-9_]{2,}$ 242 | 243 | # Naming hint for method names 244 | method-name-hint=[a-z_][a-z0-9_]{2,}$ 245 | 246 | # Regular expression which should only match function or class names that do 247 | # not require a docstring. 248 | no-docstring-rgx=__.*__ 249 | 250 | # Minimum line length for functions/classes that require docstrings, shorter 251 | # ones are exempt. 252 | docstring-min-length=-1 253 | 254 | # List of decorators that define properties, such as abc.abstractproperty. 255 | property-classes=abc.abstractproperty 256 | 257 | 258 | [TYPECHECK] 259 | 260 | # Tells whether missing members accessed in mixin class should be ignored. A 261 | # mixin class is detected if its name ends with "mixin" (case insensitive). 262 | ignore-mixin-members=yes 263 | 264 | # List of module names for which member attributes should not be checked 265 | # (useful for modules/projects where namespaces are manipulated during runtime 266 | # and thus existing member attributes cannot be deduced by static analysis 267 | ignored-modules= 268 | 269 | # List of classes names for which member attributes should not be checked 270 | # (useful for classes with attributes dynamically set). 271 | ignored-classes=SQLObject, optparse.Values, thread._local, _thread._local 272 | 273 | # List of members which are set dynamically and missed by pylint inference 274 | # system, and so shouldn't trigger E1101 when accessed. Python regular 275 | # expressions are accepted. 276 | generated-members=REQUEST,acl_users,aq_parent 277 | 278 | # List of decorators that create context managers from functions, such as 279 | # contextlib.contextmanager. 280 | contextmanager-decorators=contextlib.contextmanager 281 | 282 | 283 | [SPELLING] 284 | 285 | # Spelling dictionary name. Available dictionaries: none. To make it working 286 | # install python-enchant package. 287 | spelling-dict= 288 | 289 | # List of comma separated words that should not be checked. 290 | spelling-ignore-words= 291 | 292 | # A path to a file that contains private dictionary; one word per line. 293 | spelling-private-dict-file= 294 | 295 | # Tells whether to store unknown words to indicated private dictionary in 296 | # --spelling-private-dict-file option instead of raising a message. 297 | spelling-store-unknown-words=no 298 | 299 | 300 | [DESIGN] 301 | 302 | # Maximum number of arguments for function / method 303 | max-args=10 304 | 305 | # Argument names that match this expression will be ignored. Default to name 306 | # with leading underscore 307 | ignored-argument-names=_.* 308 | 309 | # Maximum number of locals for function / method body 310 | max-locals=25 311 | 312 | # Maximum number of return / yield for function / method body 313 | max-returns=11 314 | 315 | # Maximum number of branch for function / method body 316 | max-branches=26 317 | 318 | # Maximum number of statements in function / method body 319 | max-statements=100 320 | 321 | # Maximum number of parents for a class (see R0901). 322 | max-parents=7 323 | 324 | # Maximum number of attributes for a class (see R0902). 325 | max-attributes=11 326 | 327 | # Minimum number of public methods for a class (see R0903). 328 | min-public-methods=2 329 | 330 | # Maximum number of public methods for a class (see R0904). 331 | max-public-methods=25 332 | 333 | 334 | [CLASSES] 335 | 336 | # List of method names used to declare (i.e. assign) instance attributes. 337 | defining-attr-methods=__init__,__new__,setUp,__post_init__ 338 | 339 | # List of valid names for the first argument in a class method. 340 | valid-classmethod-first-arg=cls 341 | 342 | # List of valid names for the first argument in a metaclass class method. 343 | valid-metaclass-classmethod-first-arg=mcs 344 | 345 | # List of member names, which should be excluded from the protected access 346 | # warning. 347 | exclude-protected=_asdict,_fields,_replace,_source,_make 348 | 349 | 350 | [IMPORTS] 351 | 352 | # Deprecated modules which should not be used, separated by a comma 353 | deprecated-modules=regsub,TERMIOS,Bastion,rexec 354 | 355 | # Create a graph of every (i.e. internal and external) dependencies in the 356 | # given file (report RP0402 must not be disabled) 357 | import-graph= 358 | 359 | # Create a graph of external dependencies in the given file (report RP0402 must 360 | # not be disabled) 361 | ext-import-graph= 362 | 363 | # Create a graph of internal dependencies in the given file (report RP0402 must 364 | # not be disabled) 365 | int-import-graph= 366 | 367 | 368 | [EXCEPTIONS] 369 | 370 | # Exceptions that will emit a warning when being caught. Defaults to 371 | # "Exception" 372 | overgeneral-exceptions=Exception -------------------------------------------------------------------------------- /requirements-core.txt: -------------------------------------------------------------------------------- 1 | numpy==1.21.5 2 | pandas==1.3.5 3 | -------------------------------------------------------------------------------- /requirements-coverage.txt: -------------------------------------------------------------------------------- 1 | -r requirements-core.txt 2 | 3 | # coverage test code 4 | coverage==4.5.4 5 | coveralls==1.8.2 6 | -------------------------------------------------------------------------------- /requirements-doc.txt: -------------------------------------------------------------------------------- 1 | -r requirements-core.txt 2 | 3 | # doc 4 | Sphinx==2.2.1 5 | sphinx-rtd-theme==0.4.3 6 | docutils==0.17.1 7 | Jinja2<3.1 8 | -------------------------------------------------------------------------------- /requirements-play.txt: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | 3 | # examples to use 4 | jupyterlab>=1.2.21 5 | matplotlib==3.1.1 6 | -------------------------------------------------------------------------------- /requirements-test.txt: -------------------------------------------------------------------------------- 1 | -r requirements-core.txt 2 | 3 | # clean code 4 | black==23.10.1 5 | prospector[with_mypy,with_bandit]==1.10.3 6 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | -r requirements-test.txt 2 | -r requirements-coverage.txt 3 | -r requirements-doc.txt 4 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [isort] 2 | multi_line_output = 3 3 | include_trailing_comma = True 4 | force_grid_wrap = 0 5 | use_parentheses = True 6 | ensure_newline_before_comments = True 7 | line_length = 88 8 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from distutils.core import setup 3 | 4 | setup( 5 | name="ta", 6 | packages=["ta"], 7 | version="0.11.0", 8 | description="Technical Analysis Library in Python", 9 | long_description="It is a Technical Analysis library to financial time series datasets. You can use to do feature engineering. It is built on Python Pandas library.", 10 | author="Dario Lopez Padial (Bukosabino)", 11 | author_email="Bukosabino@gmail.com", 12 | url="https://github.com/bukosabino/ta", 13 | maintainer="Dario Lopez Padial (Bukosabino)", 14 | maintainer_email="Bukosabino@gmail.com", 15 | install_requires=[ 16 | "numpy", 17 | "pandas", 18 | ], 19 | download_url="https://github.com/bukosabino/ta/tarball/0.11.0", 20 | keywords=["technical analysis", "python3", "pandas"], 21 | license="The MIT License (MIT)", 22 | license_files=["LICENSE"], 23 | classifiers=[ 24 | "Intended Audience :: Financial and Insurance Industry", 25 | "Programming Language :: Python :: 3.6", 26 | "Programming Language :: Python :: 3.7", 27 | "License :: OSI Approved :: MIT License", 28 | ], 29 | project_urls={ 30 | "Documentation": "https://technical-analysis-library-in-python.readthedocs.io/en/latest/", 31 | "Bug Reports": "https://github.com/bukosabino/ta/issues", 32 | "Source": "https://github.com/bukosabino/ta", 33 | }, 34 | ) 35 | -------------------------------------------------------------------------------- /static/figure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bukosabino/ta/565478298cb1d9c8461d69b0296d28e999c1b0ae/static/figure.png -------------------------------------------------------------------------------- /static/logo_neuroons_byOS_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bukosabino/ta/565478298cb1d9c8461d69b0296d28e999c1b0ae/static/logo_neuroons_byOS_blue.png -------------------------------------------------------------------------------- /static/logo_neuroons_byOS_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bukosabino/ta/565478298cb1d9c8461d69b0296d28e999c1b0ae/static/logo_neuroons_byOS_white.png -------------------------------------------------------------------------------- /ta/__init__.py: -------------------------------------------------------------------------------- 1 | """It is a Technical Analysis library useful to do feature 2 | engineering from financial time series datasets (Open, 3 | Close, High, Low, Volume). It is built on Pandas and Numpy. 4 | 5 | .. moduleauthor:: Dario Lopez Padial (Bukosabino) 6 | 7 | """ 8 | from ta.wrapper import ( 9 | add_all_ta_features, 10 | add_momentum_ta, 11 | add_others_ta, 12 | add_trend_ta, 13 | add_volatility_ta, 14 | add_volume_ta, 15 | ) 16 | 17 | __all__ = [ 18 | "add_all_ta_features", 19 | "add_momentum_ta", 20 | "add_others_ta", 21 | "add_trend_ta", 22 | "add_volatility_ta", 23 | "add_volume_ta", 24 | ] 25 | -------------------------------------------------------------------------------- /ta/others.py: -------------------------------------------------------------------------------- 1 | """ 2 | .. module:: others 3 | :synopsis: Others Indicators. 4 | 5 | .. moduleauthor:: Dario Lopez Padial (Bukosabino) 6 | 7 | """ 8 | import numpy as np 9 | import pandas as pd 10 | 11 | from ta.utils import IndicatorMixin 12 | 13 | 14 | class DailyReturnIndicator(IndicatorMixin): 15 | """Daily Return (DR) 16 | 17 | Args: 18 | close(pandas.Series): dataset 'Close' column. 19 | fillna(bool): if True, fill nan values. 20 | """ 21 | 22 | def __init__(self, close: pd.Series, fillna: bool = False): 23 | self._close = close 24 | self._fillna = fillna 25 | self._run() 26 | 27 | def _run(self): 28 | self._dr = (self._close / self._close.shift(1)) - 1 29 | self._dr *= 100 30 | 31 | def daily_return(self) -> pd.Series: 32 | """Daily Return (DR) 33 | 34 | Returns: 35 | pandas.Series: New feature generated. 36 | """ 37 | dr_series = self._check_fillna(self._dr, value=0) 38 | return pd.Series(dr_series, name="d_ret") 39 | 40 | 41 | class DailyLogReturnIndicator(IndicatorMixin): 42 | """Daily Log Return (DLR) 43 | 44 | https://stackoverflow.com/questions/31287552/logarithmic-returns-in-pandas-dataframe 45 | 46 | Args: 47 | close(pandas.Series): dataset 'Close' column. 48 | fillna(bool): if True, fill nan values. 49 | """ 50 | 51 | def __init__(self, close: pd.Series, fillna: bool = False): 52 | self._close = close 53 | self._fillna = fillna 54 | self._run() 55 | 56 | def _run(self): 57 | self._dr = pd.Series(np.log(self._close)).diff() 58 | self._dr *= 100 59 | 60 | def daily_log_return(self) -> pd.Series: 61 | """Daily Log Return (DLR) 62 | 63 | Returns: 64 | pandas.Series: New feature generated. 65 | """ 66 | dr_series = self._check_fillna(self._dr, value=0) 67 | return pd.Series(dr_series, name="d_logret") 68 | 69 | 70 | class CumulativeReturnIndicator(IndicatorMixin): 71 | """Cumulative Return (CR) 72 | 73 | Args: 74 | close(pandas.Series): dataset 'Close' column. 75 | fillna(bool): if True, fill nan values. 76 | """ 77 | 78 | def __init__(self, close: pd.Series, fillna: bool = False): 79 | self._close = close 80 | self._fillna = fillna 81 | self._run() 82 | 83 | def _run(self): 84 | self._cr = (self._close / self._close.iloc[0]) - 1 85 | self._cr *= 100 86 | 87 | def cumulative_return(self) -> pd.Series: 88 | """Cumulative Return (CR) 89 | 90 | Returns: 91 | pandas.Series: New feature generated. 92 | """ 93 | cum_ret = self._check_fillna(self._cr, value=-1) 94 | return pd.Series(cum_ret, name="cum_ret") 95 | 96 | 97 | def daily_return(close, fillna=False): 98 | """Daily Return (DR) 99 | 100 | Args: 101 | close(pandas.Series): dataset 'Close' column. 102 | fillna(bool): if True, fill nan values. 103 | 104 | Returns: 105 | pandas.Series: New feature generated. 106 | """ 107 | return DailyReturnIndicator(close=close, fillna=fillna).daily_return() 108 | 109 | 110 | def daily_log_return(close, fillna=False): 111 | """Daily Log Return (DLR) 112 | 113 | https://stackoverflow.com/questions/31287552/logarithmic-returns-in-pandas-dataframe 114 | 115 | Args: 116 | close(pandas.Series): dataset 'Close' column. 117 | fillna(bool): if True, fill nan values. 118 | 119 | Returns: 120 | pandas.Series: New feature generated. 121 | """ 122 | return DailyLogReturnIndicator(close=close, fillna=fillna).daily_log_return() 123 | 124 | 125 | def cumulative_return(close, fillna=False): 126 | """Cumulative Return (CR) 127 | 128 | Args: 129 | close(pandas.Series): dataset 'Close' column. 130 | fillna(bool): if True, fill nan values. 131 | 132 | Returns: 133 | pandas.Series: New feature generated. 134 | """ 135 | return CumulativeReturnIndicator(close=close, fillna=fillna).cumulative_return() 136 | -------------------------------------------------------------------------------- /ta/utils.py: -------------------------------------------------------------------------------- 1 | """ 2 | .. module:: utils 3 | :synopsis: Utils classes and functions. 4 | 5 | .. moduleauthor:: Dario Lopez Padial (Bukosabino) 6 | 7 | """ 8 | import math 9 | 10 | import numpy as np 11 | import pandas as pd 12 | 13 | 14 | class IndicatorMixin: 15 | """Util mixin indicator class""" 16 | 17 | _fillna = False 18 | 19 | def _check_fillna(self, series: pd.Series, value: int = 0) -> pd.Series: 20 | """Check if fillna flag is True. 21 | 22 | Args: 23 | series(pandas.Series): calculated indicator series. 24 | value(int): value to fill gaps; if -1 fill values using 'backfill' mode. 25 | 26 | Returns: 27 | pandas.Series: New feature generated. 28 | """ 29 | if self._fillna: 30 | series_output = series.copy(deep=False) 31 | series_output = series_output.replace([np.inf, -np.inf], np.nan) 32 | if isinstance(value, int) and value == -1: 33 | series = series_output.ffill().bfill() 34 | else: 35 | series = series_output.ffill().fillna(value) 36 | return series 37 | 38 | @staticmethod 39 | def _true_range( 40 | high: pd.Series, low: pd.Series, prev_close: pd.Series 41 | ) -> pd.Series: 42 | tr1 = high - low 43 | tr2 = (high - prev_close).abs() 44 | tr3 = (low - prev_close).abs() 45 | true_range = pd.DataFrame(data={"tr1": tr1, "tr2": tr2, "tr3": tr3}).max(axis=1) 46 | return true_range 47 | 48 | 49 | def dropna(df: pd.DataFrame) -> pd.DataFrame: 50 | """Drop rows with "Nans" values""" 51 | df = df.copy() 52 | number_cols = df.select_dtypes(include=np.number).columns.tolist() 53 | df[number_cols] = df[number_cols][df[number_cols] < math.exp(709)] # big number 54 | df[number_cols] = df[number_cols][df[number_cols] != 0.0] 55 | df = df.dropna() 56 | return df 57 | 58 | 59 | def _sma(series, periods: int, fillna: bool = False): 60 | min_periods = 0 if fillna else periods 61 | return series.rolling(window=periods, min_periods=min_periods).mean() 62 | 63 | 64 | def _ema(series, periods: int, fillna: bool = False): 65 | min_periods = 0 if fillna else periods 66 | return series.ewm(span=periods, min_periods=min_periods, adjust=False).mean() 67 | 68 | 69 | def _get_min_max(series1: pd.Series, series2: pd.Series, function: str = "min"): 70 | """Find min or max value between two lists for each index""" 71 | series1 = np.array(series1) 72 | series2 = np.array(series2) 73 | if function == "min": 74 | output = np.amin([series1, series2], axis=0) 75 | elif function == "max": 76 | output = np.amax([series1, series2], axis=0) 77 | else: 78 | raise ValueError('"f" variable value should be "min" or "max"') 79 | 80 | return pd.Series(output) 81 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- 1 | from test.integration.wrapper import TestWrapper 2 | from test.unit.momentum import ( 3 | TestKAMAIndicator, 4 | TestPercentagePriceOscillator, 5 | TestPercentageVolumeOscillator, 6 | TestRateOfChangeIndicator, 7 | TestRSIIndicator, 8 | TestStochasticOscillator, 9 | TestStochRSIIndicator, 10 | TestTSIIndicator, 11 | TestUltimateOscillator, 12 | TestWilliamsRIndicator, 13 | ) 14 | from test.unit.trend import ( 15 | TestADXIndicator, 16 | TestCCIIndicator, 17 | TestMACDIndicator, 18 | TestPSARIndicator, 19 | TestSTCIndicator, 20 | TestVortexIndicator, 21 | TestWMAIndicator, 22 | ) 23 | from test.unit.volatility import ( 24 | TestAverageTrueRange, 25 | TestAverageTrueRange2, 26 | TestBollingerBands, 27 | TestDonchianChannel, 28 | TestDonchianChannel2, 29 | TestKeltnerChannel, 30 | TestUlcerIndex, 31 | ) 32 | from test.unit.volume import ( 33 | TestAccDistIndexIndicator, 34 | TestEaseOfMovementIndicator, 35 | TestForceIndexIndicator, 36 | TestMFIIndicator, 37 | TestOnBalanceVolumeIndicator, 38 | TestVolumePriceTrendIndicator, 39 | TestVolumeWeightedAveragePrice, 40 | ) 41 | 42 | __all__ = [ 43 | "TestWrapper", 44 | "TestKAMAIndicator", 45 | "TestPercentagePriceOscillator", 46 | "TestPercentageVolumeOscillator", 47 | "TestRateOfChangeIndicator", 48 | "TestRSIIndicator", 49 | "TestStochasticOscillator", 50 | "TestStochRSIIndicator", 51 | "TestTSIIndicator", 52 | "TestUltimateOscillator", 53 | "TestWilliamsRIndicator", 54 | "TestADXIndicator", 55 | "TestCCIIndicator", 56 | "TestMACDIndicator", 57 | "TestPSARIndicator", 58 | "TestSTCIndicator", 59 | "TestVortexIndicator", 60 | "TestWMAIndicator", 61 | "TestAverageTrueRange", 62 | "TestAverageTrueRange2", 63 | "TestBollingerBands", 64 | "TestDonchianChannel", 65 | "TestDonchianChannel2", 66 | "TestKeltnerChannel", 67 | "TestUlcerIndex", 68 | "TestAccDistIndexIndicator", 69 | "TestEaseOfMovementIndicator", 70 | "TestForceIndexIndicator", 71 | "TestMFIIndicator", 72 | "TestOnBalanceVolumeIndicator", 73 | "TestVolumeWeightedAveragePrice", 74 | "TestVolumePriceTrendIndicator", 75 | ] 76 | -------------------------------------------------------------------------------- /test/data/cs-accum.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Close,MF Multiplier,Volume,MF Value,ADLine 2 | 10-Dec-10,62.3400,61.3700,62.1500,0.6082,7849.0250,4774.1492,4774.1492 3 | 13-Dec-10,62.0500,60.6900,60.8100,-0.8235,11692.0750,-9628.7676,-4854.6184 4 | 14-Dec-10,62.2700,60.1000,60.4500,-0.6774,10575.3070,-7163.9176,-12018.5361 5 | 15-Dec-10,60.7900,58.6100,59.1800,-0.4771,13059.1280,-6230.0427,-18248.5788 6 | 16-Dec-10,59.9300,58.7120,59.2400,-0.1330,20733.5080,-2757.6587,-21006.2375 7 | 17-Dec-10,61.7500,59.8600,60.2000,-0.6402,29630.0960,-18969.5324,-39975.7698 8 | 20-Dec-10,60.0000,57.9700,58.4800,-0.4975,17705.2940,-8809.0379,-48784.8077 9 | 21-Dec-10,59.0000,58.0200,58.2400,-0.5510,7259.2030,-3999.9690,-52784.7767 10 | 22-Dec-10,59.0700,57.4800,58.6900,0.5220,10474.6290,5467.8881,-47316.8886 11 | 23-Dec-10,59.2200,58.3000,58.6500,-0.2391,5203.7140,-1244.3664,-48561.2550 12 | 27-Dec-10,58.7500,57.8276,58.4700,0.3929,3422.8650,1344.8030,-47216.4521 13 | 28-Dec-10,58.6500,57.8600,58.0200,-0.5949,3962.1500,-2357.2285,-49573.6805 14 | 29-Dec-10,58.4700,57.9100,58.1700,-0.0714,4095.9050,-292.5646,-49866.2452 15 | 30-Dec-10,58.2500,57.8333,58.0700,0.1361,3766.0060,512.4371,-49353.8081 16 | 31-Dec-10,58.3500,57.5300,58.1300,0.4634,4239.3350,1964.5699,-47389.2382 17 | 03-Jan-11,59.8600,58.5800,58.9400,-0.4375,8039.9790,-3517.4908,-50906.7290 18 | 04-Jan-11,59.5299,58.3000,59.1000,0.3009,6956.7170,2093.4067,-48813.3223 19 | 05-Jan-11,62.1000,58.5300,61.9200,0.8992,18171.5520,16339.1266,-32474.1957 20 | 06-Jan-11,62.1600,59.8000,61.3700,0.3305,22225.8940,7345.8463,-25128.3493 21 | 07-Jan-11,62.6700,60.9300,61.6800,-0.1379,14613.5090,-2015.6564,-27144.0058 22 | 10-Jan-11,62.3800,60.1500,62.0900,0.7399,12319.7630,9115.5197,-18028.4861 23 | 11-Jan-11,63.7300,62.2618,62.8900,-0.1443,15007.6900,-2164.9835,-20193.4695 24 | 12-Jan-11,63.8500,63.0000,63.5300,0.2471,8879.6670,2193.8001,-17999.6694 25 | 13-Jan-11,66.1500,63.5800,64.0100,-0.6654,22693.8120,-15099.7737,-33099.4432 26 | 14-Jan-11,65.3400,64.0700,64.7700,0.1024,10191.8140,1043.2566,-32056.1866 27 | 18-Jan-11,66.4800,65.2000,65.2200,-0.9688,10074.1520,-9759.3348,-41815.5214 28 | 19-Jan-11,65.2300,63.2100,63.2800,-0.9307,9411.6200,-8759.3295,-50574.8509 29 | 20-Jan-11,63.4000,61.8800,62.4000,-0.3158,10391.6900,-3281.5863,-53856.4372 30 | 21-Jan-11,63.1800,61.1100,61.5500,-0.5749,8926.5120,-5131.6663,-58988.1035 31 | 24-Jan-11,62.7000,61.2500,62.6900,0.9862,7459.5750,7356.6843,-51631.4192 32 | -------------------------------------------------------------------------------- /test/data/cs-atr.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Close,TR,ATR 2 | 01-Apr-10,48.700000000000000,47.790000000000000,48.160000000000000,0.910000000000004,0.000000000000000 3 | 05-Apr-10,48.720000000000000,48.140000000000000,48.610000000000000,0.579999999999998,0.000000000000000 4 | 06-Apr-10,48.900000000000000,48.390000000000000,48.750000000000000,0.509999999999998,0.000000000000000 5 | 07-Apr-10,48.870000000000000,48.370000000000000,48.630000000000000,0.500000000000000,0.000000000000000 6 | 08-Apr-10,48.820000000000000,48.240000000000000,48.740000000000000,0.579999999999998,0.000000000000000 7 | 09-Apr-10,49.050000000000000,48.635000000000000,49.030000000000000,0.414999999999999,0.000000000000000 8 | 12-Apr-10,49.200000000000000,48.940000000000000,49.070000000000000,0.260000000000005,0.000000000000000 9 | 13-Apr-10,49.350000000000000,48.860000000000000,49.320000000000000,0.490000000000002,0.000000000000000 10 | 14-Apr-10,49.920000000000000,49.500000000000000,49.910000000000000,0.600000000000001,0.000000000000000 11 | 15-Apr-10,50.190000000000000,49.870000000000000,50.130000000000000,0.320000000000000,0.000000000000000 12 | 16-Apr-10,50.120000000000000,49.200000000000000,49.530000000000000,0.930000000000000,0.000000000000000 13 | 19-Apr-10,49.660000000000000,48.900000000000000,49.500000000000000,0.759999999999998,0.000000000000000 14 | 20-Apr-10,49.880000000000000,49.430000000000000,49.750000000000000,0.450000000000003,0.000000000000000 15 | 21-Apr-10,50.190000000000000,49.725000000000000,50.030000000000000,0.464999999999996,0.555000000000000 16 | 22-Apr-10,50.360000000000000,49.260000000000000,50.310000000000000,1.100000000000000,0.5939285714 17 | 23-Apr-10,50.570000000000000,50.090000000000000,50.520000000000000,0.479999999999997,0.5857908163 18 | 26-Apr-10,50.650000000000000,50.300000000000000,50.410000000000000,0.350000000000001,0.5689486152 19 | 27-Apr-10,50.430000000000000,49.210000000000000,49.340000000000000,1.220000000000000,0.6154522855 20 | 28-Apr-10,49.630000000000000,48.980000000000000,49.370000000000000,0.650000000000006,0.6179199794 21 | 29-Apr-10,50.330000000000000,49.610000000000000,50.230000000000000,0.960000000000001,0.6423542666 22 | 30-Apr-10,50.290000000000000,49.200000000000000,49.237500000000000,1.090000000000000,0.6743289618 23 | 03-May-10,50.170000000000000,49.430000000000000,49.930000000000000,0.932500000000005,0.6927697503 24 | 04-May-10,49.320000000000000,48.080000000000000,48.430000000000000,1.850000000000000,0.7754290538 25 | 05-May-10,48.500000000000000,47.640000000000000,48.180000000000000,0.859999999999999,0.7814698357 26 | 06-May-10,48.320100000000000,41.550000000000000,46.570000000000000,6.770100000000000,1.209229133 27 | 07-May-10,46.800000000000000,44.283300000000000,45.410000000000000,2.516700000000000,1.302619909 28 | 10-May-10,47.800000000000000,47.310000000000000,47.770000000000000,2.390000000000000,1.380289916 29 | 11-May-10,48.390000000000000,47.200000000000000,47.720000000000000,1.190000000000000,1.366697779 30 | 12-May-10,48.660000000000000,47.900000000000000,48.620000000000000,0.939999999999998,1.336219366 31 | 13-May-10,48.790000000000000,47.730100000000000,47.850000000000000,1.059900000000000,1.316482269 -------------------------------------------------------------------------------- /test/data/cs-atr2.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Close,TR,ATR 2 | 01-Apr-10,48.700000000000000,47.790000000000000,48.160000000000000,0.910000000000004,0.000000000000000 3 | 05-Apr-10,48.720000000000000,48.140000000000000,48.610000000000000,0.579999999999998,0.000000000000000 4 | 06-Apr-10,48.900000000000000,48.390000000000000,48.750000000000000,0.509999999999998,0.000000000000000 5 | 07-Apr-10,48.870000000000000,48.370000000000000,48.630000000000000,0.500000000000000,0.000000000000000 6 | 08-Apr-10,48.820000000000000,48.240000000000000,48.740000000000000,0.579999999999998,0.000000000000000 7 | 09-Apr-10,49.050000000000000,48.635000000000000,49.030000000000000,0.414999999999999,0.000000000000000 8 | 12-Apr-10,49.200000000000000,48.940000000000000,49.070000000000000,0.260000000000005,0.000000000000000 9 | 13-Apr-10,49.350000000000000,48.860000000000000,49.320000000000000,0.490000000000002,0.000000000000000 10 | 14-Apr-10,49.920000000000000,49.500000000000000,49.910000000000000,0.600000000000001,0.000000000000000 11 | 15-Apr-10,50.190000000000000,49.870000000000000,50.130000000000000,0.320000000000000,0.516500000000001 12 | 16-Apr-10,50.120000000000000,49.200000000000000,49.530000000000000,0.930000000000000,0.557850000000001 13 | 19-Apr-10,49.660000000000000,48.900000000000000,49.500000000000000,0.759999999999998,0.578065000000000 14 | 20-Apr-10,49.880000000000000,49.430000000000000,49.750000000000000,0.450000000000003,0.565258500000001 15 | 21-Apr-10,50.190000000000000,49.725000000000000,50.030000000000000,0.464999999999996,0.555232650000000 16 | 22-Apr-10,50.360000000000000,49.260000000000000,50.310000000000000,1.100000000000000,0.609709385000000 17 | 23-Apr-10,50.570000000000000,50.090000000000000,50.520000000000000,0.479999999999997,0.596738446500000 18 | 26-Apr-10,50.650000000000000,50.300000000000000,50.410000000000000,0.350000000000001,0.572064601850000 19 | 27-Apr-10,50.430000000000000,49.210000000000000,49.340000000000000,1.220000000000000,0.636858141665000 20 | 28-Apr-10,49.630000000000000,48.980000000000000,49.370000000000000,0.650000000000006,0.638172327498501 21 | 29-Apr-10,50.330000000000000,49.610000000000000,50.230000000000000,0.960000000000001,0.670355094748651 22 | 30-Apr-10,50.290000000000000,49.200000000000000,49.237500000000000,1.090000000000000,0.712319585273785 23 | 03-May-10,50.170000000000000,49.430000000000000,49.930000000000000,0.932500000000005,0.734337626746407 24 | 04-May-10,49.320000000000000,48.080000000000000,48.430000000000000,1.850000000000000,0.845903864071767 25 | 05-May-10,48.500000000000000,47.640000000000000,48.180000000000000,0.859999999999999,0.847313477664590 26 | 06-May-10,48.320100000000000,41.550000000000000,46.570000000000000,6.770100000000000,1.439592129898130 27 | 07-May-10,46.800000000000000,44.283300000000000,45.410000000000000,2.516700000000000,1.547302916908320 28 | 10-May-10,47.800000000000000,47.310000000000000,47.770000000000000,2.390000000000000,1.631572625217490 29 | 11-May-10,48.390000000000000,47.200000000000000,47.720000000000000,1.190000000000000,1.587415362695740 30 | 12-May-10,48.660000000000000,47.900000000000000,48.620000000000000,0.939999999999998,1.522673826426160 31 | 13-May-10,48.790000000000000,47.730100000000000,47.850000000000000,1.059900000000000,1.476396443783550 -------------------------------------------------------------------------------- /test/data/cs-bbands.csv: -------------------------------------------------------------------------------- 1 | Date,Close,MiddleBand,20-day Standard Deviation,HighBand,LowBand,WidthBand,CrossUp,CrossDown,PercentageBand 2 | 1-May-09,86.155700,,,,,,,, 3 | 4-May-09,89.086700,,,,,,,, 4 | 5-May-09,88.782900,,,,,,,, 5 | 6-May-09,90.322800,,,,,,,, 6 | 7-May-09,89.067100,,,,,,,, 7 | 8-May-09,91.145300,,,,,,,, 8 | 11-May-09,89.439700,,,,,,,, 9 | 12-May-09,89.175000,,,,,,,, 10 | 13-May-09,86.930200,,,,,,,, 11 | 14-May-09,87.675200,,,,,,,, 12 | 15-May-09,86.959600,,,,,,,, 13 | 18-May-09,89.429900,,,,,,,, 14 | 19-May-09,89.322100,,,,,,,, 15 | 20-May-09,88.724100,,,,,,,, 16 | 21-May-09,87.449700,,,,,,,, 17 | 22-May-09,87.263400,,,,,,,, 18 | 26-May-09,89.498500,,,,,,,, 19 | 27-May-09,87.900600,,,,,,,, 20 | 28-May-09,89.126000,,,,,,,, 21 | 29-May-09,90.704300,88.707940,1.291961,91.291862,86.124018,5.825685,0,0,0.886304 22 | 1-Jun-09,92.900100,89.045160,1.452054,91.949268,86.141052,6.522775,1,0,1.163705 23 | 2-Jun-09,92.978400,89.239745,1.686425,92.612595,85.866895,7.559076,1,0,1.054228 24 | 3-Jun-09,91.802100,89.390705,1.771747,92.934200,85.847210,7.928105,0,0,0.840257 25 | 4-Jun-09,92.664700,89.507800,1.902075,93.311950,85.703650,8.500153,0,0,0.914928 26 | 5-Jun-09,92.684300,89.688660,2.019895,93.728450,85.648870,9.008474,0,0,0.870767 27 | 8-Jun-09,92.302100,89.746500,2.076546,93.899592,85.593408,9.255162,0,0,0.807674 28 | 9-Jun-09,92.772500,89.913140,2.176557,94.266255,85.560025,9.682934,0,0,0.828427 29 | 10-Jun-09,92.537300,90.081255,2.241921,94.565096,85.597414,9.955104,0,0,0.773877 30 | 11-Jun-09,92.949000,90.382195,2.202359,94.786912,85.977478,9.746870,0,0,0.791370 31 | 12-Jun-09,93.203900,90.658630,2.192185,95.043001,86.274259,9.672264,0,0,0.790266 32 | 15-Jun-09,91.066900,90.863995,2.021805,94.907605,86.820385,8.900357,0,0,0.525090 33 | 16-Jun-09,89.831800,90.884090,2.009411,94.902912,86.865268,8.843839,0,0,0.369080 34 | 17-Jun-09,89.743500,90.905160,1.995080,94.895320,86.915000,8.778732,0,0,0.354434 35 | 18-Jun-09,90.399400,90.988925,1.936044,94.861013,87.116837,8.511119,0,0,0.423875 36 | 19-Jun-09,90.738700,91.153375,1.760127,94.673629,87.633121,7.723804,0,0,0.441102 37 | 22-Jun-09,88.017700,91.191090,1.682751,94.556593,87.825587,7.381210,0,0,0.028541 38 | 23-Jun-09,88.086700,91.120500,1.779126,94.678752,87.562248,7.809991,0,0,0.073695 39 | 24-Jun-09,86.843900,91.067665,1.886418,94.840502,87.294828,8.285788,0,1,-0.059760 40 | 25-Jun-09,90.778100,91.150270,1.835059,94.820387,87.480153,8.052894,0,0,0.449297 41 | 26-Jun-09,90.541600,91.142135,1.837377,94.816889,87.467381,8.063786,0,0,0.418289 42 | 29-Jun-09,91.389400,91.066600,1.794097,94.654793,87.478407,7.880372,0,0,0.544981 43 | 30-Jun-09,90.650000,90.950180,1.741022,94.432224,87.468136,7.657037,0,0,0.456896 44 | -------------------------------------------------------------------------------- /test/data/cs-cci.csv: -------------------------------------------------------------------------------- 1 | Microsoft Date,Open,High,Low,Close,Typical Price,20-day SMA of TP,20-day Mean Deviation,CCI,,,, 2 | 24-Aug-10,23.9429,24.2013,23.8534,23.8932,23.9826,,,,,,, 3 | 25-Aug-10,23.8534,24.0721,23.7242,23.9528,23.9164,,,,,,, 4 | 26-Aug-10,23.9429,24.0423,23.6447,23.6745,23.7872,,,,,,, 5 | 27-Aug-10,23.7342,23.8733,23.3664,23.7839,23.6745,,,,,,, 6 | 30-Aug-10,23.5950,23.6745,23.4559,23.4956,23.5420,,,,,,, 7 | 31-Aug-10,23.4559,23.5851,23.1776,23.3217,23.3615,,,,,,, 8 | 1-Sep-10,23.5255,23.8037,23.3962,23.7540,23.6513,,,,,,, 9 | 2-Sep-10,23.7342,23.8036,23.5652,23.7938,23.7209,,,,,,, 10 | 3-Sep-10,24.0920,24.3007,24.0522,24.1417,24.1649,,,,,,, 11 | 7-Sep-10,23.9528,24.1516,23.7739,23.8137,23.9131,,,,,,, 12 | 8-Sep-10,23.9230,24.0522,23.5950,23.7839,23.8104,,,,,,, 13 | 9-Sep-10,24.0423,24.0622,23.8435,23.8634,23.9230,,,,,,, 14 | 10-Sep-10,23.8336,23.8833,23.6447,23.7044,23.7441,,,,,,, 15 | 13-Sep-10,24.0522,25.1356,23.9429,24.9567,24.6784,,,,,,, 16 | 14-Sep-10,24.8871,25.1952,24.7380,24.8771,24.9368,,,,,,, 17 | 15-Sep-10,24.9467,25.0660,24.7678,24.9616,24.9318,,,,,,, 18 | 16-Sep-10,24.9070,25.2151,24.8970,25.1753,25.0958,,,,,,, 19 | 17-Sep-10,25.2449,25.3741,24.9268,25.0660,25.1223,,,,,,, 20 | 20-Sep-10,25.1256,25.3642,24.9567,25.2747,25.1985,,,,,,, 21 | 21-Sep-10,25.2648,25.2648,24.9268,24.9964,25.0627,24.2109,0.5550,102.3150,,,, 22 | 22-Sep-10,24.7380,24.8175,24.2112,24.4597,24.4961,24.2366,0.5630,30.7360,,,, 23 | 23-Sep-10,24.3603,24.4398,24.2112,24.2808,24.3106,24.2563,0.5526,6.5516,,,, 24 | 24-Sep-10,24.4895,24.6485,24.4299,24.6237,24.5674,24.2953,0.5447,33.2964,,,, 25 | 27-Sep-10,24.6982,24.8374,24.4398,24.5815,24.6196,24.3426,0.5284,34.9514,,,, 26 | 28-Sep-10,24.6485,24.7479,24.2013,24.5268,24.4920,24.3901,0.4911,13.8401,,,, 27 | 29-Sep-10,24.4796,24.5094,24.2510,24.3504,24.3703,24.4405,0.4356,-10.7478,,,, 28 | 30-Sep-10,24.4597,24.6784,24.2112,24.3404,24.4100,24.4784,0.3939,-11.5821,,,, 29 | 1-Oct-10,24.6187,24.6684,24.1516,24.2311,24.3504,24.5099,0.3624,-29.3472,,,, 30 | 4-Oct-10,23.8137,23.8435,23.6348,23.7640,23.7474,24.4890,0.3822,-129.3557,,,, 31 | 5-Oct-10,23.9131,24.3007,23.7640,24.2013,24.0887,24.4978,0.3733,-73.0696,,,, 32 | -------------------------------------------------------------------------------- /test/data/cs-dc.csv: -------------------------------------------------------------------------------- 1 | date,high,low,close,average,upper_band,lower_band,middle_band,dc_percentage,dc_band_width 2 | 2010-01-07,48.700000000000000,47.790000000000000,48.160000000000000,,,,,, 3 | 2010-01-08,48.720000000000000,48.140000000000000,48.610000000000000,,,,,, 4 | 2010-01-09,48.900000000000000,48.390000000000000,48.750000000000000,,,,,, 5 | 2010-01-10,48.870000000000000,48.370000000000000,48.630000000000000,,,,,, 6 | 2010-01-11,48.820000000000000,48.240000000000000,48.740000000000000,,,,,, 7 | 2010-01-12,49.050000000000000,48.635000000000000,49.030000000000000,,,,,, 8 | 2010-01-13,49.200000000000000,48.940000000000000,49.070000000000000,,,,,, 9 | 2010-01-14,49.350000000000000,48.860000000000000,49.320000000000000,,,,,, 10 | 2010-01-15,49.920000000000000,49.500000000000000,49.910000000000000,,,,,, 11 | 2010-01-16,50.190000000000000,49.870000000000000,50.130000000000000,,,,,, 12 | 2010-01-17,50.120000000000000,49.200000000000000,49.530000000000000,,,,,, 13 | 2010-01-18,49.660000000000000,48.900000000000000,49.500000000000000,,,,,, 14 | 2010-01-19,49.880000000000000,49.430000000000000,49.750000000000000,,,,,, 15 | 2010-01-20,50.190000000000000,49.725000000000000,50.030000000000000,,,,,, 16 | 2010-01-21,50.360000000000000,49.260000000000000,50.310000000000000,,,,,, 17 | 2010-01-22,50.570000000000000,50.090000000000000,50.520000000000000,,,,,, 18 | 2010-01-23,50.650000000000000,50.300000000000000,50.410000000000000,,,,,, 19 | 2010-01-24,50.430000000000000,49.210000000000000,49.340000000000000,,,,,, 20 | 2010-01-25,49.630000000000000,48.980000000000000,49.370000000000000,,,,,, 21 | 2010-01-26,50.330000000000000,49.610000000000000,50.230000000000000,49.46700,50.65,47.79,49.22,0.8531468531,5.781632199 22 | 2010-01-27,50.290000000000000,49.200000000000000,49.237500000000000,49.52088,50.65,48.14,49.40,0.437250996,5.068569568 23 | 2010-01-28,50.170000000000000,49.430000000000000,49.930000000000000,49.58688,50.65,48.24,49.45,0.7012448133,4.860157048 24 | 2010-01-29,49.320000000000000,48.080000000000000,48.430000000000000,49.57088,50.65,48.08,49.37,0.1361867704,5.184495936 25 | 2010-01-30,48.500000000000000,47.640000000000000,48.500000000000000,49.56438,50.65,47.64,49.15,0.2857142857,6.07291023 26 | 2010-01-31,48.320100000000000,41.550000000000000,46.570000000000000,49.45588,50.65,41.55,46.10,0.5516483516,18.40024062 27 | 2010-02-01,46.800000000000000,44.283300000000000,45.410000000000000,49.27488,50.65,41.55,46.10,0.4241758242,18.4678297 28 | 2010-02-02,47.800000000000000,47.310000000000000,47.770000000000000,49.20988,50.65,41.55,46.10,0.6835164835,18.49222336 29 | 2010-02-03,48.390000000000000,47.200000000000000,47.720000000000000,49.12988,50.65,41.55,46.10,0.678021978,18.52233493 30 | 2010-02-04,48.660000000000000,47.900000000000000,48.620000000000000,49.06538,50.65,41.55,46.10,0.7769230769,18.54668389 31 | 2010-02-05,48.790000000000000,47.730100000000000,47.850000000000000,48.95138,50.65,41.55,46.10,0.6923076923,18.58987618 -------------------------------------------------------------------------------- /test/data/cs-dc2.csv: -------------------------------------------------------------------------------- 1 | date,high,low,close,average,upper_band,lower_band,middle_band,dc_percentage,dc_band_width 2 | 2010-01-07,48.700000000000000,47.790000000000000,48.160000000000000,,,,,, 3 | 2010-01-08,48.720000000000000,48.140000000000000,48.610000000000000,,,,,, 4 | 2010-01-09,48.900000000000000,48.390000000000000,48.750000000000000,,,,,, 5 | 2010-01-10,48.870000000000000,48.370000000000000,48.630000000000000,,,,,, 6 | 2010-01-11,48.820000000000000,48.240000000000000,48.740000000000000,,,,,, 7 | 2010-01-12,49.050000000000000,48.635000000000000,49.030000000000000,,,,,, 8 | 2010-01-13,49.200000000000000,48.940000000000000,49.070000000000000,,,,,, 9 | 2010-01-14,49.350000000000000,48.860000000000000,49.320000000000000,,,,,, 10 | 2010-01-15,49.920000000000000,49.500000000000000,49.910000000000000,,,,,, 11 | 2010-01-16,50.190000000000000,49.870000000000000,50.130000000000000,,,,,, 12 | 2010-01-17,50.120000000000000,49.200000000000000,49.530000000000000,,,,,, 13 | 2010-01-18,49.660000000000000,48.900000000000000,49.500000000000000,,,,,, 14 | 2010-01-19,49.880000000000000,49.430000000000000,49.750000000000000,,,,,, 15 | 2010-01-20,50.190000000000000,49.725000000000000,50.030000000000000,,,,,, 16 | 2010-01-21,50.360000000000000,49.260000000000000,50.310000000000000,,,,,, 17 | 2010-01-22,50.570000000000000,50.090000000000000,50.520000000000000,,,,,, 18 | 2010-01-23,50.650000000000000,50.300000000000000,50.410000000000000,,,,,, 19 | 2010-01-24,50.430000000000000,49.210000000000000,49.340000000000000,,,,,, 20 | 2010-01-25,49.630000000000000,48.980000000000000,49.370000000000000,,,,,, 21 | 2010-01-26,50.330000000000000,49.610000000000000,50.230000000000000,,,,,, 22 | 2010-01-27,50.290000000000000,49.200000000000000,49.237500000000000,49.46700,50.65,47.79,49.22,0.8531468531,5.781632199 23 | 2010-01-28,50.170000000000000,49.430000000000000,49.930000000000000,49.52088,50.65,48.14,49.40,0.437250996,5.068569568 24 | 2010-01-29,49.320000000000000,48.080000000000000,48.430000000000000,49.58688,50.65,48.24,49.45,0.7012448133,4.860157048 25 | 2010-01-30,48.500000000000000,47.640000000000000,48.500000000000000,49.57088,50.65,48.08,49.37,0.1361867704,5.184495936 26 | 2010-01-31,48.320100000000000,41.550000000000000,46.570000000000000,49.56438,50.65,47.64,49.15,0.2857142857,6.07291023 27 | 2010-02-01,46.800000000000000,44.283300000000000,45.410000000000000,49.45588,50.65,41.55,46.10,0.5516483516,18.40024062 28 | 2010-02-02,47.800000000000000,47.310000000000000,47.770000000000000,49.27488,50.65,41.55,46.10,0.4241758242,18.4678297 29 | 2010-02-03,48.390000000000000,47.200000000000000,47.720000000000000,49.20988,50.65,41.55,46.10,0.6835164835,18.49222336 30 | 2010-02-04,48.660000000000000,47.900000000000000,48.620000000000000,49.12988,50.65,41.55,46.10,0.678021978,18.52233493 31 | 2010-02-05,48.790000000000000,47.730100000000000,47.850000000000000,49.06538,50.65,41.55,46.10,0.7769230769,18.54668389 -------------------------------------------------------------------------------- /test/data/cs-easeofmovement.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Volume,EMV,SMA_EMV 2 | 18-Jun-12,63.740000000,62.630000000,32178836.000000000,, 3 | 19-Jun-12,64.510000000,63.850000000,36461672.000000000,1.801069353, 4 | 20-Jun-12,64.570000000,63.810000000,51372680.000000000,0.014793855, 5 | 21-Jun-12,64.310000000,62.620000000,42476356.000000000,-2.884545934, 6 | 22-Jun-12,63.430000000,62.730000000,29504176.000000000,-0.913430017, 7 | 25-Jun-12,62.850000000,61.950000000,33098600.000000000,-1.849020805, 8 | 26-Jun-12,62.700000000,62.060000000,30577960.000000000,-0.041860216, 9 | 27-Jun-12,63.180000000,62.690000000,35693928.000000000,0.761894292, 10 | 28-Jun-12,62.470000000,61.540000000,49768136.000000000,-1.737858938, 11 | 29-Jun-12,64.160000000,63.210000000,44759968.000000000,3.565686195, 12 | 2-Jul-12,64.380000000,63.870000000,33425504.000000000,0.671343654, 13 | 3-Jul-12,64.890000000,64.290000000,15895085.000000000,1.755259566, 14 | 5-Jul-12,65.250000000,64.480000000,37015388.000000000,0.572059382, 15 | 6-Jul-12,64.690000000,63.650000000,40672116.000000000,-1.777138913, 16 | 9-Jul-12,64.260000000,63.680000000,35627200.000000000,-0.325593928,-0.027667318 17 | 10-Jul-12,64.510000000,63.120000000,47337336.000000000,-0.455137568,-0.188824955 18 | 11-Jul-12,63.460000000,62.500000000,43373576.000000000,-1.848129838,-0.321890933 19 | 12-Jul-12,62.690000000,61.860000000,57651752.000000000,-1.014973491,-0.188350045 20 | 13-Jul-12,63.520000000,62.560000000,32357184.000000000,2.269665988,0.039013956 21 | 16-Jul-12,63.520000000,62.950000000,27620876.000000000,0.402413015,0.199830657 22 | 17-Jul-12,63.740000000,62.630000000,42467704.000000000,-0.130687546,0.193485848 23 | 18-Jul-12,64.580000000,63.390000000,44460240.000000000,2.141239004,0.292010470 24 | 19-Jul-12,65.310000000,64.720000000,52992592.000000000,1.146764061,0.498054970 25 | 20-Jul-12,65.100000000,64.210000000,40561552.000000000,-0.789910603,0.186940913 26 | 23-Jul-12,63.680000000,62.510000000,48636228.000000000,-3.752758129,-0.129066357 27 | 24-Jul-12,63.660000000,62.550000000,57230032.000000000,0.019395411,-0.253056654 28 | 25-Jul-12,62.950000000,62.150000000,46260856.000000000,-0.959774718,-0.362473375 29 | 26-Jul-12,63.730000000,62.970000000,41926492.000000000,1.450157099,-0.131952232 30 | 27-Jul-12,64.990000000,63.640000000,42620976.000000000,3.056593542,0.109632588 31 | 30-Jul-12,65.310000000,64.600000000,37809176.000000000,1.201824658,0.227987032 32 | -------------------------------------------------------------------------------- /test/data/cs-fi.csv: -------------------------------------------------------------------------------- 1 | Date,Close,Volume,FI_1,FI 2 | 25/06/2010,14.33,,, 3 | 25/06/2011,14.23,45579,-4557.9,-4557.9 4 | 25/06/2012,13.98,66285,-16571.25,-6274.092857 5 | 25/06/2013,13.96,51761,-1035.22,-5525.682449 6 | 25/06/2014,13.93,69341,-2080.23,-5033.474956 7 | 25/06/2015,13.84,41631,-3746.79,-4849.66282 8 | 25/06/2016,13.99,73499,11024.85,-2581.875274 9 | 25/06/2017,14.31,55427,17736.64,320.7697651 10 | 25/06/2018,14.51,61082,12216.4,2020.145513 11 | 25/06/2019,14.46,33325,-1666.25,1493.517583 12 | 25/06/2020,14.61,39191,5878.65,2119.965071 13 | 25/06/2021,14.48,51128,-6646.64,867.5929178 14 | 25/06/2022,14.53,46505,2325.25,1075.829644 15 | 25/06/2023,14.56,44562,1336.86,1113.119695 16 | 25/06/2024,14.25,48815,-15132.65,-1207.704547 17 | 25/06/2025,14.42,33411,5679.87,-223.7653263 18 | 25/06/2026,14.24,48157,-8668.26,-1430.121708 19 | 25/06/2027,14.19,43199,-2159.95,-1534.382893 20 | 25/06/2028,14.5,45773,14189.63,711.9046633 21 | 25/06/2029,14.27,54338,-12497.74,-1175.187431 22 | 25/06/2030,14.7,56692,24377.56,2475.205059 23 | 25/06/2031,14.95,61971,15492.75,4334.854336 24 | 25/06/2032,14.68,41212,-11127.24,2125.983717 25 | 25/06/2033,14.77,59785,5380.65,2590.936043 26 | 25/06/2034,14.68,44986,-4048.74,1642.410894 27 | 25/06/2035,15.15,55929,26286.63,5163.013623 28 | 25/06/2036,15.99,162619,136599.96,23939.72025 29 | 25/06/2037,16.27,73914,20695.92,23476.32021 30 | 25/06/2038,16.02,74485,-18621.25,17462.38161 31 | 25/06/2039,16.07,52163,2608.15,15340.34852 32 | -------------------------------------------------------------------------------- /test/data/cs-kama.csv: -------------------------------------------------------------------------------- 1 | Date,Close,ABS (Close - Close 10 periods ago),ABS (Close - Prior Close),ER,2/(fastest + 1),2/(slowest + 1),SC,KAMA 2 | 28/05/2015,110.460000,,,,,,, 3 | 29/05/2015,109.800000,,0.660000,,,,, 4 | 01/06/2015,110.170000,,0.370000,,,,, 5 | 02/06/2015,109.820000,,0.350000,,,,, 6 | 03/06/2015,110.150000,,0.330000,,,,, 7 | 04/06/2015,109.310000,,0.840000,,,,, 8 | 05/06/2015,109.050000,,0.260000,,,,, 9 | 08/06/2015,107.940000,,1.110000,,,,, 10 | 09/06/2015,107.760000,,0.180000,,,,, 11 | 10/06/2015,109.240000,,1.480000,,,,,109.240000 12 | 11/06/2015,109.400000,1.060000,0.160000,0.184669,0.064516,0.666667,0.030876,109.244940 13 | 12/06/2015,108.500000,1.300000,0.900000,0.217391,0.064516,0.666667,0.038188,109.216492 14 | 15/06/2015,107.960000,2.210000,0.540000,0.359350,0.064516,0.666667,0.078904,109.117350 15 | 16/06/2015,108.550000,1.270000,0.590000,0.198748,0.064516,0.666667,0.033927,109.098101 16 | 17/06/2015,108.850000,1.300000,0.300000,0.204403,0.064516,0.666667,0.035193,109.089370 17 | 18/06/2015,110.440000,1.130000,1.590000,0.158931,0.064516,0.666667,0.025669,109.124040 18 | 19/06/2015,109.890000,0.840000,0.550000,0.113514,0.064516,0.666667,0.017654,109.137562 19 | 22/06/2015,110.700000,2.760000,0.810000,0.388732,0.064516,0.666667,0.089157,109.276864 20 | 23/06/2015,110.790000,3.030000,0.090000,0.432240,0.064516,0.666667,0.105488,109.436482 21 | 24/06/2015,110.220000,0.980000,0.570000,0.160656,0.064516,0.666667,0.026003,109.456856 22 | 25/06/2015,110.000000,0.600000,0.220000,0.097403,0.064516,0.666667,0.015170,109.465096 23 | 26/06/2015,109.270000,0.770000,0.730000,0.128548,0.064516,0.666667,0.020142,109.461166 24 | 29/06/2015,106.690000,1.270000,2.580000,0.158157,0.064516,0.666667,0.025520,109.390445 25 | 30/06/2015,107.070000,1.480000,0.380000,0.189258,0.064516,0.666667,0.031854,109.316529 26 | 01/07/2015,107.920000,0.930000,0.850000,0.111111,0.064516,0.666667,0.017272,109.292409 27 | 02/07/2015,107.950000,2.490000,0.030000,0.365639,0.064516,0.666667,0.081046,109.183612 28 | 06/07/2015,107.700000,2.190000,0.250000,0.336406,0.064516,0.666667,0.071333,109.077781 29 | 07/07/2015,107.970000,2.730000,0.270000,0.457286,0.064516,0.666667,0.115513,108.949818 30 | 08/07/2015,106.090000,4.700000,1.880000,0.605670,0.064516,0.666667,0.184230,108.422953 31 | 09/07/2015,106.030000,4.190000,0.060000,0.577931,0.064516,0.666667,0.170171,108.015742 32 | 10/07/2015,107.650000,2.350000,1.620000,0.271676,0.064516,0.666667,0.052032,107.996712 33 | 13/07/2015,109.540000,0.270000,1.890000,0.027523,0.064516,0.666667,0.006575,108.006859 34 | 14/07/2015,110.260000,3.570000,0.720000,0.449057,0.064516,0.666667,0.112169,108.259591 35 | 15/07/2015,110.380000,3.310000,0.120000,0.430429,0.064516,0.666667,0.104781,108.481770 36 | 16/07/2015,111.940000,4.020000,1.560000,0.478571,0.064516,0.666667,0.124389,108.911936 37 | 17/07/2015,113.590000,5.640000,1.650000,0.562874,0.064516,0.666667,0.162773,109.673398 38 | 20/07/2015,113.980000,6.280000,0.390000,0.618110,0.064516,0.666667,0.190717,110.494740 39 | 21/07/2015,113.910000,5.940000,0.070000,0.596386,0.064516,0.666667,0.179462,111.107650 40 | 22/07/2015,112.620000,6.530000,1.290000,0.696905,0.064516,0.666667,0.234409,111.462159 41 | 23/07/2015,112.200000,6.170000,0.420000,0.634121,0.064516,0.666667,0.199231,111.609159 42 | 24/07/2015,111.100000,3.450000,1.100000,0.374593,0.064516,0.666667,0.084145,111.566316 43 | 27/07/2015,110.180000,0.640000,0.920000,0.077670,0.064516,0.666667,0.012384,111.549147 44 | 28/07/2015,111.130000,0.870000,0.950000,0.102715,0.064516,0.666667,0.015968,111.542454 45 | 29/07/2015,111.550000,1.170000,0.420000,0.133409,0.064516,0.666667,0.020981,111.542613 46 | 30/07/2015,112.080000,0.140000,0.530000,0.018088,0.064516,0.666667,0.005686,111.545668 47 | 31/07/2015,111.950000,1.640000,0.130000,0.263666,0.064516,0.666667,0.049855,111.565826 48 | 03/08/2015,111.600000,2.380000,0.350000,0.385113,0.064516,0.666667,0.087860,111.568829 49 | 04/08/2015,111.390000,2.520000,0.210000,0.398734,0.064516,0.666667,0.092790,111.552235 50 | 05/08/2015,112.250000,0.370000,0.860000,0.062818,0.064516,0.666667,0.010474,111.559544 51 | -------------------------------------------------------------------------------- /test/data/cs-kc.csv: -------------------------------------------------------------------------------- 1 | date,High,Low,Close,true_range,atr,upper_band,middle_band,lower_band,kc_high_indicator,kc_low_indicator,kc_band_width,kc_percentage 2 | 01-Apr-10,48.700000000000000,47.790000000000000,48.160000000000000,0.910000000000004,0.000000000000000,,48.160000000000000,,,,, 3 | 05-Apr-10,48.720000000000000,48.140000000000000,48.610000000000000,0.579999999999998,0.000000000000000,,48.202857142857100,,,,, 4 | 06-Apr-10,48.900000000000000,48.390000000000000,48.750000000000000,0.509999999999998,0.000000000000000,,48.254965986394600,,,,, 5 | 07-Apr-10,48.870000000000000,48.370000000000000,48.630000000000000,0.500000000000000,0.000000000000000,,48.290683511499800,,,,, 6 | 08-Apr-10,48.820000000000000,48.240000000000000,48.740000000000000,0.579999999999998,0.000000000000000,,48.333475558023700,,,,, 7 | 09-Apr-10,49.050000000000000,48.635000000000000,49.030000000000000,0.414999999999999,0.000000000000000,,48.399811219164300,,,,, 8 | 12-Apr-10,49.200000000000000,48.940000000000000,49.070000000000000,0.260000000000005,0.000000000000000,,48.463638722101000,,,,, 9 | 13-Apr-10,49.350000000000000,48.860000000000000,49.320000000000000,0.490000000000002,0.000000000000000,,48.545196939043800,,,,, 10 | 14-Apr-10,49.920000000000000,49.500000000000000,49.910000000000000,0.600000000000001,0.000000000000000,,48.675178182944400,,,,, 11 | 15-Apr-10,50.190000000000000,49.870000000000000,50.130000000000000,0.320000000000000,0.516500000000001,49.846732641711600,48.813732641711600,47.780732641711600,1.00,0.00,4.232415528,1.13710908 12 | 16-Apr-10,50.120000000000000,49.200000000000000,49.530000000000000,0.930000000000000,0.557850000000001,49.997648580596200,48.881948580596200,47.766248580596200,0.00,0.00,4.564875306,0.7904236889 13 | 19-Apr-10,49.660000000000000,48.900000000000000,49.500000000000000,0.759999999999998,0.578065000000000,50.096940620539400,48.940810620539400,47.784680620539400,0.00,0.00,4.724605029,0.7418367223 14 | 20-Apr-10,49.880000000000000,49.430000000000000,49.750000000000000,0.450000000000003,0.565258500000001,50.148393275726100,49.017876275726100,47.887359275726100,0.00,0.00,4.612672298,0.8238004047 15 | 21-Apr-10,50.190000000000000,49.725000000000000,50.030000000000000,0.464999999999996,0.555232650000000,50.224734311371300,49.114269011371300,48.003803711371300,0.00,0.00,4.52196611,0.9123185968 16 | 22-Apr-10,50.360000000000000,49.260000000000000,50.310000000000000,1.100000000000000,0.609709385000000,50.447566923145400,49.228148153145400,48.008729383145400,0.00,0.00,4.954152515,0.9435932403 17 | 23-Apr-10,50.570000000000000,50.090000000000000,50.520000000000000,0.479999999999997,0.596738446500000,50.544658555369700,49.351181662369700,48.157704769369700,0.00,0.00,4.836669975,0.9896694458 18 | 26-Apr-10,50.650000000000000,50.300000000000000,50.410000000000000,0.350000000000001,0.572064601850000,50.596150707748800,49.452021504048800,48.307892300348800,0.00,0.00,4.627229257,0.9186496127 19 | 27-Apr-10,50.430000000000000,49.210000000000000,49.340000000000000,1.220000000000000,0.636858141665000,50.715069072707500,49.441352789377500,48.167636506047400,0.00,0.00,5.15243298,0.4602137498 20 | 28-Apr-10,49.630000000000000,48.980000000000000,49.370000000000000,0.650000000000006,0.638172327498501,50.710901940624200,49.434557285627200,48.158212630630200,0.00,0.00,5.163774999,0.4747100889 21 | 29-Apr-10,50.330000000000000,49.610000000000000,50.230000000000000,0.960000000000001,0.670355094748651,50.851023924112400,49.510313734615100,48.169603545117800,0.00,0.00,5.415882423,0.7683974027 22 | 30-Apr-10,50.290000000000000,49.200000000000000,49.237500000000000,1.090000000000000,0.712319585273785,50.908970644723100,49.484331474175600,48.059692303628000,0.00,0.00,5.757940456,0.4133705294 23 | 03-May-10,50.170000000000000,49.430000000000000,49.930000000000000,0.932500000000005,0.734337626746407,50.995451349175500,49.526776095682700,48.058100842189800,0.00,0.00,5.930833255,0.6372746982 24 | 04-May-10,49.320000000000000,48.080000000000000,48.430000000000000,1.850000000000000,0.845903864071767,51.114128957570700,49.422321229427200,47.730513501283600,0.00,0.00,6.846330508,0.2067275397 25 | 05-May-10,48.500000000000000,47.640000000000000,48.180000000000000,0.859999999999999,0.847313477664590,50.998631877191800,49.304004921862700,47.609377966533500,0.00,0.00,6.874195952,0.1683621377 26 | 06-May-10,48.320100000000000,41.550000000000000,46.570000000000000,6.770100000000000,1.439592129898130,51.922807760529100,49.043623500732900,46.164439240936600,0.00,0.00,11.74131948,0.07042980276 27 | 07-May-10,46.800000000000000,44.283300000000000,45.410000000000000,2.516700000000000,1.547302916908320,51.792169953527300,48.697564119710700,45.602958285894100,0.00,1.00,12.70948923,-0.03117655305 28 | 10-May-10,47.800000000000000,47.310000000000000,47.770000000000000,2.390000000000000,1.631572625217490,51.872369930173200,48.609224679738300,45.346079429303300,0.00,0.00,13.42603291,0.3714086234 29 | 11-May-10,48.390000000000000,47.200000000000000,47.720000000000000,1.190000000000000,1.587415362695740,51.699367340392800,48.524536615001300,45.349705889609800,0.00,0.00,13.0854654,0.3732945652 30 | 12-May-10,48.660000000000000,47.900000000000000,48.620000000000000,0.939999999999998,1.522673826426160,51.578976018805900,48.533628365953500,45.488280713101200,0.00,0.00,12.54943327,0.5141809153 31 | 13-May-10,48.790000000000000,47.730100000000000,47.850000000000000,1.059900000000000,1.476396443783550,51.421313790096500,48.468520902529400,45.515728014962300,0.00,0.00,12.18437383,0.3952651056 -------------------------------------------------------------------------------- /test/data/cs-macd.csv: -------------------------------------------------------------------------------- 1 | Date,Close,short_ema,long_ema,MACD_line,MACD_signal,MACD_diff 2 | 11-Feb-09,30.2,30.2,30.2,,, 3 | 12-Feb-09,30.28,30.21230769,30.20592593,0.006381766382,, 4 | 13-Feb-09,30.45,30.24887574,30.22400549,0.02487025268,-0.1291444063,0.154014659 5 | 17-Feb-09,29.35,30.11058716,30.15926434,-0.04867717547,-0.1130509601,0.06437378466 6 | 18-Feb-09,29.35,29.99357375,30.09931883,-0.1057450787,-0.1115897839,0.005844705136 7 | 19-Feb-09,29.29,29.88533164,30.03936929,-0.1540376516,-0.1200793574,-0.03395829419 8 | 20-Feb-09,28.83,29.72297292,29.94978638,-0.2268134548,-0.1414261769,-0.08538727793 9 | 23-Feb-09,28.73,29.57020786,29.85943183,-0.2892239735,-0.1709857362,-0.1182382373 10 | 24-Feb-09,28.67,29.43171434,29.77132577,-0.3396114287,-0.2047108747,-0.134900554 11 | 25-Feb-09,28.85,29.34221983,29.70307942,-0.3608595895,-0.2359406177,-0.1249189718 12 | 26-Feb-09,28.64,29.23418601,29.62433279,-0.3901467857,-0.2667818513,-0.1233649344 13 | 27-Feb-09,27.68,28.99508047,29.48030814,-0.485227674,-0.3104710158,-0.1747566582 14 | 02-Mar-09,27.21,28.7204527,29.31213717,-0.5916844649,-0.3667137056,-0.2249707593 15 | 03-Mar-09,26.87,28.43576767,29.13123812,-0.6954704468,-0.4324650539,-0.2630053929 16 | 04-Mar-09,27.41,28.27795726,29.003739,-0.725781738,-0.4911283907,-0.2346533473 17 | 05-Mar-09,26.94,28.07211768,28.85086944,-0.7787517612,-0.5486530648,-0.2300986964 18 | 06-Mar-09,26.52,27.83333035,28.67821245,-0.8448821012,-0.6078988721,-0.2369832291 19 | 09-Mar-09,26.52,27.63127952,28.51834486,-0.8870653351,-0.6637321647,-0.2233331704 20 | 10-Mar-09,27.09,27.54800575,28.41254154,-0.8645357851,-0.7038928888,-0.1606428964 21 | 11-Mar-09,27.69,27.56985102,28.35901994,-0.7891689208,-0.7209480952,-0.06822082565 22 | 12-Mar-09,28.45,27.70525856,28.3657592,-0.6605006491,-0.708858606,0.04835795684 23 | 13-Mar-09,28.53,27.83214185,28.37792519,-0.5457833348,-0.6762435517,0.1304602169 24 | 16-Mar-09,28.67,27.96104311,28.39956036,-0.4385172529,-0.628698292,0.1901810391 25 | 17-Mar-09,29.01,28.12242109,28.44477811,-0.3223570205,-0.5674300377,0.2450730171 26 | 18-Mar-09,29.87,28.39127939,28.5503501,-0.1590707186,-0.4857581739,0.3266874553 27 | 19-Mar-09,29.8,28.60800563,28.64291676,-0.03491112915,-0.3955887649,0.3606776358 28 | 20-Mar-09,29.75,28.78369707,28.72492293,0.05877414612,-0.3047161827,0.3634903288 29 | 23-Mar-09,30.65,29.0708206,28.86752123,0.2032993715,-0.2031130719,0.4064124434 30 | 24-Mar-09,30.6,29.30607897,28.99585299,0.3102259798,-0.1004452615,0.4106712413 31 | 25-Mar-09,30.76,29.52975913,29.12653055,0.4032285819,0.0002895071518,0.4029390748 32 | 26-Mar-09,31.17,29.78210388,29.27789865,0.5042052237,0.1010726505,0.4031325732 33 | 27-Mar-09,30.89,29.95254944,29.39731357,0.5552358664,0.1919052936,0.3633305728 34 | 30-Mar-09,30.04,29.96600337,29.44491997,0.5210833971,0.2577409143,0.2633424828 35 | 31-Mar-09,30.66,30.07277208,29.5349259,0.5378461816,0.3137619678,0.2240842138 36 | 01-Apr-09,30.6,30.15388407,29.61382028,0.5400637913,0.3590223325,0.1810414588 37 | 02-Apr-09,31.97,30.43328652,29.78835211,0.644934411,0.4162047482,0.2287296628 38 | 03-Apr-09,32.1,30.68970398,29.95958529,0.7301186924,0.478987537,0.2511311553 39 | 06-Apr-09,32.03,30.89590337,30.11294934,0.7829540275,0.5397808351,0.2431731923 40 | 07-Apr-09,31.63,31.00884131,30.22532346,0.7835178481,0.5885282377,0.1949896104 41 | 08-Apr-09,31.85,31.13825034,30.34566987,0.7925804671,0.6293386836,0.1632417835 42 | 09-Apr-09,32.71,31.38005798,30.52080544,0.8592525422,0.6753214553,0.1839310869 43 | 13-Apr-09,32.76,31.59235675,30.6866717,0.9056850507,0.7213941744,0.1842908763 44 | 14-Apr-09,32.58,31.74430187,30.82691824,0.9173836252,0.7605920646,0.1567915606 45 | 15-Apr-09,32.13,31.80364004,30.92344282,0.8801972248,0.7845130966,0.09568412822 46 | 16-Apr-09,33.12,32.00615696,31.08615076,0.920006202,0.8116117177,0.1083944844 47 | 17-Apr-09,33.19,32.18828666,31.24199144,0.9462952161,0.8385484174,0.1077467987 48 | 20-Apr-09,32.52,32.23931948,31.33665874,0.9026607374,0.8513708814,0.05128985605 49 | 21-Apr-09,32.44,32.27019341,31.41838772,0.8518056817,0.8514578414,0.000347840223 50 | 22-Apr-09,33.22,32.4163175,31.55184048,0.864477012,0.8540616755,0.01041533642 51 | 23-Apr-09,32.83,32.47996096,31.64651897,0.8334419914,0.8499377387,-0.01649574731 52 | 24-Apr-09,33.62,32.65535158,31.79270275,0.862648833,0.8524799576,0.01016887539 53 | 27-Apr-09,33.75,32.82375903,31.93768773,0.8860713005,0.8591982261,0.02687307431 54 | 28-Apr-09,33.6,32.94318072,32.06082197,0.8823587459,0.8638303301,0.01852841582 55 | 29-Apr-09,34.08,33.11807599,32.21039071,0.9076852773,0.8726013195,0.03508395778 56 | 30-Apr-09,34.58,33.34298738,32.38591733,0.9570700495,0.8894950655,0.06757498394 57 | 01-May-09,34.22,33.4779124,32.5217753,0.9561370926,0.9028234709,0.05331362167 58 | 04-May-09,34.77,33.6766951,32.68831047,0.9883846382,0.9199357044,0.06844893379 59 | 05-May-09,34.74,33.84028047,32.84028747,0.9999930042,0.9359471644,0.06404583986 60 | 06-May-09,35.01,34.02023732,33.00100692,1.019230408,0.952603813,0.06662659472 61 | 07-May-09,34.94,34.16173927,33.14463603,1.017103241,0.9655036986,0.05159954209 62 | 08-May-09,34.42,34.20147169,33.23910744,0.9623642551,0.9648758099,-0.002511554751 63 | 11-May-09,34.4,34.23201451,33.32509948,0.9069150299,0.9532836539,-0.04636862395 64 | 12-May-09,34.16,34.22093535,33.38694396,0.8339913916,0.9294252014,-0.0954338098 65 | 13-May-09,33.34,34.08540684,33.38346663,0.7019402062,0.8839282024,-0.1819879962 66 | 14-May-09,33.39,33.97842117,33.38395059,0.5944705856,0.826036679,-0.2315660935 67 | 15-May-09,33.51,33.90635638,33.39328758,0.5130687964,0.7634431025,-0.2503743061 68 | 18-May-09,33.96,33.91460924,33.43526628,0.4793429639,0.7066230748,-0.2272801109 69 | 19-May-09,34.42,33.99236167,33.50820952,0.4841521496,0.6621288897,-0.1779767401 70 | 20-May-09,34.72,34.10430602,33.59797177,0.5063342507,0.6309699619,-0.1246357112 71 | 21-May-09,33.94,34.07902817,33.6233072,0.4557209766,0.5959201649,-0.1401991882 72 | 22-May-09,33.66,34.0145623,33.62602518,0.3885371183,0.5544435556,-0.1659064373 73 | 26-May-09,34.51,34.09078349,33.6915048,0.3992786866,0.5234105818,-0.1241318951 74 | 27-May-09,34.87,34.21066295,33.77880074,0.4318622095,0.5051009073,-0.07323869778 75 | 28-May-09,34.75,34.29363788,33.85074143,0.4428964545,0.4926600168,-0.04976356229 76 | 29-May-09,35.17,34.42846282,33.94846428,0.4799985386,0.4901277211,-0.01012918252 77 | 01-Jun-09,36.16,34.69485316,34.11228174,0.5825714132,0.5086164595,0.07395495366 78 | 02-Jun-09,36.45,34.96487575,34.28544606,0.6794296892,0.5427791055,0.1366505837 79 | 03-Jun-09,36.03,35.12874102,34.41467228,0.7140687408,0.5770370325,0.1370317083 80 | 04-Jun-09,36.45,35.33201163,34.56543729,0.7665743369,0.6149444934,0.1516298435 81 | 05-Jun-09,36.74,35.54862523,34.72651601,0.8221092133,0.6563774374,0.1657317759 82 | 08-Jun-09,36.61,35.71191365,34.86603334,0.8458803077,0.6942780114,0.1516022962 83 | 09-Jun-09,36.83,35.88392694,35.01151236,0.8724145804,0.7299053252,0.1425092552 84 | 10-Jun-09,36.84,36.0310151,35.14695589,0.8840592148,0.7607361032,0.1233231117 85 | 11-Jun-09,36.89,36.16316662,35.27607026,0.887096359,0.7860081543,0.1010882047 86 | 12-Jun-09,36.38,36.1965256,35.35784284,0.838682767,0.7965430769,0.04213969015 87 | 15-Jun-09,35.99,36.16475243,35.40466929,0.7600831406,0.7892510896,-0.029167949 88 | 16-Jun-09,35.86,36.11786744,35.43839749,0.6794699502,0.7672948617,-0.0878249115 89 | 17-Jun-09,35.88,36.08127245,35.47110879,0.6101636621,0.7358686218,-0.1257049597 90 | 18-Jun-09,35.73,36.02723054,35.49028592,0.5369446196,0.6960838214,-0.1591392018 91 | 19-Jun-09,36.07,36.03381045,35.5332277,0.5005827531,0.6569836077,-0.1564008546 92 | 22-Jun-09,35.6,35.96707038,35.5381738,0.428896587,0.6113662036,-0.1824696166 93 | 23-Jun-09,34.98,35.8152134,35.49682759,0.3183858119,0.5527701252,-0.2343843133 94 | 24-Jun-09,35.58,35.77902673,35.50298851,0.2760382154,0.4974237433,-0.2213855278 95 | 25-Jun-09,36.07,35.82379184,35.54498936,0.2788024835,0.4536994913,-0.1748970078 96 | 26-Jun-09,36.21,35.88320848,35.59424941,0.2889590755,0.4207514082,-0.1317923327 97 | 29-Jun-09,36.46,35.97194564,35.65837908,0.3135665584,0.3993144382,-0.08574787981 98 | 30-Jun-09,36.44,36.043954,35.71627693,0.3276770757,0.3849869657,-0.05730989004 99 | 01-Jul-09,36.54,36.12026877,35.77729345,0.3429753205,0.3765846367,-0.03360931614 100 | 02-Jul-09,35.81,36.07253511,35.77971616,0.292818956,0.3598315005,-0.06701254452 101 | 06-Jul-09,35.26,35.94752971,35.74121867,0.206311047,0.3291274098,-0.1228163628 102 | 07-Jul-09,35.21,35.8340636,35.70186913,0.1321944682,0.2897408215,-0.1575463533 103 | 08-Jul-09,34.59,35.6426692,35.61950846,0.02316074437,0.2364248061,-0.2132640617 104 | 09-Jul-09,34.73,35.50225856,35.55361894,-0.05136038674,0.1788677675,-0.2302281542 105 | 10-Jul-09,34.86,35.40344955,35.50223976,-0.0987902144,0.1233361711,-0.2221263855 106 | 13-Jul-09,35.31,35.38907269,35.48799978,-0.09892708548,0.0788835198,-0.1778106053 107 | 14-Jul-09,35.5,35.40613843,35.48888868,-0.08275025131,0.04655676558,-0.1293070169 108 | 15-Jul-09,36.63,35.59442483,35.57341545,0.02100937947,0.04144728836,-0.02043790888 109 | 16-Jul-09,37.14,35.83220562,35.68945875,0.142746875,0.06170720569,0.08103966935 110 | 17-Jul-09,37.27,36.05340476,35.80653588,0.2468688801,0.09873954058,0.1481293395 111 | 20-Jul-09,37.7,36.3067271,35.94679248,0.3599346234,0.1509785571,0.2089560662 112 | 21-Jul-09,37.87,36.54723063,36.0892523,0.4579783296,0.2123785116,0.245599818 113 | 22-Jul-09,38.38,36.82919515,36.25893731,0.5702578336,0.283954376,0.2863034576 114 | 23-Jul-09,39.17,37.18931897,36.47457158,0.7147473842,0.3701129777,0.3446344066 115 | 24-Jul-09,39.05,37.47557759,36.66534406,0.8102335292,0.458137088,0.3520964412 116 | 27-Jul-09,39.09,37.72395027,36.8449482,0.8790020641,0.5423100832,0.3366919809 117 | 28-Jul-09,39.27,37.96180407,37.02458167,0.9372224027,0.6212925471,0.3159298556 118 | 29-Jul-09,39.11,38.1384496,37.1790571,0.9593924981,0.6889125373,0.2704799608 119 | 30-Jul-09,39.86,38.40330351,37.37764546,1.025658043,0.7562616384,0.2693964045 120 | 31-Jul-09,39.53,38.57664143,37.53707913,1.039562296,0.8129217699,0.2266405257 121 | 03-Aug-09,39.74,38.75561967,37.70025846,1.055361214,0.8614096586,0.1939515551 122 | 04-Aug-09,39.87,38.9270628,37.86098005,1.066082746,0.902344276,0.1637384695 123 | 05-Aug-09,39.82,39.06443775,38.00609264,1.058345111,0.933544443,0.1248006679 124 | 06-Aug-09,39.61,39.14837041,38.12490059,1.023469812,0.9515295168,0.07194029512 125 | 07-Aug-09,39.75,39.24092881,38.24527833,0.9956504772,0.9603537089,0.03529676833 126 | -------------------------------------------------------------------------------- /test/data/cs-mfi.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Close,Typical Price,Up or Down,Volume,Raw Money Flow,1-period Positive Money Flow,1-period Negative Money Flow,14-period Positive Money Flow,14-period Negative Money Flow,14-period Money Flow Ratio,MFI,,, 2 | 3-Dec-10,24.82830,24.32050,24.74860,24.63247,,18730.14400,,,,,,,,,, 3 | 6-Dec-10,24.75860,24.59930,24.70880,24.68890,1.00000,12271.74000,302975.76169,302975.76169,0.00000,,,,,,, 4 | 7-Dec-10,25.15680,24.77850,25.03730,24.99087,1.00000,24691.41400,617059.83509,617059.83509,0.00000,,,,,,, 5 | 8-Dec-10,25.58480,24.94770,25.54500,25.35917,1.00000,18357.60600,465533.59016,465533.59016,0.00000,,,,,,, 6 | 9-Dec-10,25.68440,24.80830,25.06720,25.18663,-1.00000,22964.08000,578387.86280,0.00000,578387.86280,,,,,,, 7 | 10-Dec-10,25.33600,25.05720,25.10700,25.16673,-1.00000,15918.94800,400627.91926,0.00000,400627.91926,,,,,,, 8 | 13-Dec-10,25.28620,24.84820,24.88800,25.00747,-1.00000,16067.04400,401796.06726,0.00000,401796.06726,,,,,,, 9 | 14-Dec-10,25.12690,24.74960,24.99750,24.95800,-1.00000,16568.48700,413516.29855,0.00000,413516.29855,,,,,,, 10 | 15-Dec-10,25.27620,24.92780,25.04730,25.08377,1.00000,16018.72900,401810.06053,401810.06053,0.00000,,,,,,, 11 | 16-Dec-10,25.38570,25.02740,25.33600,25.24970,1.00000,9773.56900,246779.68518,246779.68518,0.00000,,,,,,, 12 | 17-Dec-10,25.53510,25.04730,25.05720,25.21320,-1.00000,22572.71200,569130.30220,0.00000,569130.30220,,,,,,, 13 | 20-Dec-10,25.60480,25.06220,25.44550,25.37083,1.00000,12986.66900,329482.61475,329482.61475,0.00000,,,,,,, 14 | 21-Dec-10,25.74410,25.53510,25.56490,25.61470,1.00000,10906.65900,279370.79829,279370.79829,0.00000,,,,,,, 15 | 22-Dec-10,25.72420,25.45540,25.55500,25.57820,-1.00000,5799.25900,148334.60655,0.00000,148334.60655,,,,,,, 16 | 23-Dec-10,25.67440,25.28620,25.40570,25.45543,-1.00000,7395.27400,188249.90429,0.00000,188249.90429,2643012.34568,2700042.96091,0.97888,49.46631,,, 17 | 27-Dec-10,25.44550,25.16670,25.36580,25.32600,-1.00000,5818.16200,147350.77081,0.00000,147350.77081,2340036.58399,2847393.73172,0.82182,45.10974,,, 18 | 28-Dec-10,25.31610,24.91780,25.03730,25.09040,-1.00000,7164.72600,179765.84123,0.00000,179765.84123,1722976.74891,3027159.57295,0.56917,36.27215,,, 19 | 29-Dec-10,25.25630,24.90790,24.91780,25.02733,-1.00000,5672.91400,141977.90965,0.00000,141977.90965,1257443.15875,3169137.48260,0.39678,28.40665,,, 20 | 30-Dec-10,25.03730,24.82830,24.87800,24.91453,-1.00000,5624.74200,140137.82205,0.00000,140137.82205,1257443.15875,2730887.44185,0.46045,31.52806,,, 21 | 31-Dec-10,25.00740,24.70880,24.96760,24.89460,-1.00000,5023.46900,125057.25137,0.00000,125057.25137,1257443.15875,2455316.77396,0.51213,33.86815,,, 22 | 3-Jan-11,25.30610,25.02740,25.04730,25.12693,1.00000,7457.09100,187373.82842,187373.82842,0.00000,1444816.98717,2053520.70670,0.70358,41.30010,,, 23 | 4-Jan-11,25.11700,24.34040,24.45000,24.63580,-1.00000,11798.00900,290653.39012,0.00000,290653.39012,1444816.98717,1930657.79827,0.74835,42.80337,,, 24 | 5-Jan-11,24.68890,24.27080,24.56940,24.50970,-1.00000,12366.13200,303090.18548,0.00000,303090.18548,1043006.92664,2233747.98375,0.46693,31.83048,,, 25 | 6-Jan-11,24.54950,23.89250,24.02190,24.15463,-1.00000,13294.86500,321132.58929,0.00000,321132.58929,796227.24146,2554880.57304,0.31165,23.76012,,, 26 | 7-Jan-11,24.27080,23.77800,23.88250,23.97710,-1.00000,9256.87000,221952.89768,0.00000,221952.89768,796227.24146,2207703.16852,0.36066,26.50618,,, 27 | 10-Jan-11,24.27080,23.72320,24.20110,24.06503,1.00000,9690.60400,233204.70828,233204.70828,0.00000,699949.33499,2207703.16852,0.31705,24.07266,,, 28 | 11-Jan-11,24.59930,24.20110,24.28070,24.36037,1.00000,8870.31800,216084.19893,216084.19893,0.00000,636662.73563,2207703.16852,0.28838,22.38329,,, 29 | 12-Jan-11,24.47980,24.24090,24.33050,24.35040,-1.00000,7168.96500,174567.16534,0.00000,174567.16534,636662.73563,2233935.72731,0.28500,22.17875,,, 30 | 13-Jan-11,24.55950,23.43450,24.44000,24.14467,-1.00000,11356.18000,274191.18071,0.00000,274191.18071,636662.73563,2319877.00372,0.27444,21.53405,,, 31 | 14-Jan-11,25.16000,24.27000,25.00000,24.81000,1.00000,13379.37400,331942.26894,331942.26894,0.00000,968605.00457,2172526.23291,0.44584,30.83618,,, 32 | -------------------------------------------------------------------------------- /test/data/cs-obv.csv: -------------------------------------------------------------------------------- 1 | Date,Close,Volume,up-down,positive-negative,OBV 2 | 27/11/2010,53.26,,,, 3 | 28/11/2010,53.3,8200,1,8200,8200 4 | 29/11/2010,53.32,8100,1,8100,16300 5 | 30/11/2010,53.72,8300,1,8300,24600 6 | 1/12/2010,54.19,8900,1,8900,33500 7 | 2/12/2010,53.92,9200,-1,-9200,24300 8 | 3/12/2010,54.65,13300,1,13300,37600 9 | 4/12/2010,54.6,10300,-1,-10300,27300 10 | 5/12/2010,54.21,9900,-1,-9900,17400 11 | 6/12/2010,54.53,10100,1,10100,27500 12 | 7/12/2010,53.79,11300,-1,-11300,16200 13 | 8/12/2010,53.66,12600,-1,-12600,3600 14 | 9/12/2010,53.56,10700,-1,-10700,-7100 15 | 10/12/2010,53.57,11500,1,11500,4400 16 | 11/12/2010,53.94,23800,1,23800,28200 17 | 12/12/2010,53.27,14600,-1,-14600,13600 18 | 13/12/2010,53.6,11700,1,11700,25300 19 | 14/12/2010,53.65,10400,1,10400,35700 20 | 15/12/2010,53.62,9500,-1,-9500,26200 21 | 16/12/2010,53.27,13900,-1,-13900,12300 22 | 17/12/2010,53.44,10400,1,10400,22700 23 | 18/12/2010,53.28,4200,-1,-4200,18500 24 | 19/12/2010,53.14,10900,-1,-10900,7600 25 | 20/12/2010,53.31,17600,1,17600,25200 26 | 21/12/2010,54.09,17900,1,17900,43100 27 | 22/12/2010,54.08,15800,-1,-15800,27300 28 | 23/12/2010,54.01,10200,-1,-10200,17100 29 | 24/12/2010,54.17,8700,1,8700,25800 30 | 25/12/2010,54.24,16000,1,16000,41800 31 | 26/12/2010,54.45,12500,1,12500,54300 32 | -------------------------------------------------------------------------------- /test/data/cs-percentr.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Highest High (14),Lowest Low (14),Close,Williams_%R 2 | 23-Feb-10,127.009000,125.357400,,,, 3 | 24-Feb-10,127.615900,126.163300,,,, 4 | 25-Feb-10,126.591100,124.929600,,,, 5 | 26-Feb-10,127.347200,126.093700,,,, 6 | 1-Mar-10,128.173000,126.819900,,,, 7 | 2-Mar-10,128.431700,126.481700,,,, 8 | 3-Mar-10,127.367100,126.034000,,,, 9 | 4-Mar-10,126.422000,124.830100,,,, 10 | 5-Mar-10,126.899500,126.392100,,,, 11 | 8-Mar-10,126.849800,125.715600,,,, 12 | 9-Mar-10,125.646000,124.561500,,,, 13 | 10-Mar-10,125.715600,124.571500,,,, 14 | 11-Mar-10,127.158200,125.068900,,,, 15 | 12-Mar-10,127.715400,126.859700,128.431700,124.561500,127.287600,-29.561780 16 | 15-Mar-10,127.685500,126.630900,128.431700,124.561500,127.178100,-32.391091 17 | 16-Mar-10,128.222800,126.800100,128.431700,124.561500,128.013800,-10.797892 18 | 17-Mar-10,128.272500,126.710500,128.431700,124.561500,127.108500,-34.189448 19 | 18-Mar-10,128.093400,126.800100,128.431700,124.561500,127.725300,-18.252287 20 | 19-Mar-10,128.272500,126.133500,128.431700,124.561500,127.058700,-35.476203 21 | 22-Mar-10,127.735300,125.924500,128.272500,124.561500,127.327300,-25.470224 22 | 23-Mar-10,128.770000,126.989100,128.770000,124.561500,128.710300,-1.418558 23 | 24-Mar-10,129.287300,127.814800,129.287300,124.561500,127.874500,-29.895467 24 | 25-Mar-10,130.063300,128.471500,130.063300,124.561500,128.580900,-26.943909 25 | 26-Mar-10,129.118200,128.064100,130.063300,124.561500,128.600800,-26.582209 26 | 29-Mar-10,129.287300,127.605900,130.063300,124.571500,127.934200,-38.768710 27 | 30-Mar-10,128.471500,127.596000,130.063300,125.068900,128.113300,-39.043729 28 | 31-Mar-10,128.093400,126.999000,130.063300,125.924500,127.596000,-59.613898 29 | 1-Apr-10,128.650600,126.899500,130.063300,125.924500,127.596000,-59.613898 30 | 5-Apr-10,129.138100,127.486500,130.063300,125.924500,128.690400,-33.171451 31 | 6-Apr-10,128.640600,127.397000,130.063300,125.924500,128.272500,-43.268580 32 | -------------------------------------------------------------------------------- /test/data/cs-ppo.csv: -------------------------------------------------------------------------------- 1 | Date,Close,12 day EMA,26 day EMA,PPO,PPO_Signal_Line,PPO_Histogram 2 | 13-Apr-10,21.1613,21.1613,21.1613,0,0,0 3 | 14-Apr-10,20.4914,21.05823846,21.11167778,-0.2531268088,-0.05062536176,-0.202501447 4 | 15-Apr-10,20.7377,21.00892485,21.08397572,-0.3559616511,-0.1116926196,-0.2442690315 5 | 16-Apr-10,20.7672,20.97173641,21.06051085,-0.4215208232,-0.1736582603,-0.2478625629 6 | 19-Apr-10,20.5308,20.90390004,21.02127301,-0.5583532883,-0.2505972659,-0.3077560224 7 | 20-Apr-10,19.6146,20.70554619,20.91707501,-1.011273425,-0.4027324978,-0.6085409274 8 | 21-Apr-10,20.0186,20.59986216,20.85052131,-1.202172079,-0.5626204141,-0.6395516654 9 | 22-Apr-10,19.7033,20.46192952,20.76554195,-1.462097307,-0.7425157927,-0.7195815143 10 | 23-Apr-10,19.9397,20.38158652,20.70436847,-1.559004108,-0.9058134557,-0.6531906521 11 | 26-Apr-10,19.6244,20.26509628,20.62437081,-1.741990227,-1.07304881,-0.6689414167 12 | 27-Apr-10,19.1121,20.08771224,20.51235075,-2.070160133,-1.272471075,-0.7976890588 13 | 28-Apr-10,19.3191,19.9694642,20.4239618,-2.225315561,-1.463039972,-0.7622755894 14 | 29-Apr-10,19.6146,19.91486971,20.36400908,-2.205554737,-1.611542925,-0.5940118122 15 | 30-Apr-10,19.5426,19.85759745,20.30316396,-2.194566886,-1.728147717,-0.4664191692 16 | 3-May-10,18.8872,19.70830553,20.19827774,-2.42581182,-1.867680538,-0.558131282 17 | 4-May-10,19.3341,19.65073545,20.13426458,-2.401523646,-1.974449159,-0.4270744866 18 | 5-May-10,19.2149,19.58368384,20.0661635,-2.404443943,-2.060448116,-0.3439958272 19 | 6-May-10,19.5128,19.57277864,20.02517361,-2.25913133,-2.100184759,-0.158946571 20 | 7-May-10,19.5525,19.56965885,19.99016075,-2.103544371,-2.100856681,-0.002687689947 21 | 10-May-10,19.92,19.62355748,19.98496365,-1.808390428,-2.042363431,0.2339730028 22 | 11-May-10,20.2874,19.7256871,20.00736635,-1.407877676,-1.91546628,0.507588604 23 | 12-May-10,20.5753,19.85639678,20.04943551,-0.9628137771,-1.724935779,0.7621220022 24 | 13-May-10,20.5158,19.95784343,20.08398102,-0.6280507625,-1.505558776,0.8775080134 25 | 14-May-10,20.6945,20.07117521,20.12920465,-0.2882848307,-1.262103987,0.9738191561 26 | 17-May-10,20.6746,20.16400979,20.16960431,-0.02773735957,-1.015230661,0.9874933018 27 | 18-May-10,20.7243,20.25020829,20.21069288,0.1955173348,-0.7730810621,0.968598397 28 | 19-May-10,20.2457,20.2495147,20.213286,0.1792321421,-0.5826184213,0.7618505634 29 | 20-May-10,20.5555,20.29658936,20.23863518,0.2863541966,-0.4088238977,0.6951780943 30 | 21-May-10,20.486,20.32572946,20.2569585,0.3394930152,-0.2591605151,0.5986535304 31 | 24-May-10,20.3867,20.33510954,20.26656898,0.3381951862,-0.1396893749,0.477884561 32 | 25-May-10,20.2874,20.32776961,20.26811202,0.2943421294,-0.05288307401,0.3472252034 33 | 26-May-10,20.5753,20.36585121,20.29086669,0.3695481636,0.03160317351,0.3379449901 34 | 27-May-10,20.5158,20.38892026,20.30752841,0.4007963989,0.1054418186,0.2953545803 35 | 28-May-10,20.6945,20.43593252,20.33619298,0.490453395,0.1824441339,0.3080092611 36 | 29-May-10,20.6746,20.4726506,20.36126016,0.5470704372,0.2553693945,0.2917010426 37 | 30-May-10,20.7243,20.51136589,20.388152,0.6043406377,0.3251636432,0.2791769945 38 | 31-May-10,20.2457,20.47049422,20.3776,0.4558643439,0.3513037833,0.1045605606 39 | 1-June-10,20.5555,20.48357203,20.39077778,0.4550794924,0.3720589251,0.08302056727 40 | 2-June-10,20.486,20.48394556,20.39783128,0.4221737262,0.3820818853,0.04009184088 41 | 3-June-10,20.3867,20.46898471,20.39700674,0.3528849535,0.376242499,-0.0233575455 42 | -------------------------------------------------------------------------------- /test/data/cs-psar.csv: -------------------------------------------------------------------------------- 1 | ,Date,Open,High,Low,Close,psar_up,psar_down,psar_up_ind,psar_down_ind 2 | 0,8/24/10,23.9429,24.2013,23.8534,23.8932,,,0.0,0.0 3 | 1,8/25/10,23.8534,24.0721,23.7242,23.9528,,,0.0,0.0 4 | 2,8/26/10,23.9429,24.0423,23.6447,23.6745,,24.2013,0.0,1.0 5 | 3,8/27/10,23.7342,23.8733,23.3664,23.7839,,24.190168,0.0,0.0 6 | 4,8/30/10,23.595,23.6745,23.4559,23.4956,,24.15721728,0.0,0.0 7 | 5,8/31/10,23.4559,23.5851,23.1776,23.3217,,24.12558459,0.0,0.0 8 | 6,9/1/10,23.5255,23.8037,23.3962,23.754,,24.06870551,0.0,0.0 9 | 7,9/2/10,23.7342,23.8036,23.5652,23.7938,,24.01523918,0.0,0.0 10 | 8,9/3/10,24.092,24.3007,24.0522,24.1417,23.1776,,1.0,0.0 11 | 9,9/7/10,23.9528,24.1516,23.7739,23.8137,23.200062,,0.0,0.0 12 | 10,9/8/10,23.923,24.0522,23.595,23.7839,23.22207476,,0.0,0.0 13 | 11,9/9/10,24.0423,24.0622,23.8435,23.8634,23.24364726,,0.0,0.0 14 | 12,9/10/10,23.8336,23.8833,23.6447,23.7044,23.26478832,,0.0,0.0 15 | 13,9/13/10,24.0522,25.1356,23.9429,24.9567,23.28550655,,0.0,0.0 16 | 14,9/14/10,24.8871,25.1952,24.738,24.8771,23.35951029,,0.0,0.0 17 | 15,9/15/10,24.9467,25.066,24.7678,24.9616,23.46965167,,0.0,0.0 18 | 16,9/16/10,24.907,25.2151,24.897,25.1753,23.57318457,,0.0,0.0 19 | 17,9/17/10,25.2449,25.3741,24.9268,25.066,23.70453781,,0.0,0.0 20 | 18,9/20/10,25.1256,25.3642,24.9567,25.2747,23.87149403,,0.0,0.0 21 | 19,9/21/10,25.2648,25.2648,24.9268,24.9964,24.02175462,,0.0,0.0 22 | 20,9/22/10,24.738,24.8175,24.2112,24.4597,24.15698916,,0.0,0.0 23 | 21,9/23/10,24.3603,24.4398,24.2112,24.2808,,25.3741,0.0,1.0 24 | 22,9/24/10,24.4895,24.6485,24.4299,24.6237,,25.350842,0.0,0.0 25 | 23,9/27/10,24.6982,24.8374,24.4398,24.5815,,25.32804916,0.0,0.0 26 | 24,9/28/10,24.6485,24.7479,24.2013,24.5268,,25.30571218,0.0,0.0 27 | 25,9/29/10,24.4796,24.5094,24.251,24.3504,,25.26153569,0.0,0.0 28 | 26,9/30/10,24.4597,24.6784,24.2112,24.3404,,25.21912626,0.0,0.0 29 | 27,10/1/10,24.6187,24.6684,24.1516,24.2311,,25.17841321,0.0,0.0 30 | 28,10/4/10,23.8137,23.8435,23.6348,23.764,,25.11680442,0.0,0.0 31 | 29,10/5/10,23.9131,24.3007,23.764,24.2013,,24.99824407,0.0,0.0 -------------------------------------------------------------------------------- /test/data/cs-pvo.csv: -------------------------------------------------------------------------------- 1 | Date,Volume,12 day EMA,26 day EMA,PVO,PVO_Signal_Line,PVO_Histogram 2 | 13-Apr-10,45579.000,45579.000,45579.000,0,0,0 3 | 14-Apr-10,66285.000,48764.53846,47112.77778,3.505971759,0.7011943518,2.804777407 4 | 15-Apr-10,51761.000,49225.53254,47457.09053,3.726402081,1.306235898,2.420166184 5 | 16-Apr-10,69341.000,52320.21985,49078.12087,6.605996567,2.366188032,4.239808535 6 | 19-Apr-10,41631.000,50675.72448,48526.48228,4.429008863,2.778752198,1.650256665 7 | 20-Apr-10,73499.000,54186.99764,50376.29841,7.564468511,3.735895461,3.828573051 8 | 21-Apr-10,55427.000,54377.76723,50750.42445,7.147413681,4.418199105,2.729214576 9 | 22-Apr-10,61082.000,55409.18766,51515.72635,7.557811157,5.046121515,2.511689642 10 | 23-Apr-10,33325.000,52011.62033,50168.26514,3.674345101,4.771766232,-1.097421131 11 | 26-Apr-10,39191.000,50039.2172,49355.13438,1.386041846,4.094621355,-2.708579509 12 | 27-Apr-10,51128.000,50206.72225,49486.45776,1.455477954,3.566792675,-2.111314721 13 | 28-Apr-10,46505.000,49637.22652,49265.60904,0.754314182,3.004296976,-2.249982794 14 | 29-Apr-10,44562.000,48856.42244,48917.19356,-0.1242326362,2.378591054,-2.50282369 15 | 30-Apr-10,48815.000,48850.04975,48909.62366,-0.1218040626,1.87851203,-2.000316093 16 | 3-May-10,33411.000,46474.81133,47761.57747,-2.694144966,0.9639806311,-3.658125597 17 | 4-May-10,48157.000,46733.60959,47790.86802,-2.212260375,0.3287324298,-2.540992805 18 | 5-May-10,43199.000,46189.8235,47450.72965,-2.657295607,-0.2684731776,-2.38882243 19 | 6-May-10,45773.000,46125.69681,47326.45338,-2.537178449,-0.7222142319,-1.814964217 20 | 7-May-10,54338.000,47389.12807,47845.8272,-0.9545224015,-0.7686758658,-0.1858465356 21 | 10-May-10,56692.000,48820.33913,48501.09926,0.6582116156,-0.4832983695,1.141509985 22 | 11-May-10,61971.000,50843.51773,49498.86969,2.716522716,0.1566658475,2.559856868 23 | 12-May-10,41212.000,49361.74577,48885.02749,0.9751825961,0.3203691972,0.6548133988 24 | 13-May-10,59785.000,50965.32334,49692.43286,2.561537863,0.7686029304,1.792934933 25 | 14-May-10,44986.000,50045.42744,49343.8082,1.421899253,0.8992621949,0.5226370581 26 | 17-May-10,55929.000,50950.59245,49831.60019,2.245547523,1.168519261,1.077028263 27 | 18-May-10,162619.000,68130.34746,58186.2224,17.09017127,4.352849662,12.73732161 28 | 19-May-10,73914.000,69020.14016,59351.24296,16.29097676,6.740475082,9.550501679 29 | 20-May-10,74485.000,69860.88783,60472.262,15.52550792,8.49748165,7.02802627 30 | 21-May-10,52163.000,67138.13585,59856.76111,12.16466546,9.230918411,2.933747045 31 | 24-May-10,52334.000,64860.57649,59299.51955,9.37791231,9.260317191,0.1175951194 32 | 25-May-10,45579.000,61894.18011,58283.18477,6.195604025,8.647374558,-2.451770532 33 | 26-May-10,66285.000,62569.69086,58875.91182,6.273837509,8.172667148,-1.898829639 34 | 27-May-10,51761.000,60906.81534,58348.88132,4.383861302,7.414905979,-3.031044677 35 | 28-May-10,69341.000,62204.38221,59163.11233,5.140483259,6.960021435,-1.819538176 36 | 29-May-10,41631.000,59039.24649,57864.43734,2.030278355,5.974072819,-3.943794464 37 | 30-May-10,73499.000,61263.82395,59022.55309,3.797312621,5.538720779,-1.741408159 38 | 31-May-10,55427.000,60365.85104,58756.21583,2.739514765,4.978879576,-2.239364811 39 | 1-June-10,61082.000,60476.0278,58928.49614,2.626117692,4.5083272,-1.882209507 40 | 2-June-10,33325.000,56298.9466,57031.94087,-1.285234654,3.349614829,-4.634849483 41 | 3-June-10,39191.000,53666.95482,55710.38969,-3.667960121,1.946099839,-5.61405996 42 | -------------------------------------------------------------------------------- /test/data/cs-roc.csv: -------------------------------------------------------------------------------- 1 | Date,Close,ROC, 2 | 28-Apr-10,11045.27,, 3 | 29-Apr-10,11167.32,, 4 | 30-Apr-10,11008.61,, 5 | 3-May-10,11151.83,, 6 | 4-May-10,10926.77,, 7 | 5-May-10,10868.12,, 8 | 6-May-10,10520.32,, 9 | 7-May-10,10380.43,, 10 | 10-May-10,10785.14,, 11 | 11-May-10,10748.26,, 12 | 12-May-10,10896.91,, 13 | 13-May-10,10782.95,, 14 | 14-May-10,10620.16,-3.84879682, 15 | 17-May-10,10625.83,-4.84888048, 16 | 18-May-10,10510.95,-4.52064339, 17 | 19-May-10,10444.37,-6.34389154, 18 | 20-May-10,10068.01,-7.85923013, 19 | 21-May-10,10193.39,-6.20834146, 20 | 24-May-10,10066.57,-4.31308173, 21 | 25-May-10,10043.75,-3.24341092, 22 | -------------------------------------------------------------------------------- /test/data/cs-rsi.csv: -------------------------------------------------------------------------------- 1 | Date,Close,Change,Gain,Loss,Avg Gain,Avg Loss,RS,RSI 2 | 14-Dec-09,44.338900,,,,0.000000,0.000000,, 3 | 15-Dec-09,44.090200,-0.248700,0.000000,0.248700,0.000000,0.017764,, 4 | 16-Dec-09,44.149700,0.059500,0.059500,0.000000,0.004250,0.016495,, 5 | 17-Dec-09,43.612400,-0.537300,0.000000,0.537300,0.003946,0.053696,, 6 | 18-Dec-09,44.327800,0.715400,0.715400,0.000000,0.054765,0.049860,, 7 | 21-Dec-09,44.826400,0.498600,0.498600,0.000000,0.086467,0.046299,, 8 | 22-Dec-09,45.095500,0.269100,0.269100,0.000000,0.099512,0.042992,, 9 | 23-Dec-09,45.424500,0.329000,0.329000,0.000000,0.115904,0.039921,, 10 | 24-Dec-09,45.843300,0.418800,0.418800,0.000000,0.137540,0.037069,, 11 | 28-Dec-09,46.082600,0.239300,0.239300,0.000000,0.144808,0.034422,, 12 | 29-Dec-09,45.893100,-0.189500,0.000000,0.189500,0.134465,0.045499,, 13 | 30-Dec-09,46.032800,0.139700,0.139700,0.000000,0.134839,0.042249,, 14 | 31-Dec-09,45.614000,-0.418800,0.000000,0.418800,0.125207,0.069145,, 15 | 04-Jan-10,46.282000,0.668000,0.668000,0.000000,0.163978,0.064206,, 16 | 05-Jan-10,46.282000,0.000000,0.000000,0.000000,0.152266,0.059620,2.553927,71.862114 17 | 06-Jan-10,46.002800,-0.279200,0.000000,0.279200,0.141389,0.075304,1.877571,65.248473 18 | 07-Jan-10,46.032800,0.030000,0.030000,0.000000,0.133433,0.069926,1.908216,65.614661 19 | 08-Jan-10,46.411600,0.378800,0.378800,0.000000,0.150959,0.064931,2.324923,69.924117 20 | 11-Jan-10,46.222200,-0.189400,0.000000,0.189400,0.140176,0.073822,1.898856,65.503639 21 | 12-Jan-10,45.643900,-0.578300,0.000000,0.578300,0.130164,0.109856,1.184862,54.230524 22 | 13-Jan-10,46.212200,0.568300,0.568300,0.000000,0.161459,0.102009,1.582797,61.282282 23 | 14-Jan-10,46.252100,0.039900,0.039900,0.000000,0.152777,0.094723,1.612885,61.728124 24 | 15-Jan-10,45.713700,-0.538400,0.000000,0.538400,0.141864,0.126414,1.122219,52.879504 25 | 19-Jan-10,46.451500,0.737800,0.737800,0.000000,0.184431,0.117384,1.571172,61.107227 26 | 20-Jan-10,45.783500,-0.668000,0.000000,0.668000,0.171257,0.156714,1.092801,52.217151 27 | 21-Jan-10,45.354800,-0.428700,0.000000,0.428700,0.159024,0.176141,0.902822,47.446488 28 | 22-Jan-10,44.028800,-1.326000,0.000000,1.326000,0.147666,0.258274,0.571740,36.376226 29 | 25-Jan-10,44.178300,0.149500,0.149500,0.000000,0.147797,0.239826,0.616266,38.128990 30 | 26-Jan-10,44.218100,0.039800,0.039800,0.000000,0.140083,0.222696,0.629032,38.613833 31 | 27-Jan-10,44.567200,0.349100,0.349100,0.000000,0.155012,0.206789,0.749617,42.844631 32 | 28-Jan-10,43.420500,-1.146700,0.000000,1.146700,0.143940,0.273925,0.525472,34.446517 33 | 29-Jan-10,42.662800,-0.757700,0.000000,0.757700,0.133659,0.308481,0.433280,30.229985 34 | 01-Feb-10,43.131400,0.468600,0.468600,0.000000,0.157583,0.286446,0.550131,35.489326 35 | -------------------------------------------------------------------------------- /test/data/cs-soo.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Highest High (14),Lowest Low (14),Close,SO,SO_SIG 2 | 23-Feb-10,127.009000,125.357400,,,,, 3 | 24-Feb-10,127.615900,126.163300,,,,, 4 | 25-Feb-10,126.591100,124.929600,,,,, 5 | 26-Feb-10,127.347200,126.093700,,,,, 6 | 1-Mar-10,128.173000,126.819900,,,,, 7 | 2-Mar-10,128.431700,126.481700,,,,, 8 | 3-Mar-10,127.367100,126.034000,,,,, 9 | 4-Mar-10,126.422000,124.830100,,,,, 10 | 5-Mar-10,126.899500,126.392100,,,,, 11 | 8-Mar-10,126.849800,125.715600,,,,, 12 | 9-Mar-10,125.646000,124.561500,,,,, 13 | 10-Mar-10,125.715600,124.571500,,,,, 14 | 11-Mar-10,127.158200,125.068900,,,,, 15 | 12-Mar-10,127.715400,126.859700,128.431700,124.561500,127.287600,70.438220, 16 | 15-Mar-10,127.685500,126.630900,128.431700,124.561500,127.178100,67.608909, 17 | 16-Mar-10,128.222800,126.800100,128.431700,124.561500,128.013800,89.202108, 18 | 17-Mar-10,128.272500,126.710500,128.431700,124.561500,127.108500,65.810552,74.20719 19 | 18-Mar-10,128.093400,126.800100,128.431700,124.561500,127.725300,81.747713,78.920124 20 | 19-Mar-10,128.272500,126.133500,128.431700,124.561500,127.058700,64.523797,70.694021 21 | 22-Mar-10,127.735300,125.924500,128.272500,124.561500,127.327300,74.529776,73.600429 22 | 23-Mar-10,128.770000,126.989100,128.770000,124.561500,128.710300,98.581442,79.211672 23 | 24-Mar-10,129.287300,127.814800,129.287300,124.561500,127.874500,70.104533,81.071917 24 | 25-Mar-10,130.063300,128.471500,130.063300,124.561500,128.580900,73.056091,80.580689 25 | 26-Mar-10,129.118200,128.064100,130.063300,124.561500,128.600800,73.417791,72.192805 26 | 29-Mar-10,129.287300,127.605900,130.063300,124.571500,127.934200,61.231290,69.235057 27 | 30-Mar-10,128.471500,127.596000,130.063300,125.068900,128.113300,60.956271,65.201784 28 | 31-Mar-10,128.093400,126.999000,130.063300,125.924500,127.596000,40.386102,54.191221 29 | 1-Apr-10,128.650600,126.899500,130.063300,125.924500,127.596000,40.386102,47.242825 30 | 5-Apr-10,129.138100,127.486500,130.063300,125.924500,128.690400,66.828549,49.200251 31 | 6-Apr-10,128.640600,127.397000,130.063300,125.924500,128.272500,56.731420,54.64869 32 | -------------------------------------------------------------------------------- /test/data/cs-stc.csv: -------------------------------------------------------------------------------- 1 | date,Close,short_ema,long_ema,macd_line,_macdmin,_macdmax,_stoch_k,_stoch_d,_stoch_d_min,_stoch_d_max,_stoch_kd,stc 2 | 12/10/2010,30.2,30.2,30.2,0,0,0,,0,0,0,0,0 3 | 12/13/2010,30.28,30.20666667,30.20313725,0.003529411765,0,0.003529411765,100,50,0,50,100,50 4 | 12/14/2010,30.45,30.22694444,30.21281815,0.01412629758,0,0.01412629758,100,75,0,75,100,75 5 | 12/15/2010,29.35,30.15386574,30.17898214,-0.02511640037,-0.02511640037,0.01412629758,0,37.5,0,75,50,62.5 6 | 12/16/2010,29.35,30.08687693,30.14647304,-0.05959610852,-0.05959610852,0.01412629758,0,18.75,0,75,25,43.75 7 | 12/17/2010,29.29,30.02047052,30.11288586,-0.09241534133,-0.09241534133,0.01412629758,0,9.375,0,75,12.5,28.125 8 | 12/20/2010,28.83,29.92126464,30.06257661,-0.1413119685,-0.1413119685,0.01412629758,0,4.6875,0,75,6.25,17.1875 9 | 12/21/2010,28.73,29.82199259,30.0103187,-0.1883261157,-0.1883261157,0.01412629758,0,2.34375,0,75,3.125,10.15625 10 | 12/22/2010,28.67,29.72599321,29.95775719,-0.2317639802,-0.2317639802,0.01412629758,0,1.171875,0,75,1.5625,5.859375 11 | 12/23/2010,28.85,29.65299377,29.91431573,-0.2613219558,-0.2613219558,0.01412629758,0,0.5859375,0,75,0.78125,3.3203125 12 | 12/27/2010,28.64,29.56857762,29.86434256,-0.2957649376,-0.2957649376,0.01412629758,0,0.29296875,0.29296875,75,0,1.66015625 13 | 12/28/2010,27.68,29.41119616,29.77868207,-0.3674859137,-0.3674859137,0.01412629758,0,0.146484375,0.146484375,75,0,0.830078125 14 | 12/29/2010,27.21,29.22776314,29.67794944,-0.4501862965,-0.4501862965,-0.02511640037,0,0.0732421875,0.0732421875,37.5,0,0.4150390625 15 | 12/30/2010,26.87,29.03128288,29.56783377,-0.5365508941,-0.5365508941,-0.05959610852,0,0.03662109375,0.03662109375,18.75,0,0.2075195313 16 | 12/31/2010,27.41,28.89617597,29.48321284,-0.5870368685,-0.5870368685,-0.09241534133,0,0.01831054688,0.01831054688,9.375,0,0.1037597656 17 | 1/3/2011,26.94,28.73316131,29.38347901,-0.650317696,-0.650317696,-0.1413119685,0,0.009155273438,0.009155273438,4.6875,0,0.05187988281 18 | 1/4/2011,26.52,28.5487312,29.27118571,-0.7224545108,-0.7224545108,-0.1883261157,0,0.004577636719,0.004577636719,2.34375,0,0.02593994141 19 | 1/5/2011,26.52,28.37967027,29.16329608,-0.7836258085,-0.7836258085,-0.2317639802,0,0.002288818359,0.002288818359,1.171875,0,0.0129699707 20 | 1/6/2011,27.09,28.27219774,29.08199035,-0.8097926023,-0.8097926023,-0.2613219558,0,0.00114440918,0.00114440918,0.5859375,0,0.006484985352 21 | 1/7/2011,27.69,28.22368127,29.02740249,-0.8037212243,-0.8097926023,-0.2957649376,1.181138377,0.5911413929,0.00114440918,0.5911413929,100,50.00324249 22 | 1/10/2011,28.45,28.24254116,29.00475926,-0.7622180949,-0.8097926023,-0.3674859137,10.756,5.673570696,0.00114440918,5.673570696,100,75.00162125 23 | 1/11/2011,28.53,28.26649606,28.98614125,-0.7196451816,-0.8097926023,-0.4501862965,25.06836484,15.37096777,0.00114440918,15.37096777,100,87.50081062 24 | 1/12/2011,28.67,28.30012139,28.97374355,-0.6736221576,-0.8097926023,-0.5365508941,49.8351608,32.60306428,0.00114440918,32.60306428,100,93.75040531 25 | 1/13/2011,29.01,28.35927794,28.97516537,-0.6158874286,-0.8097926023,-0.5870368685,87.04834234,59.82570331,0.00114440918,59.82570331,100,96.87520266 26 | 1/14/2011,29.87,28.48517145,29.01025693,-0.5250854778,-0.8097926023,-0.5250854778,100,79.91285166,0.00114440918,79.91285166,100,98.43760133 27 | 1/18/2011,29.8,28.59474049,29.04122724,-0.4464867484,-0.8097926023,-0.4464867484,100,89.95642583,0.00114440918,89.95642583,100,99.21880066 28 | 1/19/2011,29.75,28.69101212,29.06902225,-0.378010133,-0.8097926023,-0.378010133,100,94.97821291,0.00114440918,94.97821291,100,99.60940033 29 | 1/20/2011,30.65,28.85426111,29.13102138,-0.2767602703,-0.8097926023,-0.2767602703,100,97.48910646,0.00114440918,97.48910646,100,99.80470017 30 | 1/21/2011,30.6,28.99973935,29.18862838,-0.1888890341,-0.8037212243,-0.1888890341,100,98.74455323,0.5911413929,98.74455323,100,99.90235008 31 | 1/24/2011,30.76,29.14642774,29.2502508,-0.1038230629,-0.7622180949,-0.1038230629,100,99.37227661,5.673570696,99.37227661,100,99.95117504 32 | 1/25/2011,30.2,29.23422543,29.28749587,-0.05327044104,-0.7196451816,-0.05327044104,100,99.68613831,15.37096777,99.68613831,100,99.97558752 33 | 1/26/2011,30.28,29.32137331,29.3264176,-0.005044290574,-0.6736221576,-0.005044290574,100,99.84306915,32.60306428,99.84306915,100,99.98779376 34 | 1/27/2011,30.45,29.41542553,29.37047965,0.04494587884,-0.6158874286,0.04494587884,100,99.92153458,59.82570331,99.92153458,100,99.99389688 35 | 1/28/2011,29.35,29.4099734,29.36967653,0.04029687484,-0.5250854778,0.04494587884,99.18443013,99.55298235,79.91285166,99.92153458,98.15803856,99.07596772 36 | 1/29/2011,29.35,29.40497562,29.3689049,0.03607071977,-0.4464867484,0.04494587884,98.19402324,98.87350279,89.95642583,99.92153458,89.482987,94.27947736 37 | 1/30/2011,29.29,29.39539432,29.36581059,0.02958372791,-0.378010133,0.04494587884,96.36790813,97.62070546,94.97821291,99.92153458,53.4558082,73.86764278 38 | 1/31/2011,28.83,29.34827813,29.34479841,0.003479714719,-0.2767602703,0.04494587884,87.11054662,92.36562604,92.36562604,99.92153458,0,36.93382139 39 | 2/1/2011,28.73,29.29675495,29.32068867,-0.0239337208,-0.1888890341,0.04494587884,70.54349209,81.45455906,81.45455906,99.92153458,0,18.4669107 40 | 2/2/2011,28.67,29.24452537,29.29517147,-0.05064609711,-0.1038230629,0.04494587884,35.744669,58.59961403,58.59961403,99.92153458,0,9.233455348 41 | 2/3/2011,28.85,29.21164826,29.27771376,-0.06606550665,-0.06606550665,0.04494587884,0,29.29980702,29.29980702,99.92153458,0,4.616727674 42 | 2/4/2011,28.64,29.1640109,29.25270538,-0.08869447843,-0.08869447843,0.04494587884,0,14.64990351,14.64990351,99.92153458,0,2.308363837 43 | 2/5/2011,27.68,29.04034333,29.19103066,-0.1506873327,-0.1506873327,0.04494587884,0,7.324951754,7.324951754,99.92153458,0,1.154181918 44 | 2/6/2011,27.21,28.88781472,29.11334318,-0.2255284664,-0.2255284664,0.04029687484,0,3.662475877,3.662475877,99.55298235,0,0.5770909592 45 | 2/7/2011,26.87,28.71966349,29.02536894,-0.3057054502,-0.3057054502,0.03607071977,0,1.831237939,1.831237939,98.87350279,0,0.2885454796 46 | 2/8/2011,27.41,28.61052486,28.96202114,-0.3514962728,-0.3514962728,0.02958372791,0,0.9156189693,0.9156189693,97.62070546,0,0.1442727398 47 | 2/9/2011,26.94,28.47131446,28.88272619,-0.4114117316,-0.4114117316,0.003479714719,0,0.4578094846,0.4578094846,92.36562604,0,0.0721363699 48 | 2/10/2011,26.52,28.30870492,28.79007026,-0.4813653408,-0.4813653408,-0.0239337208,0,0.2289047423,0.2289047423,81.45455906,0,0.03606818495 49 | 2/11/2011,26.52,28.15964618,28.7010479,-0.541401721,-0.541401721,-0.05064609711,0,0.1144523712,0.1144523712,58.59961403,0,0.01803409248 50 | 2/12/2011,27.09,28.070509,28.63786955,-0.5673605535,-0.5673605535,-0.06606550665,0,0.05722618558,0.05722618558,29.29980702,0,0.009017046238 51 | 2/13/2011,27.69,28.03879991,28.60069819,-0.5618982817,-0.5673605535,-0.08869447843,1.14114456,0.5991853728,0.05722618558,14.64990351,3.713911952,1.861464499 52 | 2/14/2011,28.45,28.07306659,28.59478846,-0.5217218746,-0.5673605535,-0.1506873327,10.95311065,5.77614801,0.05722618558,7.324951754,78.68929241,40.27537846 53 | 2/15/2011,28.53,28.11114437,28.59224774,-0.4811033662,-0.5673605535,-0.2255284664,25.23378891,15.50496846,0.05722618558,15.50496846,100,70.13768923 54 | 2/16/2011,28.67,28.15771567,28.59529685,-0.4375811722,-0.5673605535,-0.3057054502,49.59940767,32.55218806,0.05722618558,32.55218806,100,85.06884461 55 | 2/17/2011,29.01,28.22873937,28.61155971,-0.3828203471,-0.5673605535,-0.3514962728,85.48899604,59.02059205,0.05722618558,59.02059205,100,92.53442231 56 | 2/18/2011,29.87,28.36551109,28.66091031,-0.2953992272,-0.5673605535,-0.2953992272,100,79.51029603,0.05722618558,79.51029603,100,96.26721115 57 | 2/19/2011,29.8,28.48505183,28.7055805,-0.2205286682,-0.5673605535,-0.2205286682,100,89.75514801,0.05722618558,89.75514801,100,98.13360558 58 | 2/20/2011,29.75,28.59046418,28.74653813,-0.1560739482,-0.5673605535,-0.1560739482,100,94.87757401,0.05722618558,94.87757401,100,99.06680279 59 | 2/21/2011,30.65,28.76209216,28.82118369,-0.05909152668,-0.5673605535,-0.05909152668,100,97.438787,0.05722618558,97.438787,100,99.53340139 60 | 2/22/2011,30.6,28.91525115,28.89094119,0.0243099574,-0.5618982817,0.0243099574,100,98.7193935,0.5991853728,98.7193935,100,99.7667007 61 | 2/23/2011,30.76,29.06898022,28.96423762,0.1047426045,-0.5217218746,0.1047426045,100,99.35969675,5.77614801,99.35969675,100,99.88335035 62 | 2/24/2011,30.2,29.16323187,29.01269889,0.1505329828,-0.4811033662,0.1505329828,100,99.67984838,15.50496846,99.67984838,100,99.94167517 63 | 2/25/2011,30.28,29.25629588,29.06239697,0.1938989109,-0.4375811722,0.1938989109,100,99.83992419,32.55218806,99.83992419,100,99.97083759 64 | 2/26/2011,30.45,29.35577122,29.11681277,0.2389584491,-0.3828203471,0.2389584491,100,99.91996209,59.02059205,99.91996209,100,99.98541879 65 | 2/27/2011,29.35,29.35529029,29.12595737,0.2293329168,-0.2953992272,0.2389584491,98.19867239,99.05931724,79.51029603,99.91996209,95.78315075,97.88428477 66 | 2/28/2011,29.35,29.35484943,29.13474336,0.220106074,-0.2205286682,0.2389584491,95.89708299,97.47820012,89.75514801,99.91996209,75.97829182,86.9312883 67 | 3/1/2011,29.29,29.34944531,29.14083185,0.208613459,-0.1560739482,0.2389584491,92.31835406,94.89827709,94.87757401,99.91996209,0.410580924,43.67093461 68 | 3/2/2011,28.83,29.3061582,29.12864237,0.1775158341,-0.05909152668,0.2389584491,79.38513003,87.14170356,87.14170356,99.91996209,0,21.8354673 69 | 3/3/2011,28.73,29.25814502,29.11300933,0.1451356847,0.0243099574,0.2389584491,56.29004254,71.71587305,71.71587305,99.91996209,0,10.91773365 70 | 3/4/2011,28.67,29.20913293,29.09563642,0.1134965149,0.1047426045,0.2389584491,6.522263039,39.11906804,39.11906804,99.91996209,0,5.458866826 71 | 3/5/2011,28.85,29.17920519,29.08600362,0.09320157116,0.09320157116,0.2389584491,0,19.55953402,19.55953402,99.91996209,0,2.729433413 72 | 3/6/2011,28.64,29.13427142,29.06851328,0.06575814337,0.06575814337,0.2389584491,0,9.779767011,9.779767011,99.91996209,0,1.364716707 73 | 3/7/2011,27.68,29.01308214,29.01406178,-0.0009796407278,-0.0009796407278,0.2389584491,0,4.889883506,4.889883506,99.91996209,0,0.6823583533 74 | 3/8/2011,27.21,28.86282529,28.94331426,-0.08048896482,-0.08048896482,0.2293329168,0,2.444941753,2.444941753,99.05931724,0,0.3411791766 75 | 3/9/2011,26.87,28.69675652,28.86200782,-0.1652512978,-0.1652512978,0.220106074,0,1.222470876,1.222470876,97.47820012,0,0.1705895883 76 | 3/10/2011,27.41,28.58952681,28.80506633,-0.2155395247,-0.2155395247,0.208613459,0,0.6112354382,0.6112354382,94.89827709,0,0.08529479416 77 | 3/11/2011,26.94,28.45206624,28.73192648,-0.2798602358,-0.2798602358,0.1775158341,0,0.3056177191,0.3056177191,87.14170356,0,0.04264739708 78 | 3/12/2011,26.52,28.29106072,28.64518426,-0.3541235412,-0.3541235412,0.1451356847,0,0.1528088596,0.1528088596,71.71587305,0,0.02132369854 79 | 3/13/2011,26.52,28.14347233,28.5618437,-0.4183713753,-0.4183713753,0.1134965149,0,0.07640442978,0.07640442978,39.11906804,0,0.01066184927 80 | 3/14/2011,27.09,28.05568297,28.50412434,-0.448441375,-0.448441375,0.09320157116,0,0.03820221489,0.03820221489,19.55953402,0,0.005330924635 81 | 3/15/2011,27.69,28.02520939,28.4721979,-0.4469885108,-0.448441375,0.06575814337,0.2825487272,0.1603754711,0.03820221489,9.779767011,1.254144059,0.6297374919 82 | 3/16/2011,28.45,28.0606086,28.47132739,-0.4107187873,-0.448441375,-0.0009796407278,8.430349429,4.29536245,0.03820221489,4.889883506,87.74608182,44.18790966 83 | 3/17/2011,28.53,28.09972455,28.47362828,-0.3739037242,-0.448441375,-0.08048896482,20.2574161,12.27638928,0.03820221489,12.27638928,100,72.09395483 84 | 3/18/2011,28.67,28.14724751,28.48132913,-0.3340816222,-0.448441375,-0.1652512978,40.38268357,26.32953642,0.03820221489,26.32953642,100,86.04697741 85 | 3/19/2011,29.01,28.21914355,28.50206132,-0.2829177722,-0.448441375,-0.2155395247,71.07011068,48.69982355,0.03820221489,48.69982355,100,93.02348871 86 | 3/20/2011,29.87,28.35671492,28.55570598,-0.1989910553,-0.448441375,-0.1989910553,100,74.34991177,0.03820221489,74.34991177,100,96.51174435 87 | 3/21/2011,29.8,28.47698868,28.60450182,-0.1275131428,-0.448441375,-0.1275131428,100,87.17495589,0.03820221489,87.17495589,100,98.25587218 88 | 3/22/2011,29.75,28.58307295,28.64942332,-0.0663503631,-0.448441375,-0.0663503631,100,93.58747794,0.03820221489,93.58747794,100,99.12793609 89 | 3/23/2011,30.65,28.75531687,28.7278773,0.02743956986,-0.448441375,0.02743956986,100,96.79373897,0.03820221489,96.79373897,100,99.56396804 90 | 3/24/2011,30.6,28.90904047,28.80129388,0.1077465874,-0.4469885108,0.1077465874,100,98.39686949,0.1603754711,98.39686949,100,99.78198402 91 | 3/25/2011,30.76,29.0632871,28.87810589,0.1851812104,-0.4107187873,0.1851812104,100,99.19843474,4.29536245,99.19843474,100,99.89099201 92 | 3/26/2011,30.2,29.15801317,28.92994487,0.2280683009,-0.3739037242,0.2280683009,100,99.59921737,12.27638928,99.59921737,100,99.94549601 93 | 3/27/2011,30.28,29.25151207,28.98288821,0.2686238649,-0.3340816222,0.2686238649,100,99.79960869,26.32953642,99.79960869,100,99.972748 94 | 3/28/2011,30.45,29.35138607,29.040422,0.310964063,-0.2829177722,0.310964063,100,99.89980434,48.69982355,99.89980434,100,99.986374 95 | 3/29/2011,29.35,29.35127056,29.05256232,0.2987082438,-0.1989910553,0.310964063,97.5966867,98.74824552,74.34991177,99.89980434,95.49290152,97.73963776 96 | 3/30/2011,29.35,29.35116468,29.06422654,0.2869381409,-0.1275131428,0.310964063,94.52059952,96.63442252,87.17495589,99.89980434,74.33854059,86.03908917 97 | 3/31/2011,29.29,29.34606762,29.0730804,0.2729872229,-0.0663503631,0.310964063,89.93496208,93.2846923,93.2846923,99.89980434,0,43.01954459 98 | 4/1/2011,28.83,29.30306199,29.06354784,0.2395141523,0.02743956986,0.310964063,74.79938686,84.04203958,84.04203958,99.89980434,0,21.50977229 99 | 4/2/2011,28.73,29.25530682,29.05046753,0.2048392939,0.1077465874,0.310964063,47.77773476,65.90988717,65.90988717,99.89980434,0,10.75488615 100 | 4/3/2011,28.67,29.20653125,29.03554723,0.1709840205,0.1709840205,0.310964063,0,32.95494359,32.95494359,99.89980434,0,5.377443073 101 | 4/4/2011,28.85,29.17682032,29.02827087,0.1485494448,0.1485494448,0.310964063,0,16.47747179,16.47747179,99.89980434,0,2.688721537 102 | 4/5/2011,28.64,29.13208529,29.01304456,0.1190407271,0.1190407271,0.310964063,0,8.238735896,8.238735896,99.89980434,0,1.344360768 103 | 4/6/2011,27.68,29.01107818,28.96076831,0.0503098769,0.0503098769,0.310964063,0,4.119367948,4.119367948,99.89980434,0,0.6721803842 104 | 4/7/2011,27.21,28.86098833,28.89211073,-0.03112239105,-0.03112239105,0.2987082438,0,2.059683974,2.059683974,98.74824552,0,0.3360901921 105 | 4/8/2011,26.87,28.69507264,28.81281227,-0.1177396258,-0.1177396258,0.2869381409,0,1.029841987,1.029841987,96.63442252,0,0.168045096 106 | 4/9/2011,27.41,28.58798325,28.75780002,-0.1698167667,-0.1698167667,0.2729872229,0,0.5149209935,0.5149209935,93.2846923,0,0.08402254802 107 | 4/10/2011,26.94,28.45065132,28.68651374,-0.2358624292,-0.2358624292,0.2395141523,0,0.2574604968,0.2574604968,84.04203958,0,0.04201127401 108 | 4/11/2011,26.52,28.28976371,28.60155242,-0.3117887155,-0.3117887155,0.2048392939,0,0.1287302484,0.1287302484,65.90988717,0,0.02100563701 109 | 4/12/2011,26.52,28.1422834,28.51992291,-0.3776395176,-0.3776395176,0.1709840205,0,0.06436512419,0.06436512419,32.95494359,0,0.0105028185 110 | 4/13/2011,27.09,28.05459311,28.46384751,-0.4092543923,-0.4092543923,0.1485494448,0,0.03218256209,0.03218256209,16.47747179,0,0.005251409251 111 | 4/14/2011,27.69,28.02421035,28.43350055,-0.4092901907,-0.4092901907,0.1190407271,0,0.01609128105,0.01609128105,8.238735896,0,0.002625704626 112 | 4/15/2011,28.45,28.05969282,28.43414758,-0.3744547577,-0.4092901907,0.0503098769,7.579509985,3.797800633,0.01609128105,4.119367948,92.16315786,46.08289178 113 | 4/16/2011,28.53,28.09888509,28.4379065,-0.3390214114,-0.4092901907,-0.03112239105,18.58137561,11.18958812,0.01609128105,11.18958812,100,73.04144589 114 | 4/17/2011,28.67,28.146478,28.44700821,-0.3005302081,-0.4092901907,-0.1177396258,37.30398624,24.24678718,0.01609128105,24.24678718,100,86.52072295 115 | 4/18/2011,29.01,28.21843817,28.46908632,-0.2506481508,-0.4092901907,-0.1698167667,66.24619852,45.24649285,0.01609128105,45.24649285,100,93.26036147 116 | 4/19/2011,29.87,28.35606832,28.52402411,-0.1679557895,-0.4092901907,-0.1679557895,100,72.62324643,0.01609128105,72.62324643,100,96.63018074 117 | 4/20/2011,29.8,28.47639596,28.57406238,-0.09766641963,-0.4092901907,-0.09766641963,100,86.31162321,0.01609128105,86.31162321,100,98.31509037 118 | 4/21/2011,29.75,28.58252963,28.62017758,-0.03764795036,-0.4092901907,-0.03764795036,100,93.15581161,0.01609128105,93.15581161,100,99.15754518 119 | 4/22/2011,30.65,28.75481883,28.69977846,0.055040368,-0.4092901907,0.055040368,100,96.5779058,0.01609128105,96.5779058,100,99.57877259 120 | 4/23/2011,30.6,28.90858392,28.77429695,0.134286974,-0.4092901907,0.134286974,100,98.2889529,0.01609128105,98.2889529,100,99.7893863 121 | 4/24/2011,30.76,29.0628686,28.85216766,0.2107009391,-0.3744547577,0.2107009391,100,99.14447645,3.797800633,99.14447645,100,99.89469315 -------------------------------------------------------------------------------- /test/data/cs-stochrsi.csv: -------------------------------------------------------------------------------- 1 | Date,Close,RSI,RSI Highest High (14),RSI Lowest Low (14),StochRSI(14) 2 | 14-Dec-09,44.3389000,,,, 3 | 15-Dec-09,44.0902000,,,, 4 | 16-Dec-09,44.1497000,,,, 5 | 17-Dec-09,43.6124000,,,, 6 | 18-Dec-09,44.3278000,,,, 7 | 21-Dec-09,44.8264000,,,, 8 | 22-Dec-09,45.0955000,,,, 9 | 23-Dec-09,45.4245000,,,, 10 | 24-Dec-09,45.8433000,,,, 11 | 28-Dec-09,46.0826000,,,, 12 | 29-Dec-09,45.8931000,,,, 13 | 30-Dec-09,46.0328000,,,, 14 | 31-Dec-09,45.6140000,,,, 15 | 04-Jan-10,46.2820000,,,, 16 | 05-Jan-10,46.2820000,71.8621140,,, 17 | 06-Jan-10,46.0028000,65.2484730,,, 18 | 07-Jan-10,46.0328000,65.6146610,,, 19 | 08-Jan-10,46.4116000,69.9241170,,, 20 | 11-Jan-10,46.2222000,65.5036390,,, 21 | 12-Jan-10,45.6439000,54.2305240,,, 22 | 13-Jan-10,46.2122000,61.2822820,,, 23 | 14-Jan-10,46.2521000,61.7281240,,, 24 | 15-Jan-10,45.7137000,52.8795040,,, 25 | 19-Jan-10,46.4515000,61.1072270,,, 26 | 20-Jan-10,45.7835000,52.2171510,,, 27 | 21-Jan-10,45.3548000,47.4464880,,, 28 | 22-Jan-10,44.0288000,36.3762260,,, 29 | 25-Jan-10,44.1783000,38.1289900,71.8621140,36.3762260,0.0493933 30 | 26-Jan-10,44.2181000,38.6138330,69.9241170,36.3762260,0.0666989 31 | 27-Jan-10,44.5672000,42.8446310,69.9241170,36.3762260,0.1928111 32 | 28-Jan-10,43.4205000,34.4465170,69.9241170,34.4465170,0.0000000 33 | 29-Jan-10,42.6628000,30.2299850,65.5036390,30.2299850,0.0000000 34 | 29-Jan-11,43.1314000,35.4893260,61.7281240,30.2299850,0.1669731 -------------------------------------------------------------------------------- /test/data/cs-ui.csv: -------------------------------------------------------------------------------- 1 | date,Close,max_price,percent_drawdown,percent_drawdown_squared,squared_average,ulcer_index 2 | 12/10/2010,199.29,199.29,0,0,, 3 | 12/13/2010,199.01,199.29,-0.1404987706,0.001409993182,, 4 | 12/14/2010,198.29,199.29,-0.5017813237,0.01798460692,, 5 | 12/15/2010,198.4,199.29,-0.4465853781,0.01424560714,, 6 | 12/16/2010,200.84,200.84,0,0,, 7 | 12/17/2010,201.22,201.22,0,0,, 8 | 12/20/2010,200.5,201.22,-0.3578173144,0.009145230748,, 9 | 12/21/2010,198.65,201.22,-1.277209025,0.1165187781,, 10 | 12/22/2010,197.25,201.22,-1.972964914,0.2780421823,, 11 | 12/23/2010,195.7,201.22,-2.743266077,0.5375363406,, 12 | 12/27/2010,197.77,201.22,-1.714541298,0.2099751331,, 13 | 12/28/2010,195.69,201.22,-2.748235762,0.5394857002,, 14 | 12/29/2010,194.87,201.22,-3.155749925,0.711339828,, 15 | 12/30/2010,195.08,201.22,-3.051386542,0.6650685592,3.100751959,1.760895215 16 | -------------------------------------------------------------------------------- /test/data/cs-ultosc.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Close,Buying Pressure,True Range,AVG-7,AVG-14,AVG-28,Ult_Osc 2 | 20-Oct-10,57.934200,56.519900,57.565700,,,,,, 3 | 21-Oct-10,58.462000,57.067700,57.665300,0.597600,1.394300,,,, 4 | 22-Oct-10,57.764900,56.440300,56.918300,0.478000,1.324600,,,, 5 | 25-Oct-10,59.876300,57.525800,58.472000,1.553700,2.958000,,,, 6 | 26-Oct-10,59.019800,57.575600,58.740900,1.165300,1.444200,,,, 7 | 27-Oct-10,60.175100,57.894300,60.005800,2.111500,2.280800,,,, 8 | 28-Oct-10,60.294600,58.013900,58.452100,0.438200,2.280700,,,, 9 | 29-Oct-10,59.856400,58.432200,59.179100,0.746900,1.424200,0.541032,,, 10 | 01-Nov-10,59.776700,58.452100,58.671200,0.219100,1.324600,0.514892,,, 11 | 02-Nov-10,59.726900,58.581600,58.870400,0.288800,1.145300,0.507357,,, 12 | 03-Nov-10,59.599400,58.541700,59.298600,0.756900,1.057700,0.522628,,, 13 | 04-Nov-10,62.963700,59.617300,62.565300,3.266700,3.665100,0.594010,,, 14 | 05-Nov-10,62.266600,61.360200,62.017600,0.657400,1.205100,0.526659,,, 15 | 08-Nov-10,63.063300,61.250700,62.047400,0.796700,1.812600,0.578662,,, 16 | 09-Nov-10,63.740600,62.186900,62.515500,0.468100,1.693200,0.542164,0.541571,, 17 | 10-Nov-10,62.744600,61.021600,62.366100,1.344500,1.723000,0.616087,0.564022,, 18 | 11-Nov-10,63.481600,61.569400,63.401900,1.832500,1.912200,0.698054,0.603482,, 19 | 12-Nov-10,63.232600,60.792600,61.898100,1.105500,2.609300,0.647816,0.594186,, 20 | 15-Nov-10,62.137100,60.344400,60.543600,0.199200,1.792700,0.502342,0.548936,, 21 | 16-Nov-10,60.503700,58.203100,59.089500,0.886400,2.340500,0.477754,0.500531,, 22 | 17-Nov-10,59.886200,58.910200,59.009800,0.099600,0.976000,0.454959,0.513271,, 23 | 18-Nov-10,60.324500,59.090500,59.388300,0.378500,1.314700,0.461479,0.500566,, 24 | 19-Nov-10,59.707000,58.591500,59.209000,0.617500,1.115500,0.424446,0.521215,, 25 | 22-Nov-10,62.216800,59.440100,59.657200,0.448200,3.007800,0.283882,0.490277,, 26 | 23-Nov-10,59.736800,57.326700,59.069600,1.742900,2.410100,0.337439,0.501987,, 27 | 24-Nov-10,59.936000,59.109400,59.896200,0.826600,0.866400,0.415568,0.460210,, 28 | 26-Nov-10,59.647000,58.871400,59.288700,0.417300,1.024800,0.422816,0.453823,, 29 | 29-Nov-10,59.368300,58.242900,59.119400,0.876500,1.125400,0.488509,0.470203,, 30 | 30-Nov-10,60.214900,58.262800,59.677100,1.414300,1.952100,0.551491,0.504313,0.523260,53.397838 31 | 01-Dec-10,61.698900,60.583400,61.479800,1.802700,2.021800,0.606726,0.516880,0.540863,57.164680 32 | -------------------------------------------------------------------------------- /test/data/cs-vortex.csv: -------------------------------------------------------------------------------- 1 | Date,High,Low,Close,+VM,-VM,+VM14,-VM14,TR,TR14,+VI14,-VI14 2 | 19/07/2012,1380.390000,1371.210000,1376.510000,,,,,,,, 3 | 20/07/2012,1376.510000,1362.190000,1362.660000,5.300000,18.200000,,,14.320000,,, 4 | 23/07/2012,1362.340000,1337.560000,1350.520000,0.150000,38.950000,,,25.100000,,, 5 | 24/07/2012,1351.530000,1329.240000,1338.310000,13.970000,33.100000,,,22.290000,,, 6 | 25/07/2012,1343.980000,1331.500000,1337.890000,14.740000,20.030000,,,12.480000,,, 7 | 26/07/2012,1363.130000,1338.170000,1360.020000,31.630000,5.810000,,,25.240000,,, 8 | 27/07/2012,1389.190000,1360.050000,1385.970000,51.020000,3.080000,,,29.170000,,, 9 | 30/07/2012,1391.740000,1381.370000,1385.300000,31.690000,7.820000,,,10.370000,,, 10 | 31/07/2012,1387.160000,1379.170000,1379.320000,5.790000,12.570000,,,7.990000,,, 11 | 01/08/2012,1385.030000,1373.350000,1375.320000,5.860000,13.810000,,,11.680000,,, 12 | 02/08/2012,1375.130000,1354.650000,1365.000000,1.780000,30.380000,,,20.670000,,, 13 | 03/08/2012,1394.160000,1365.450000,1390.990000,39.510000,9.680000,,,29.160000,,, 14 | 06/08/2012,1399.630000,1391.040000,1394.230000,34.180000,3.120000,,,8.640000,,, 15 | 07/08/2012,1407.140000,1394.460000,1401.350000,16.100000,5.170000,,,12.910000,,, 16 | 08/08/2012,1404.140000,1396.130000,1402.220000,9.680000,11.010000,261.400000,212.730000,8.010000,238.030000,1.098181,0.893711 17 | 09/08/2012,1405.950000,1398.800000,1402.800000,9.820000,5.340000,265.920000,199.870000,7.150000,230.860000,1.151867,0.865763 18 | 10/08/2012,1405.980000,1395.620000,1405.870000,7.180000,10.330000,272.950000,171.250000,10.360000,216.120000,1.262956,0.792384 19 | 13/08/2012,1405.870000,1397.320000,1404.110000,10.250000,8.660000,269.230000,146.810000,8.550000,202.380000,1.330319,0.725418 20 | 14/08/2012,1410.030000,1400.600000,1403.930000,12.710000,5.270000,267.200000,132.050000,9.430000,199.330000,1.340491,0.662469 21 | 15/08/2012,1407.730000,1401.830000,1405.530000,7.130000,8.200000,242.700000,134.440000,5.900000,179.990000,1.348408,0.746930 22 | 16/08/2012,1417.440000,1404.150000,1415.510000,15.610000,3.580000,207.290000,134.940000,13.290000,164.110000,1.263116,0.822253 23 | 17/08/2012,1418.710000,1414.670000,1418.160000,14.560000,2.770000,190.160000,129.890000,4.040000,157.780000,1.205222,0.823235 24 | 20/08/2012,1418.130000,1412.120000,1418.130000,3.460000,6.590000,187.830000,123.910000,6.040000,155.830000,1.205352,0.795161 25 | 21/08/2012,1426.680000,1410.860000,1413.170000,14.560000,7.270000,196.530000,117.370000,15.820000,159.970000,1.228543,0.733700 26 | 22/08/2012,1416.120000,1406.780000,1413.490000,5.260000,19.900000,200.010000,106.890000,9.340000,148.640000,1.345600,0.719120 27 | 23/08/2012,1413.490000,1400.500000,1402.080000,6.710000,15.620000,167.210000,112.830000,12.990000,132.470000,1.262248,0.851740 28 | 24/08/2012,1413.460000,1398.040000,1411.130000,12.960000,15.450000,145.990000,125.160000,15.420000,139.250000,1.048402,0.898815 29 | 27/08/2012,1416.170000,1409.110000,1410.440000,18.130000,4.350000,148.020000,124.340000,7.060000,133.400000,1.109595,0.932084 30 | 28/08/2012,1413.630000,1405.590000,1409.300000,4.520000,10.580000,142.860000,123.910000,8.040000,133.430000,1.070674,0.928652 31 | 29/08/2012,1413.950000,1406.570000,1410.490000,8.360000,7.060000,141.400000,125.630000,7.380000,133.660000,1.057908,0.939922 32 | -------------------------------------------------------------------------------- /test/data/cs-vpt.csv: -------------------------------------------------------------------------------- 1 | ,Close,Volume,pct_change,pct_change x Volume,unsmoothed vpt,14-smoothed vpt 2 | 3-Dec-10,24.7486,18730.144,,,, 3 | 6-Dec-10,24.7088,12271.74,-0.0016081717753730906,-19.735065902716972,-19.735065902716972, 4 | 7-Dec-10,25.0373,24691.414,0.013294858511947005,328.26885558990745,308.53378968719045, 5 | 8-Dec-10,25.545,18357.606,0.02027774560355966,372.25086435838045,680.784654045571, 6 | 9-Dec-10,25.0672,22964.08,-0.018704247406537533,-429.52583378352045,251.2588202620505, 7 | 10-Dec-10,25.107,15918.948,0.0015877321759112384,25.275025946257855,276.5338462083084, 8 | 13-Dec-10,24.888,16067.044,-0.008722666985302774,-140.147474250207,136.38637195810136, 9 | 14-Dec-10,24.9975,16568.487,0.004399710703953508,72.89654960221455,209.2829215603159, 10 | 15-Dec-10,25.0473,16018.729,0.0019921992199221084,31.912499417943653,241.19542097825956, 11 | 16-Dec-10,25.336,9773.569,0.011526192443896077,112.65203715769694,353.8474581359565, 12 | 17-Dec-10,25.0572,22572.712000000003,-0.011004104831070283,-248.3924891695582,105.45496896639833, 13 | 20-Dec-10,25.4455,12986.669,0.015496543907539406,201.24848637118086,306.70345533757916, 14 | 21-Dec-10,25.5649,10906.659,0.004692381757088748,51.17820772238781,357.88166305996697, 15 | 22-Dec-10,25.555,5799.259,-0.00038724970565118255,-2.2457613407449712,355.635901719222, 16 | 23-Dec-10,25.4057,7395.274,-0.005842300919585264,-43.20541609078499,312.430485628437,276.8710494031886 17 | 27-Dec-10,25.3658,5818.161999999999,-0.0015705137036177153,-9.137503150867852,303.2929824775691,299.94448143035186 18 | 28-Dec-10,25.0373,7164.726,-0.012950508164536578,-92.78684255966749,210.50613991790163,292.94250644683126 19 | 29-Dec-10,24.9178,5672.914000000001,-0.004772878864733765,-27.076131332052285,183.43000858584935,257.41717462827967 20 | 30-Dec-10,24.878,5624.741999999999,-0.0015972517637993233,-8.984129080416132,174.44587950543323,251.93053600280703 21 | 31-Dec-10,24.9676,5023.469,0.003601575689364145,18.09240382667441,192.53828333210762,245.93085294022126 22 | 3-Jan-11,25.0473,7457.090999999999,0.003192137009564444,23.804056164789927,216.34233949689755,251.64199347870672 23 | 4-Jan-11,24.45,11798.008999999998,-0.023846881699823963,-281.3457249164584,-65.00338541956083,232.05011440871553 24 | 5-Jan-11,24.5694,12366.132,0.0048834355828222265,60.38920903067658,-4.614176388884246,214.49228602534808 25 | 6-Jan-11,24.0219,13294.865,-0.022283816454614414,-296.26033144887725,-300.8745078377615,167.72643131293967 26 | 7-Jan-11,23.8825,9256.87,-0.0058030380611024945,-53.717968936677856,-354.5924767744393,134.8658994743084 27 | 10-Jan-11,24.2011,9690.604,0.013340311943891958,129.27568028472717,-225.31679648971215,96.86445291521618 28 | 11-Jan-11,24.2807,8870.318000000001,0.0032891066934974678,29.175422307251075,-196.14137418246108,57.291378826471316 29 | 12-Jan-11,24.3305,7168.965,0.0020510117088881064,14.703631155609024,-181.43774302685205,18.928975630323173 30 | 13-Jan-11,24.44,11356.18,0.0045005240336204455,51.10876102011983,-130.32898200673222,-12.696700629331774 31 | 14-Jan-11,25.0,13379.374,0.022913256955810146,306.56503436988544,176.23605236315322,-21.772195637504336 32 | -------------------------------------------------------------------------------- /test/data/cs-vwap.csv: -------------------------------------------------------------------------------- 1 | ,Date,High,Low,Close,Typical Price,Volume,vwap 2 | 0,3-Dec-10,24.8283,24.3205,24.7486,24.63247,18730.144,24.632466666666662 3 | 1,6-Dec-10,24.7586,24.5993,24.7088,24.6889,12271.74,24.654805154030853 4 | 2,7-Dec-10,25.1568,24.7785,25.0373,24.99087,24691.414,24.80379676048873 5 | 3,8-Dec-10,25.5848,24.9477,25.545,25.359170000000002,18357.606,24.941475861906202 6 | 4,9-Dec-10,25.6844,24.8083,25.0672,25.186629999999997,22964.08,24.999506235713717 7 | 5,10-Dec-10,25.336,25.0572,25.107,25.166729999999998,15918.948,25.023078243028557 8 | 6,13-Dec-10,25.2862,24.8482,24.888,25.00747,16067.044,25.021133824528068 9 | 7,14-Dec-10,25.1269,24.7496,24.9975,24.958000000000002,16568.487,25.013948032058988 10 | 8,15-Dec-10,25.2762,24.9278,25.0473,25.08377,16018.729,25.02086936568546 11 | 9,16-Dec-10,25.3857,25.0274,25.336,25.2497,9773.569,25.033920655429075 12 | 10,17-Dec-10,25.5351,25.0473,25.0572,25.2132,22572.712000000003,25.054787605744547 13 | 11,20-Dec-10,25.6048,25.0622,25.4455,25.370829999999998,12986.669,25.074623090960745 14 | 12,21-Dec-10,25.7441,25.5351,25.5649,25.6147,10906.659,25.10166479387297 15 | 13,22-Dec-10,25.7242,25.4554,25.555,25.5782,5799.259,25.11402265022072 16 | 14,23-Dec-10,25.6744,25.2862,25.4057,25.45543,7395.274,25.168402599215423 17 | 15,27-Dec-10,25.4455,25.1667,25.3658,25.326,5818.161999999999,25.201444302952908 18 | 16,28-Dec-10,25.3161,24.9178,25.0373,25.0904,7164.726,25.224830276069333 19 | 17,29-Dec-10,25.2563,24.9079,24.9178,25.02733,5672.914000000001,25.204409310250934 20 | 18,30-Dec-10,25.0373,24.8283,24.878,24.91453,5624.741999999999,25.196687502882995 21 | 19,31-Dec-10,25.0074,24.7088,24.9676,24.8946,5023.469,25.189626838746538 22 | 20,3-Jan-11,25.3061,25.0274,25.0473,25.126929999999998,7457.090999999999,25.20734712046974 23 | 21,4-Jan-11,25.116999999999997,24.3404,24.45,24.6358,11798.008999999998,25.187857717587416 24 | 22,5-Jan-11,24.6889,24.2708,24.5694,24.5097,12366.132,25.13631726721325 25 | 23,6-Jan-11,24.5495,23.8925,24.0219,24.154629999999997,13294.865,25.030555113789646 26 | 24,7-Jan-11,24.2708,23.778000000000002,23.8825,23.9771,9256.87,24.91547606305806 27 | 25,10-Jan-11,24.2708,23.7232,24.2011,24.06503,9690.604,24.794771487236023 28 | 26,11-Jan-11,24.5993,24.2011,24.2807,24.36037,8870.318000000001,24.68372645384523 29 | 27,12-Jan-11,24.4798,24.2409,24.3305,24.3504,7168.965,24.618745747839238 30 | 28,13-Jan-11,24.5595,23.4345,24.44,24.14467,11356.18,24.52276889908593 31 | 29,14-Jan-11,25.16,24.27,25.0,24.81,13379.374,24.51628803159466 32 | -------------------------------------------------------------------------------- /test/data/cs-wma.csv: -------------------------------------------------------------------------------- 1 | Date,Open,High,Low,Close,Volume,WMA 2 | 2020-04-09,562.09,575.1818,557.11,573.0,13650000.0,526.1344 3 | 2020-04-13,590.16,652.0,580.53,650.95,22475421.0,553.5311 4 | 2020-04-14,698.97,741.88,692.43,709.89,30576511.0,589.4087 5 | 2020-04-15,742.0,753.13,710.0,729.83,23577001.0,625.1433 6 | 2020-04-16,716.94,759.45,706.715,745.21,20657862.0,658.4369 7 | 2020-04-17,772.28,774.95,747.66,753.89,13128237.0,687.0056 8 | 2020-04-20,732.7,765.57,712.21,746.36,14746577.0,707.982 9 | 2020-04-21,730.12,753.33,673.79,686.72,20209093.0,711.9167 10 | 2020-04-22,703.98,734.0,688.71,732.11,14224831.0,721.79 11 | 2020-04-23,727.6,734.0,703.13,705.63,13236697.0,722.2947 12 | 2020-04-24,710.81,730.73,698.18,725.15,13237612.0,723.756 13 | 2020-04-27,737.61,799.49,735.0,798.75,20681442.0,738.2884 14 | 2020-04-28,795.64,805.0,756.69,769.12,15221964.0,744.9202 15 | 2020-04-29,790.17,803.1999,783.16,800.51,16215982.0,756.9569 16 | 2020-04-30,855.19,869.82,763.5,781.88,28471854.0,764.0387 17 | 2020-05-01,755.0,772.77,683.04,701.32,32531807.0,754.3864 18 | 2020-05-04,701.0,762.0,698.0,761.19,19237090.0,757.7091 19 | 2020-05-05,789.79,798.92,762.18,768.21,16991656.0,760.7809 20 | 2020-05-06,776.5,789.8,761.11,782.58,11123231.0,765.9244 21 | 2020-05-07,777.21,796.4,772.35,780.04,11527686.0,768.85 22 | 2020-05-08,793.77,824.0,787.01,819.42,16130087.0,778.4318 23 | 2020-05-11,790.51,824.0,785.0,811.29,16519601.0,785.9282 24 | 2020-05-12,827.0,843.29,808.0,809.41,15906905.0,792.1116 25 | 2020-05-13,820.83,826.0,763.3,790.96,19065491.0,794.4071 26 | 2020-05-14,780.0,803.36,764.0,803.33,13682188.0,798.9749 27 | 2020-05-15,790.35,805.0486,786.552,799.17,10518428.0,800.4438 28 | 2020-05-18,827.78,834.7201,803.88,813.63,11698102.0,803.9607 29 | 2020-05-19,815.17,822.07,806.08,808.01,9636522.0,805.3442 30 | 2020-05-20,820.5,826.0,811.8,815.56,7309271.0,807.6727 31 | 2020-05-21,816.0,832.5,796.0,827.6,12182524.0,811.6198 32 | 2020-05-22,822.1735,831.78,812.0,816.88,9987475.0,813.2411 33 | 2020-05-26,834.5,834.6,815.705,818.87,8089736.0,815.1362 34 | 2020-05-27,820.86,827.71,785.0,820.23,11549530.0,817.0931 35 | 2020-05-28,813.51,824.75,801.69,805.81,7275774.0,815.5156 36 | 2020-05-29,808.75,835.0,804.21,835.0,11812489.0,819.7209 37 | 2020-06-01,858.0,899.0,854.1,898.1,15085297.0,835.75 38 | 2020-06-02,894.7,908.66,871.0,881.56,13565596.0,846.594 39 | 2020-06-03,888.12,897.94,880.1,882.96,7949469.0,856.0836 40 | 2020-06-04,889.88,895.75,858.44,864.38,8887713.0,860.3593 41 | 2020-06-05,877.84,886.52,866.2,885.66,7811917.0,868.0738 42 | -------------------------------------------------------------------------------- /test/integration/wrapper.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import pandas as pd 4 | 5 | import ta 6 | 7 | 8 | class TestWrapper(unittest.TestCase): 9 | _filename = "test/data/datas.csv" 10 | 11 | @classmethod 12 | def setUpClass(cls): 13 | cls._df = pd.read_csv(cls._filename, sep=",") 14 | 15 | @classmethod 16 | def tearDownClass(cls): 17 | del cls._df 18 | 19 | def test_general(self): 20 | # Clean nan values 21 | df = ta.utils.dropna(self._df) 22 | 23 | # Add all ta features filling nans values 24 | ta.add_all_ta_features( 25 | df=df, 26 | open="Open", 27 | high="High", 28 | low="Low", 29 | close="Close", 30 | volume="Volume_BTC", 31 | fillna=True, 32 | ) 33 | 34 | # Add all ta features not filling nans values 35 | ta.add_all_ta_features( 36 | df=df, 37 | open="Open", 38 | high="High", 39 | low="Low", 40 | close="Close", 41 | volume="Volume_BTC", 42 | fillna=False, 43 | ) 44 | 45 | # Check added ta features are all numerical values after filling nans 46 | input_cols = self._df.columns 47 | df_with_ta = ta.add_all_ta_features( 48 | df=df, 49 | open="Open", 50 | high="High", 51 | low="Low", 52 | close="Close", 53 | volume="Volume_BTC", 54 | fillna=True, 55 | ) 56 | ta_cols = [c for c in df_with_ta.columns if c not in input_cols] 57 | self.assertTrue( 58 | df_with_ta[ta_cols] 59 | .apply(lambda series: pd.to_numeric(series, errors="coerce")) 60 | .notnull() 61 | .all() 62 | .all() 63 | ) 64 | 65 | self.assertTrue(df_with_ta.shape[1] == 94) 66 | 67 | def test_only_vectorized(self): 68 | # Clean nan values 69 | df = ta.utils.dropna(self._df) 70 | 71 | # Add all ta features filling nans values 72 | df_vectorized = ta.add_all_ta_features( 73 | df=df, 74 | open="Open", 75 | high="High", 76 | low="Low", 77 | close="Close", 78 | volume="Volume_BTC", 79 | fillna=True, 80 | vectorized=True, 81 | ) 82 | 83 | self.assertTrue(df_vectorized.shape[1] == 76) 84 | 85 | 86 | if __name__ == "__main__": 87 | unittest.main() 88 | -------------------------------------------------------------------------------- /test/unit/momentum.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import pandas as pd 4 | 5 | from ta.momentum import ( 6 | KAMAIndicator, 7 | PercentagePriceOscillator, 8 | PercentageVolumeOscillator, 9 | ROCIndicator, 10 | RSIIndicator, 11 | StochasticOscillator, 12 | StochRSIIndicator, 13 | TSIIndicator, 14 | UltimateOscillator, 15 | WilliamsRIndicator, 16 | kama, 17 | ppo, 18 | ppo_hist, 19 | ppo_signal, 20 | pvo, 21 | pvo_hist, 22 | pvo_signal, 23 | roc, 24 | rsi, 25 | stoch, 26 | stoch_signal, 27 | stochrsi, 28 | tsi, 29 | ultimate_oscillator, 30 | williams_r, 31 | ) 32 | 33 | 34 | class TestRateOfChangeIndicator(unittest.TestCase): 35 | """ 36 | https://school.stockcharts.com/doku.php?id=technical_indicators:on_balance_volume_obv 37 | """ 38 | 39 | _filename = "test/data/cs-roc.csv" 40 | 41 | @classmethod 42 | def setUpClass(cls): 43 | cls._df = pd.read_csv(cls._filename, sep=",") 44 | cls._params = {"close": cls._df["Close"], "window": 12, "fillna": False} 45 | cls._indicator = ROCIndicator(**cls._params) 46 | 47 | @classmethod 48 | def tearDownClass(cls): 49 | del cls._df 50 | 51 | def test_roc(self): 52 | target = "ROC" 53 | result = roc(**self._params) 54 | pd.testing.assert_series_equal( 55 | self._df[target].tail(), result.tail(), check_names=False 56 | ) 57 | 58 | def test_roc2(self): 59 | target = "ROC" 60 | result = self._indicator.roc() 61 | pd.testing.assert_series_equal( 62 | self._df[target].tail(), result.tail(), check_names=False 63 | ) 64 | 65 | 66 | class TestRSIIndicator(unittest.TestCase): 67 | """ 68 | https://school.stockcharts.com/doku.php?id=technical_indicators:relative_strength_index_rsi 69 | Note: Using a more simple initilization (directly `ewm`; stockcharts uses `sma` + `ewm`) 70 | """ 71 | 72 | _filename = "test/data/cs-rsi.csv" 73 | 74 | @classmethod 75 | def setUpClass(cls): 76 | cls._df = pd.read_csv(cls._filename, sep=",") 77 | cls._params = {"close": cls._df["Close"], "window": 14, "fillna": False} 78 | cls._indicator = RSIIndicator(**cls._params) 79 | 80 | @classmethod 81 | def tearDownClass(cls): 82 | del cls._df 83 | 84 | def test_rsi(self): 85 | target = "RSI" 86 | result = self._indicator.rsi() 87 | pd.testing.assert_series_equal( 88 | self._df[target].tail(), result.tail(), check_names=False 89 | ) 90 | 91 | def test_rsi2(self): 92 | target = "RSI" 93 | result = rsi(**self._params) 94 | pd.testing.assert_series_equal( 95 | self._df[target].tail(), result.tail(), check_names=False 96 | ) 97 | 98 | 99 | class TestStochRSIIndicator(unittest.TestCase): 100 | """ 101 | https://school.stockcharts.com/doku.php?id=technical_indicators:stochrsi 102 | """ 103 | 104 | _filename = "test/data/cs-stochrsi.csv" 105 | 106 | @classmethod 107 | def setUpClass(cls): 108 | cls._df = pd.read_csv(cls._filename, sep=",") 109 | cls._params = { 110 | "close": cls._df["Close"], 111 | "window": 14, 112 | "smooth1": 3, 113 | "smooth2": 3, 114 | "fillna": False, 115 | } 116 | cls._indicator = StochRSIIndicator(**cls._params) 117 | 118 | @classmethod 119 | def tearDownClass(cls): 120 | del cls._df 121 | 122 | def test_stochrsi(self): 123 | target = "StochRSI(14)" 124 | result = self._indicator.stochrsi() 125 | pd.testing.assert_series_equal( 126 | self._df[target].tail(), result.tail(), check_names=False 127 | ) 128 | 129 | def test_stochrsi2(self): 130 | target = "StochRSI(14)" 131 | result = stochrsi(**self._params) 132 | pd.testing.assert_series_equal( 133 | self._df[target].tail(), result.tail(), check_names=False 134 | ) 135 | 136 | 137 | class TestUltimateOscillator(unittest.TestCase): 138 | """ 139 | https://school.stockcharts.com/doku.php?id=technical_indicators:ultimate_oscillator 140 | """ 141 | 142 | _filename = "test/data/cs-ultosc.csv" 143 | 144 | @classmethod 145 | def setUpClass(cls): 146 | cls._df = pd.read_csv(cls._filename, sep=",") 147 | cls._params = { 148 | "high": cls._df["High"], 149 | "low": cls._df["Low"], 150 | "close": cls._df["Close"], 151 | "window1": 7, 152 | "window2": 14, 153 | "window3": 28, 154 | "weight1": 4.0, 155 | "weight2": 2.0, 156 | "weight3": 1.0, 157 | "fillna": False, 158 | } 159 | cls._indicator = UltimateOscillator(**cls._params) 160 | 161 | @classmethod 162 | def tearDownClass(cls): 163 | del cls._df 164 | 165 | def test_uo(self): 166 | target = "Ult_Osc" 167 | result = self._indicator.ultimate_oscillator() 168 | pd.testing.assert_series_equal( 169 | self._df[target].tail(), result.tail(), check_names=False 170 | ) 171 | 172 | def test_uo2(self): 173 | target = "Ult_Osc" 174 | result = ultimate_oscillator(**self._params) 175 | pd.testing.assert_series_equal( 176 | self._df[target].tail(), result.tail(), check_names=False 177 | ) 178 | 179 | 180 | class TestStochasticOscillator(unittest.TestCase): 181 | """ 182 | https://school.stockcharts.com/doku.php?id=technical_indicators:stochastic_oscillator_fast_slow_and_full 183 | """ 184 | 185 | _filename = "test/data/cs-soo.csv" 186 | 187 | @classmethod 188 | def setUpClass(cls): 189 | cls._df = pd.read_csv(cls._filename, sep=",") 190 | cls._params = { 191 | "high": cls._df["High"], 192 | "low": cls._df["Low"], 193 | "close": cls._df["Close"], 194 | "window": 14, 195 | "smooth_window": 3, 196 | "fillna": False, 197 | } 198 | cls._indicator = StochasticOscillator(**cls._params) 199 | 200 | @classmethod 201 | def tearDownClass(cls): 202 | del cls._df 203 | 204 | def test_so(self): 205 | target = "SO" 206 | result = self._indicator.stoch() 207 | pd.testing.assert_series_equal( 208 | self._df[target].tail(), result.tail(), check_names=False 209 | ) 210 | 211 | def test_so_signal(self): 212 | target = "SO_SIG" 213 | result = self._indicator.stoch_signal() 214 | pd.testing.assert_series_equal( 215 | self._df[target].tail(), result.tail(), check_names=False 216 | ) 217 | 218 | def test_so2(self): 219 | target = "SO" 220 | result = stoch(**self._params) 221 | pd.testing.assert_series_equal( 222 | self._df[target].tail(), result.tail(), check_names=False 223 | ) 224 | 225 | def test_so_signal2(self): 226 | target = "SO_SIG" 227 | result = stoch_signal(**self._params) 228 | pd.testing.assert_series_equal( 229 | self._df[target].tail(), result.tail(), check_names=False 230 | ) 231 | 232 | 233 | class TestWilliamsRIndicator(unittest.TestCase): 234 | """ 235 | https://school.stockcharts.com/doku.php?id=technical_indicators:williams_r 236 | """ 237 | 238 | _filename = "test/data/cs-percentr.csv" 239 | 240 | @classmethod 241 | def setUpClass(cls): 242 | cls._df = pd.read_csv(cls._filename, sep=",") 243 | cls._params = { 244 | "high": cls._df["High"], 245 | "low": cls._df["Low"], 246 | "close": cls._df["Close"], 247 | "lbp": 14, 248 | "fillna": False, 249 | } 250 | cls._indicator = WilliamsRIndicator(**cls._params) 251 | 252 | @classmethod 253 | def tearDownClass(cls): 254 | del cls._df 255 | 256 | def test_wr(self): 257 | target = "Williams_%R" 258 | result = self._indicator.williams_r() 259 | pd.testing.assert_series_equal( 260 | self._df[target].tail(), result.tail(), check_names=False 261 | ) 262 | 263 | def test_wr2(self): 264 | target = "Williams_%R" 265 | result = williams_r(**self._params) 266 | pd.testing.assert_series_equal( 267 | self._df[target].tail(), result.tail(), check_names=False 268 | ) 269 | 270 | 271 | class TestKAMAIndicator(unittest.TestCase): 272 | """ 273 | https://school.stockcharts.com/doku.php?id=technical_indicators:kaufman_s_adaptive_moving_average 274 | """ 275 | 276 | _filename = "test/data/cs-kama.csv" 277 | 278 | @classmethod 279 | def setUpClass(cls): 280 | cls._df = pd.read_csv(cls._filename, sep=",") 281 | cls._params = { 282 | "close": cls._df["Close"], 283 | "window": 10, 284 | "pow1": 2, 285 | "pow2": 30, 286 | "fillna": False, 287 | } 288 | cls._indicator = KAMAIndicator(**cls._params) 289 | 290 | @classmethod 291 | def tearDownClass(cls): 292 | del cls._df 293 | 294 | def test_kama(self): 295 | target = "KAMA" 296 | result = self._indicator.kama() 297 | pd.testing.assert_series_equal( 298 | self._df[target].tail(), result.tail(), check_names=False 299 | ) 300 | 301 | def test_kama2(self): 302 | target = "KAMA" 303 | result = kama(**self._params) 304 | pd.testing.assert_series_equal( 305 | self._df[target].tail(), result.tail(), check_names=False 306 | ) 307 | 308 | 309 | class TestTSIIndicator(unittest.TestCase): 310 | """ 311 | https://school.stockcharts.com/doku.php?id=technical_indicators:true_strength_index 312 | """ 313 | 314 | _filename = "test/data/cs-tsi.csv" 315 | 316 | @classmethod 317 | def setUpClass(cls): 318 | cls._df = pd.read_csv(cls._filename, sep=",") 319 | cls._params = { 320 | "close": cls._df["Close"], 321 | "window_slow": 25, 322 | "window_fast": 13, 323 | "fillna": False, 324 | } 325 | cls._indicator = TSIIndicator(**cls._params) 326 | 327 | @classmethod 328 | def tearDownClass(cls): 329 | del cls._df 330 | 331 | def test_tsi(self): 332 | target = "TSI" 333 | result = self._indicator.tsi() 334 | pd.testing.assert_series_equal( 335 | self._df[target].tail(), 336 | result.tail(), 337 | check_names=False, 338 | check_less_precise=True, 339 | ) 340 | 341 | def test_tsi2(self): 342 | target = "TSI" 343 | result = tsi(**self._params) 344 | pd.testing.assert_series_equal( 345 | self._df[target].tail(), 346 | result.tail(), 347 | check_names=False, 348 | check_less_precise=True, 349 | ) 350 | 351 | 352 | class TestPercentagePriceOscillator(unittest.TestCase): 353 | """ 354 | https://school.stockcharts.com/doku.php?id=technical_indicators:price_oscillators_ppo 355 | https://docs.google.com/spreadsheets/d/1h9p8_PXU7G8sD-LciydpmH6rveaLwvoL7SMBGmO3kM4/edit#gid=0 356 | """ 357 | 358 | _filename = "test/data/cs-ppo.csv" 359 | 360 | @classmethod 361 | def setUpClass(cls): 362 | cls._df = pd.read_csv(cls._filename, sep=",") 363 | cls._params = { 364 | "close": cls._df["Close"], 365 | "window_slow": 26, 366 | "window_fast": 12, 367 | "window_sign": 9, 368 | "fillna": True, 369 | } 370 | cls._indicator = PercentagePriceOscillator(**cls._params) 371 | 372 | @classmethod 373 | def tearDownClass(cls): 374 | del cls._df 375 | 376 | def test_ppo(self): 377 | target = "PPO" 378 | result = self._indicator.ppo() 379 | pd.testing.assert_series_equal( 380 | self._df[target].tail(), result.tail(), check_names=False 381 | ) 382 | 383 | def test_ppo2(self): 384 | target = "PPO" 385 | result = ppo(**self._params) 386 | pd.testing.assert_series_equal( 387 | self._df[target].tail(), result.tail(), check_names=False 388 | ) 389 | 390 | def test_ppo_signal(self): 391 | target = "PPO_Signal_Line" 392 | result = self._indicator.ppo_signal() 393 | pd.testing.assert_series_equal( 394 | self._df[target].tail(), result.tail(), check_names=False 395 | ) 396 | 397 | def test_ppo_signal2(self): 398 | target = "PPO_Signal_Line" 399 | result = ppo_signal(**self._params) 400 | pd.testing.assert_series_equal( 401 | self._df[target].tail(), result.tail(), check_names=False 402 | ) 403 | 404 | def test_ppo_hist(self): 405 | target = "PPO_Histogram" 406 | result = self._indicator.ppo_hist() 407 | pd.testing.assert_series_equal( 408 | self._df[target].tail(), result.tail(), check_names=False 409 | ) 410 | 411 | def test_ppo_hist2(self): 412 | target = "PPO_Histogram" 413 | result = ppo_hist(**self._params) 414 | pd.testing.assert_series_equal( 415 | self._df[target].tail(), result.tail(), check_names=False 416 | ) 417 | 418 | 419 | class TestPercentageVolumeOscillator(unittest.TestCase): 420 | """ 421 | https://school.stockcharts.com/doku.php?id=technical_indicators:percentage_volume_oscillator_pvo 422 | https://docs.google.com/spreadsheets/d/1SyePHvrVBAcmjDiXe877Qrycx6TmajyrZ8UdrwVk9MI/edit#gid=0 423 | """ 424 | 425 | _filename = "test/data/cs-pvo.csv" 426 | 427 | @classmethod 428 | def setUpClass(cls): 429 | cls._df = pd.read_csv(cls._filename, sep=",") 430 | cls._params = { 431 | "volume": cls._df["Volume"], 432 | "window_slow": 26, 433 | "window_fast": 12, 434 | "window_sign": 9, 435 | "fillna": True, 436 | } 437 | cls._indicator = PercentageVolumeOscillator(**cls._params) 438 | 439 | @classmethod 440 | def tearDownClass(cls): 441 | del cls._df 442 | 443 | def test_pvo(self): 444 | target = "PVO" 445 | result = self._indicator.pvo() 446 | pd.testing.assert_series_equal( 447 | self._df[target].tail(), result.tail(), check_names=False 448 | ) 449 | 450 | def test_pvo2(self): 451 | target = "PVO" 452 | result = pvo(**self._params) 453 | pd.testing.assert_series_equal( 454 | self._df[target].tail(), result.tail(), check_names=False 455 | ) 456 | 457 | def test_pvo_signal(self): 458 | target = "PVO_Signal_Line" 459 | result = self._indicator.pvo_signal() 460 | pd.testing.assert_series_equal( 461 | self._df[target].tail(), result.tail(), check_names=False 462 | ) 463 | 464 | def test_pvo_signal2(self): 465 | target = "PVO_Signal_Line" 466 | result = pvo_signal(**self._params) 467 | pd.testing.assert_series_equal( 468 | self._df[target].tail(), result.tail(), check_names=False 469 | ) 470 | 471 | def test_pvo_hist(self): 472 | target = "PVO_Histogram" 473 | result = self._indicator.pvo_hist() 474 | pd.testing.assert_series_equal( 475 | self._df[target].tail(), result.tail(), check_names=False 476 | ) 477 | 478 | def test_pvo_hist2(self): 479 | target = "PVO_Histogram" 480 | result = pvo_hist(**self._params) 481 | pd.testing.assert_series_equal( 482 | self._df[target].tail(), result.tail(), check_names=False 483 | ) 484 | 485 | 486 | if __name__ == "__main__": 487 | unittest.main() 488 | -------------------------------------------------------------------------------- /test/unit/trend.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import pandas as pd 4 | 5 | from ta.trend import ( 6 | MACD, 7 | ADXIndicator, 8 | CCIIndicator, 9 | PSARIndicator, 10 | STCIndicator, 11 | VortexIndicator, 12 | WMAIndicator, 13 | adx, 14 | adx_neg, 15 | adx_pos, 16 | cci, 17 | macd, 18 | macd_diff, 19 | macd_signal, 20 | psar_down, 21 | psar_down_indicator, 22 | psar_up, 23 | psar_up_indicator, 24 | stc, 25 | vortex_indicator_neg, 26 | vortex_indicator_pos, 27 | wma_indicator, 28 | ) 29 | 30 | 31 | class TestADXIndicator(unittest.TestCase): 32 | """ 33 | https://school.stockcharts.com/doku.php?id=technical_indicators:average_directional_index_adx 34 | """ 35 | 36 | _filename = "test/data/cs-adx.csv" 37 | 38 | @classmethod 39 | def setUpClass(cls): 40 | cls._df = pd.read_csv(cls._filename, sep=",") 41 | cls._params = { 42 | "high": cls._df["High"], 43 | "low": cls._df["Low"], 44 | "close": cls._df["Close"], 45 | "window": 14, 46 | "fillna": False, 47 | } 48 | cls._indicator = ADXIndicator(**cls._params) 49 | 50 | @classmethod 51 | def tearDownClass(cls): 52 | del cls._df 53 | 54 | def test_adx(self): 55 | target = "ADX" 56 | result = adx(**self._params) 57 | pd.testing.assert_series_equal( 58 | self._df[target].tail(), result.tail(), check_names=False 59 | ) 60 | 61 | def test_adx2(self): 62 | target = "ADX" 63 | result = self._indicator.adx() 64 | pd.testing.assert_series_equal( 65 | self._df[target].tail(), result.tail(), check_names=False 66 | ) 67 | 68 | def test_adx_pos(self): 69 | target = "+DI14" 70 | result = adx_pos(**self._params) 71 | pd.testing.assert_series_equal( 72 | self._df[target].tail(), result.tail(), check_names=False 73 | ) 74 | 75 | def test_adx_pos2(self): 76 | target = "+DI14" 77 | result = self._indicator.adx_pos() 78 | pd.testing.assert_series_equal( 79 | self._df[target].tail(), result.tail(), check_names=False 80 | ) 81 | 82 | def test_adx_neg(self): 83 | target = "-DI14" 84 | result = adx_neg(**self._params) 85 | pd.testing.assert_series_equal( 86 | self._df[target].tail(), result.tail(), check_names=False 87 | ) 88 | 89 | def test_adx_neg2(self): 90 | target = "-DI14" 91 | result = self._indicator.adx_neg() 92 | pd.testing.assert_series_equal( 93 | self._df[target].tail(), result.tail(), check_names=False 94 | ) 95 | 96 | 97 | class TestMACDIndicator(unittest.TestCase): 98 | """ 99 | https://school.stockcharts.com/doku.php?id=technical_indicators:moving_average_convergence_divergence_macd 100 | """ 101 | 102 | _filename = "test/data/cs-macd.csv" 103 | 104 | @classmethod 105 | def setUpClass(cls): 106 | cls._df = pd.read_csv(cls._filename, sep=",") 107 | cls._params = { 108 | "close": cls._df["Close"], 109 | "window_slow": 26, 110 | "window_fast": 12, 111 | "window_sign": 9, 112 | "fillna": False, 113 | } 114 | cls._indicator = MACD(**cls._params) 115 | 116 | @classmethod 117 | def tearDownClass(cls): 118 | del cls._df 119 | 120 | def test_macd(self): 121 | target = "MACD_line" 122 | result = macd( 123 | close=self._df["Close"], window_slow=26, window_fast=12, fillna=False 124 | ) 125 | pd.testing.assert_series_equal( 126 | self._df[target].tail(), result.tail(), check_names=False 127 | ) 128 | 129 | def test_macd2(self): 130 | target = "MACD_line" 131 | result = self._indicator.macd() 132 | pd.testing.assert_series_equal( 133 | self._df[target].tail(), result.tail(), check_names=False 134 | ) 135 | 136 | def test_macd_signal(self): 137 | target = "MACD_signal" 138 | result = macd_signal(**self._params) 139 | pd.testing.assert_series_equal( 140 | self._df[target].tail(), result.tail(), check_names=False 141 | ) 142 | 143 | def test_macd_signal2(self): 144 | target = "MACD_signal" 145 | result = MACD(**self._params).macd_signal() 146 | pd.testing.assert_series_equal( 147 | self._df[target].tail(), result.tail(), check_names=False 148 | ) 149 | 150 | def test_macd_diff(self): 151 | target = "MACD_diff" 152 | result = macd_diff(**self._params) 153 | pd.testing.assert_series_equal( 154 | self._df[target].tail(), result.tail(), check_names=False 155 | ) 156 | 157 | def test_macd_diff2(self): 158 | target = "MACD_diff" 159 | result = MACD(**self._params).macd_diff() 160 | pd.testing.assert_series_equal( 161 | self._df[target].tail(), result.tail(), check_names=False 162 | ) 163 | 164 | 165 | class TestCCIIndicator(unittest.TestCase): 166 | """ 167 | http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:commodity_channel_index_cci 168 | """ 169 | 170 | _filename = "test/data/cs-cci.csv" 171 | 172 | @classmethod 173 | def setUpClass(cls): 174 | cls._df = pd.read_csv(cls._filename, sep=",") 175 | cls._params = { 176 | "high": cls._df["High"], 177 | "low": cls._df["Low"], 178 | "close": cls._df["Close"], 179 | "window": 20, 180 | "constant": 0.015, 181 | "fillna": False, 182 | } 183 | cls._indicator = CCIIndicator(**cls._params) 184 | 185 | @classmethod 186 | def tearDownClass(cls): 187 | del cls._df 188 | 189 | def test_cci(self): 190 | target = "CCI" 191 | result = cci(**self._params) 192 | pd.testing.assert_series_equal( 193 | self._df[target].tail(), result.tail(), check_names=False 194 | ) 195 | 196 | def test_cci2(self): 197 | target = "CCI" 198 | result = self._indicator.cci() 199 | pd.testing.assert_series_equal( 200 | self._df[target].tail(), result.tail(), check_names=False 201 | ) 202 | 203 | 204 | class TestVortexIndicator(unittest.TestCase): 205 | """ 206 | http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:commodity_channel_index_cci 207 | """ 208 | 209 | _filename = "test/data/cs-vortex.csv" 210 | 211 | @classmethod 212 | def setUpClass(cls): 213 | cls._df = pd.read_csv(cls._filename, sep=",") 214 | cls._params = { 215 | "high": cls._df["High"], 216 | "low": cls._df["Low"], 217 | "close": cls._df["Close"], 218 | "window": 14, 219 | "fillna": False, 220 | } 221 | cls._indicator = VortexIndicator(**cls._params) 222 | 223 | @classmethod 224 | def tearDownClass(cls): 225 | del cls._df 226 | 227 | def test_vortex_indicator_pos(self): 228 | target = "+VI14" 229 | result = vortex_indicator_pos(**self._params) 230 | pd.testing.assert_series_equal( 231 | self._df[target].tail(), result.tail(), check_names=False 232 | ) 233 | 234 | def test_vortex_indicator_pos2(self): 235 | target = "+VI14" 236 | result = self._indicator.vortex_indicator_pos() 237 | pd.testing.assert_series_equal( 238 | self._df[target].tail(), result.tail(), check_names=False 239 | ) 240 | 241 | def test_vortex_indicator_neg(self): 242 | target = "-VI14" 243 | result = vortex_indicator_neg(**self._params) 244 | pd.testing.assert_series_equal( 245 | self._df[target].tail(), result.tail(), check_names=False 246 | ) 247 | 248 | def test_vortex_indicator_neg2(self): 249 | target = "-VI14" 250 | result = self._indicator.vortex_indicator_neg() 251 | pd.testing.assert_series_equal( 252 | self._df[target].tail(), result.tail(), check_names=False 253 | ) 254 | 255 | 256 | class TestPSARIndicator(unittest.TestCase): 257 | """ 258 | https://school.stockcharts.com/doku.php?id=technical_indicators:parabolic_sar 259 | """ 260 | 261 | _filename = "test/data/cs-psar.csv" 262 | 263 | @classmethod 264 | def setUpClass(cls): 265 | cls._df = pd.read_csv(cls._filename, sep=",") 266 | cls._params = { 267 | "high": cls._df["High"], 268 | "low": cls._df["Low"], 269 | "close": cls._df["Close"], 270 | "fillna": False, 271 | } 272 | cls._indicator = PSARIndicator(**cls._params) 273 | 274 | @classmethod 275 | def tearDownClass(cls): 276 | del cls._df 277 | 278 | def test_psar_up(self): 279 | target = "psar_up" 280 | result = self._indicator.psar_up() 281 | pd.testing.assert_series_equal( 282 | self._df[target].tail(), result.tail(), check_names=False 283 | ) 284 | 285 | def test_psar_down(self): 286 | target = "psar_down" 287 | result = self._indicator.psar_down() 288 | pd.testing.assert_series_equal( 289 | self._df[target].tail(), result.tail(), check_names=False 290 | ) 291 | 292 | def test_psar_up_indicator(self): 293 | target = "psar_up_ind" 294 | result = self._indicator.psar_up_indicator() 295 | pd.testing.assert_series_equal( 296 | self._df[target].tail(), result.tail(), check_names=False 297 | ) 298 | 299 | def test_psar_down_indicator(self): 300 | target = "psar_down_ind" 301 | result = self._indicator.psar_down_indicator() 302 | pd.testing.assert_series_equal( 303 | self._df[target].tail(), result.tail(), check_names=False 304 | ) 305 | 306 | def test_psar_up2(self): 307 | target = "psar_up" 308 | result = psar_up(**self._params) 309 | pd.testing.assert_series_equal( 310 | self._df[target].tail(), result.tail(), check_names=False 311 | ) 312 | 313 | def test_psar_down2(self): 314 | target = "psar_down" 315 | result = psar_down(**self._params) 316 | pd.testing.assert_series_equal( 317 | self._df[target].tail(), result.tail(), check_names=False 318 | ) 319 | 320 | def test_psar_up_indicator2(self): 321 | target = "psar_up_ind" 322 | result = psar_up_indicator(**self._params) 323 | pd.testing.assert_series_equal( 324 | self._df[target].tail(), result.tail(), check_names=False 325 | ) 326 | 327 | def test_psar_down_indicator2(self): 328 | target = "psar_down_ind" 329 | result = psar_down_indicator(**self._params) 330 | pd.testing.assert_series_equal( 331 | self._df[target].tail(), result.tail(), check_names=False 332 | ) 333 | 334 | 335 | class TestSTCIndicator(unittest.TestCase): 336 | """ 337 | https://www.investopedia.com/articles/forex/10/schaff-trend-cycle-indicator.asp 338 | https://docs.google.com/spreadsheets/d/1z6o_R_hCGCGQARC791KdrOD5E69IhjAXbXqi1014hcs/edit?usp=sharing 339 | """ 340 | 341 | _filename = "test/data/cs-stc.csv" 342 | 343 | @classmethod 344 | def setUpClass(cls): 345 | cls._df = pd.read_csv(cls._filename, sep=",") 346 | cls._params = { 347 | "close": cls._df["Close"], 348 | "window_slow": 50, 349 | "window_fast": 23, 350 | "cycle": 10, 351 | "smooth1": 3, 352 | "smooth2": 3, 353 | "fillna": False, 354 | } 355 | cls._indicator = STCIndicator(**cls._params) 356 | 357 | @classmethod 358 | def tearDownClass(cls): 359 | del cls._df 360 | 361 | def test_stc(self): 362 | target = "stc" 363 | result = self._indicator.stc() 364 | pd.testing.assert_series_equal( 365 | self._df[target].tail(15), result.tail(15), check_names=False 366 | ) 367 | 368 | def test_stc2(self): 369 | target = "stc" 370 | result = stc(**self._params) 371 | pd.testing.assert_series_equal( 372 | self._df[target].tail(), result.tail(), check_names=False 373 | ) 374 | 375 | 376 | class TestWMAIndicator(unittest.TestCase): 377 | _filename = "test/data/cs-wma.csv" 378 | 379 | @classmethod 380 | def setUpClass(cls): 381 | cls._df = pd.read_csv(cls._filename, sep=",") 382 | cls._params = {"close": cls._df["Close"], "window": 9, "fillna": False} 383 | cls._indicator = WMAIndicator(**cls._params) 384 | 385 | @classmethod 386 | def tearDownClass(cls): 387 | del cls._df 388 | 389 | def test_wma(self): 390 | target = "WMA" 391 | result = self._indicator.wma() 392 | pd.testing.assert_series_equal( 393 | self._df[target].tail(), result.tail(), check_names=False 394 | ) 395 | 396 | def test_wma2(self): 397 | target = "WMA" 398 | result = wma_indicator(**self._params) 399 | pd.testing.assert_series_equal( 400 | self._df[target].tail(), result.tail(), check_names=False 401 | ) 402 | 403 | 404 | if __name__ == "__main__": 405 | unittest.main() 406 | -------------------------------------------------------------------------------- /test/unit/volatility.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import pandas as pd 4 | 5 | from ta.volatility import ( 6 | AverageTrueRange, 7 | BollingerBands, 8 | DonchianChannel, 9 | KeltnerChannel, 10 | UlcerIndex, 11 | average_true_range, 12 | bollinger_hband, 13 | bollinger_hband_indicator, 14 | bollinger_lband, 15 | bollinger_lband_indicator, 16 | bollinger_mavg, 17 | bollinger_pband, 18 | bollinger_wband, 19 | donchian_channel_hband, 20 | donchian_channel_lband, 21 | donchian_channel_mband, 22 | donchian_channel_pband, 23 | donchian_channel_wband, 24 | keltner_channel_hband, 25 | keltner_channel_hband_indicator, 26 | keltner_channel_lband, 27 | keltner_channel_lband_indicator, 28 | keltner_channel_mband, 29 | keltner_channel_pband, 30 | keltner_channel_wband, 31 | ulcer_index, 32 | ) 33 | 34 | 35 | class TestAverageTrueRange(unittest.TestCase): 36 | """ 37 | https://school.stockcharts.com/doku.php?id=technical_indicators:average_true_range_atr 38 | https://docs.google.com/spreadsheets/d/1DYG5NI_1px30aZ6oJkDIkWsyJW5V8jGbBVKIr9NWtec/edit?usp=sharing 39 | """ 40 | 41 | _filename = "test/data/cs-atr.csv" 42 | 43 | @classmethod 44 | def setUpClass(cls): 45 | cls._df = pd.read_csv(cls._filename, sep=",") 46 | cls._params = { 47 | "high": cls._df["High"], 48 | "low": cls._df["Low"], 49 | "close": cls._df["Close"], 50 | "window": 14, 51 | "fillna": False, 52 | } 53 | cls._indicator = AverageTrueRange(**cls._params) 54 | 55 | @classmethod 56 | def tearDownClass(cls): 57 | del cls._df 58 | 59 | def test_atr(self): 60 | target = "ATR" 61 | result = average_true_range(**self._params) 62 | pd.testing.assert_series_equal( 63 | self._df[target].tail(), result.tail(), check_names=False 64 | ) 65 | 66 | def test_atr2(self): 67 | target = "ATR" 68 | result = self._indicator.average_true_range() 69 | pd.testing.assert_series_equal( 70 | self._df[target].tail(), result.tail(), check_names=False 71 | ) 72 | 73 | 74 | class TestAverageTrueRange2(unittest.TestCase): 75 | """ 76 | https://school.stockcharts.com/doku.php?id=technical_indicators:average_true_range_atr 77 | https://docs.google.com/spreadsheets/d/1IRlmwVmRLAzjIIt2iXBukZyyaSAYB_0iRyAoOowZaBk/edit?usp=sharing 78 | """ 79 | 80 | _filename = "test/data/cs-atr2.csv" 81 | 82 | @classmethod 83 | def setUpClass(cls): 84 | cls._df = pd.read_csv(cls._filename, sep=",") 85 | cls._params = { 86 | "high": cls._df["High"], 87 | "low": cls._df["Low"], 88 | "close": cls._df["Close"], 89 | "window": 10, 90 | "fillna": False, 91 | } 92 | cls._indicator = AverageTrueRange(**cls._params) 93 | 94 | @classmethod 95 | def tearDownClass(cls): 96 | del cls._df 97 | 98 | def test_atr(self): 99 | target = "ATR" 100 | result = self._indicator.average_true_range() 101 | pd.testing.assert_series_equal( 102 | self._df[target].tail(), result.tail(), check_names=False 103 | ) 104 | 105 | def test_atr2(self): 106 | target = "ATR" 107 | result = average_true_range(**self._params) 108 | pd.testing.assert_series_equal( 109 | self._df[target].tail(), result.tail(), check_names=False 110 | ) 111 | 112 | 113 | class TestBollingerBands(unittest.TestCase): 114 | """ 115 | https://school.stockcharts.com/doku.php?id=technical_indicators:bollinger_bands 116 | """ 117 | 118 | _filename = "test/data/cs-bbands.csv" 119 | 120 | @classmethod 121 | def setUpClass(cls): 122 | cls._df = pd.read_csv(cls._filename, sep=",") 123 | cls._params = { 124 | "close": cls._df["Close"], 125 | "window": 20, 126 | "window_dev": 2, 127 | "fillna": False, 128 | } 129 | cls._indicator = BollingerBands(**cls._params) 130 | 131 | @classmethod 132 | def tearDownClass(cls): 133 | del cls._df 134 | 135 | def test_mavg(self): 136 | target = "MiddleBand" 137 | result = self._indicator.bollinger_mavg() 138 | pd.testing.assert_series_equal( 139 | self._df[target].tail(), result.tail(), check_names=False 140 | ) 141 | 142 | def test_hband(self): 143 | target = "HighBand" 144 | result = self._indicator.bollinger_hband() 145 | pd.testing.assert_series_equal( 146 | self._df[target].tail(), result.tail(), check_names=False 147 | ) 148 | 149 | def test_lband(self): 150 | target = "LowBand" 151 | result = self._indicator.bollinger_lband() 152 | pd.testing.assert_series_equal( 153 | self._df[target].tail(), result.tail(), check_names=False 154 | ) 155 | 156 | def test_wband(self): 157 | target = "WidthBand" 158 | result = self._indicator.bollinger_wband() 159 | pd.testing.assert_series_equal( 160 | self._df[target].tail(), result.tail(), check_names=False 161 | ) 162 | 163 | def test_pband(self): 164 | target = "PercentageBand" 165 | result = self._indicator.bollinger_pband() 166 | pd.testing.assert_series_equal( 167 | self._df[target].tail(), result.tail(), check_names=False 168 | ) 169 | 170 | def test_hband_indicator(self): 171 | target = "CrossUp" 172 | result = self._indicator.bollinger_hband_indicator() 173 | pd.testing.assert_series_equal( 174 | self._df[target].tail(), result.tail(), check_names=False 175 | ) 176 | 177 | def test_lband_indicator(self): 178 | target = "CrossDown" 179 | result = self._indicator.bollinger_lband_indicator() 180 | pd.testing.assert_series_equal( 181 | self._df[target].tail(), result.tail(), check_names=False 182 | ) 183 | 184 | def test_mavg2(self): 185 | target = "MiddleBand" 186 | result = bollinger_mavg(close=self._df["Close"], window=20, fillna=False) 187 | pd.testing.assert_series_equal( 188 | self._df[target].tail(), result.tail(), check_names=False 189 | ) 190 | 191 | def test_hband2(self): 192 | target = "HighBand" 193 | result = bollinger_hband(**self._params) 194 | pd.testing.assert_series_equal( 195 | self._df[target].tail(), result.tail(), check_names=False 196 | ) 197 | 198 | def test_lband2(self): 199 | target = "LowBand" 200 | result = bollinger_lband(**self._params) 201 | pd.testing.assert_series_equal( 202 | self._df[target].tail(), result.tail(), check_names=False 203 | ) 204 | 205 | def test_wband2(self): 206 | target = "WidthBand" 207 | result = bollinger_wband(**self._params) 208 | pd.testing.assert_series_equal( 209 | self._df[target].tail(), result.tail(), check_names=False 210 | ) 211 | 212 | def test_pband2(self): 213 | target = "PercentageBand" 214 | result = bollinger_pband(**self._params) 215 | pd.testing.assert_series_equal( 216 | self._df[target].tail(), result.tail(), check_names=False 217 | ) 218 | 219 | def test_hband_indicator2(self): 220 | target = "CrossUp" 221 | result = bollinger_hband_indicator(**self._params) 222 | pd.testing.assert_series_equal( 223 | self._df[target].tail(), result.tail(), check_names=False 224 | ) 225 | 226 | def test_lband_indicator2(self): 227 | target = "CrossDown" 228 | result = bollinger_lband_indicator(**self._params) 229 | pd.testing.assert_series_equal( 230 | self._df[target].tail(), result.tail(), check_names=False 231 | ) 232 | 233 | 234 | class TestDonchianChannel(unittest.TestCase): 235 | """ 236 | https://www.investopedia.com/terms/d/donchianchannels.asp 237 | https://docs.google.com/spreadsheets/d/17JWWsxSiAb24BLzncUpccc8hg-03QjVWVXmoRCJ2lME/edit#gid=0 238 | """ 239 | 240 | _filename = "test/data/cs-dc.csv" 241 | 242 | @classmethod 243 | def setUpClass(cls): 244 | cls._df = pd.read_csv(cls._filename, sep=",") 245 | cls._params = { 246 | "high": cls._df["high"], 247 | "low": cls._df["low"], 248 | "close": cls._df["close"], 249 | "window": 20, 250 | "offset": 0, 251 | "fillna": False, 252 | } 253 | cls._indicator = DonchianChannel(**cls._params) 254 | 255 | @classmethod 256 | def tearDownClass(cls): 257 | del cls._df 258 | 259 | def test_mavg(self): 260 | target = "middle_band" 261 | result = self._indicator.donchian_channel_mband() 262 | pd.testing.assert_series_equal( 263 | self._df[target].tail(), result.tail(), check_names=False 264 | ) 265 | 266 | def test_hband(self): 267 | target = "upper_band" 268 | result = self._indicator.donchian_channel_hband() 269 | pd.testing.assert_series_equal( 270 | self._df[target].tail(), result.tail(), check_names=False 271 | ) 272 | 273 | def test_lband(self): 274 | target = "lower_band" 275 | result = self._indicator.donchian_channel_lband() 276 | pd.testing.assert_series_equal( 277 | self._df[target].tail(), result.tail(), check_names=False 278 | ) 279 | 280 | def test_wband(self): 281 | target = "dc_band_width" 282 | result = self._indicator.donchian_channel_wband() 283 | pd.testing.assert_series_equal( 284 | self._df[target].tail(), result.tail(), check_names=False 285 | ) 286 | 287 | def test_pband(self): 288 | target = "dc_percentage" 289 | result = self._indicator.donchian_channel_pband() 290 | pd.testing.assert_series_equal( 291 | self._df[target].tail(), result.tail(), check_names=False 292 | ) 293 | 294 | def test_mavg2(self): 295 | target = "middle_band" 296 | result = donchian_channel_mband(**self._params) 297 | pd.testing.assert_series_equal( 298 | self._df[target].tail(), result.tail(), check_names=False 299 | ) 300 | 301 | def test_hband2(self): 302 | target = "upper_band" 303 | result = donchian_channel_hband(**self._params) 304 | pd.testing.assert_series_equal( 305 | self._df[target].tail(), result.tail(), check_names=False 306 | ) 307 | 308 | def test_lband2(self): 309 | target = "lower_band" 310 | result = donchian_channel_lband(**self._params) 311 | pd.testing.assert_series_equal( 312 | self._df[target].tail(), result.tail(), check_names=False 313 | ) 314 | 315 | def test_wband2(self): 316 | target = "dc_band_width" 317 | result = donchian_channel_wband(**self._params) 318 | pd.testing.assert_series_equal( 319 | self._df[target].tail(), result.tail(), check_names=False 320 | ) 321 | 322 | def test_pband2(self): 323 | target = "dc_percentage" 324 | result = donchian_channel_pband(**self._params) 325 | pd.testing.assert_series_equal( 326 | self._df[target].tail(), result.tail(), check_names=False 327 | ) 328 | 329 | 330 | class TestDonchianChannel2(unittest.TestCase): 331 | """ 332 | https://www.investopedia.com/terms/d/donchianchannels.asp 333 | https://docs.google.com/spreadsheets/d/17JWWsxSiAb24BLzncUpccc8hg-03QjVWVXmoRCJ2lME/edit#gid=0 334 | """ 335 | 336 | _filename = "test/data/cs-dc2.csv" 337 | 338 | @classmethod 339 | def setUpClass(cls): 340 | cls._df = pd.read_csv(cls._filename, sep=",") 341 | cls._params = { 342 | "high": cls._df["high"], 343 | "low": cls._df["low"], 344 | "close": cls._df["close"], 345 | "window": 20, 346 | "offset": 1, 347 | "fillna": False, 348 | } 349 | cls._indicator = DonchianChannel(**cls._params) 350 | 351 | @classmethod 352 | def tearDownClass(cls): 353 | del cls._df 354 | 355 | def test_mavg(self): 356 | target = "middle_band" 357 | result = self._indicator.donchian_channel_mband() 358 | pd.testing.assert_series_equal( 359 | self._df[target].tail(), result.tail(), check_names=False 360 | ) 361 | 362 | def test_hband(self): 363 | target = "upper_band" 364 | result = self._indicator.donchian_channel_hband() 365 | pd.testing.assert_series_equal( 366 | self._df[target].tail(), result.tail(), check_names=False 367 | ) 368 | 369 | def test_lband(self): 370 | target = "lower_band" 371 | result = self._indicator.donchian_channel_lband() 372 | pd.testing.assert_series_equal( 373 | self._df[target].tail(), result.tail(), check_names=False 374 | ) 375 | 376 | def test_wband(self): 377 | target = "dc_band_width" 378 | result = self._indicator.donchian_channel_wband() 379 | pd.testing.assert_series_equal( 380 | self._df[target].tail(), result.tail(), check_names=False 381 | ) 382 | 383 | def test_pband(self): 384 | target = "dc_percentage" 385 | result = self._indicator.donchian_channel_pband() 386 | pd.testing.assert_series_equal( 387 | self._df[target].tail(), result.tail(), check_names=False 388 | ) 389 | 390 | def test_mavg2(self): 391 | target = "middle_band" 392 | result = donchian_channel_mband(**self._params) 393 | pd.testing.assert_series_equal( 394 | self._df[target].tail(), result.tail(), check_names=False 395 | ) 396 | 397 | def test_hband2(self): 398 | target = "upper_band" 399 | result = donchian_channel_hband(**self._params) 400 | pd.testing.assert_series_equal( 401 | self._df[target].tail(), result.tail(), check_names=False 402 | ) 403 | 404 | def test_lband2(self): 405 | target = "lower_band" 406 | result = donchian_channel_lband(**self._params) 407 | pd.testing.assert_series_equal( 408 | self._df[target].tail(), result.tail(), check_names=False 409 | ) 410 | 411 | def test_wband2(self): 412 | target = "dc_band_width" 413 | result = donchian_channel_wband(**self._params) 414 | pd.testing.assert_series_equal( 415 | self._df[target].tail(), result.tail(), check_names=False 416 | ) 417 | 418 | def test_pband2(self): 419 | target = "dc_percentage" 420 | result = donchian_channel_pband(**self._params) 421 | pd.testing.assert_series_equal( 422 | self._df[target].tail(), result.tail(), check_names=False 423 | ) 424 | 425 | 426 | class TestKeltnerChannel(unittest.TestCase): 427 | """ 428 | https://school.stockcharts.com/doku.php?id=technical_indicators:keltner_channels 429 | https://docs.google.com/spreadsheets/d/1qT8JbJ7F13bMV9-TcK-oFHL1F5sKPwakQWf6KrvGI3U/edit?usp=sharing 430 | """ 431 | 432 | _filename = "test/data/cs-kc.csv" 433 | 434 | @classmethod 435 | def setUpClass(cls): 436 | cls._df = pd.read_csv(cls._filename, sep=",") 437 | cls._params = { 438 | "high": cls._df["High"], 439 | "low": cls._df["Low"], 440 | "close": cls._df["Close"], 441 | "window": 20, 442 | "window_atr": 10, 443 | "fillna": False, 444 | "original_version": False, 445 | } 446 | cls._indicator = KeltnerChannel(**cls._params) 447 | 448 | @classmethod 449 | def tearDownClass(cls): 450 | del cls._df 451 | 452 | def test_mavg(self): 453 | target = "middle_band" 454 | result = self._indicator.keltner_channel_mband() 455 | pd.testing.assert_series_equal( 456 | self._df[target].tail(), result.tail(), check_names=False 457 | ) 458 | 459 | def test_hband(self): 460 | target = "upper_band" 461 | result = self._indicator.keltner_channel_hband() 462 | pd.testing.assert_series_equal( 463 | self._df[target].tail(), result.tail(), check_names=False 464 | ) 465 | 466 | def test_lband(self): 467 | target = "lower_band" 468 | result = self._indicator.keltner_channel_lband() 469 | pd.testing.assert_series_equal( 470 | self._df[target].tail(), result.tail(), check_names=False 471 | ) 472 | 473 | def test_wband(self): 474 | target = "kc_band_width" 475 | result = self._indicator.keltner_channel_wband() 476 | pd.testing.assert_series_equal( 477 | self._df[target].tail(), result.tail(), check_names=False 478 | ) 479 | 480 | def test_pband(self): 481 | target = "kc_percentage" 482 | result = self._indicator.keltner_channel_pband() 483 | pd.testing.assert_series_equal( 484 | self._df[target].tail(), result.tail(), check_names=False 485 | ) 486 | 487 | def test_hband_indicator(self): 488 | target = "kc_high_indicator" 489 | result = self._indicator.keltner_channel_hband_indicator() 490 | pd.testing.assert_series_equal( 491 | self._df[target].tail(), result.tail(), check_names=False 492 | ) 493 | 494 | def test_lband_indicator(self): 495 | target = "kc_low_indicator" 496 | result = self._indicator.keltner_channel_lband_indicator() 497 | pd.testing.assert_series_equal( 498 | self._df[target].tail(), result.tail(), check_names=False 499 | ) 500 | 501 | def test_mavg2(self): 502 | target = "middle_band" 503 | result = keltner_channel_mband(**self._params) 504 | pd.testing.assert_series_equal( 505 | self._df[target].tail(), result.tail(), check_names=False 506 | ) 507 | 508 | def test_hband2(self): 509 | target = "upper_band" 510 | result = keltner_channel_hband(**self._params) 511 | pd.testing.assert_series_equal( 512 | self._df[target].tail(), result.tail(), check_names=False 513 | ) 514 | 515 | def test_lband2(self): 516 | target = "lower_band" 517 | result = keltner_channel_lband(**self._params) 518 | pd.testing.assert_series_equal( 519 | self._df[target].tail(), result.tail(), check_names=False 520 | ) 521 | 522 | def test_wband2(self): 523 | target = "kc_band_width" 524 | result = keltner_channel_wband(**self._params) 525 | pd.testing.assert_series_equal( 526 | self._df[target].tail(), result.tail(), check_names=False 527 | ) 528 | 529 | def test_pband2(self): 530 | target = "kc_percentage" 531 | result = keltner_channel_pband(**self._params) 532 | pd.testing.assert_series_equal( 533 | self._df[target].tail(), result.tail(), check_names=False 534 | ) 535 | 536 | def test_hband_indicator2(self): 537 | target = "kc_high_indicator" 538 | result = keltner_channel_hband_indicator(**self._params) 539 | pd.testing.assert_series_equal( 540 | self._df[target].tail(), result.tail(), check_names=False 541 | ) 542 | 543 | def test_lband_indicator2(self): 544 | target = "kc_low_indicator" 545 | result = keltner_channel_lband_indicator(**self._params) 546 | pd.testing.assert_series_equal( 547 | self._df[target].tail(), result.tail(), check_names=False 548 | ) 549 | 550 | 551 | class TestUlcerIndex(unittest.TestCase): 552 | """ 553 | https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:ulcer_index 554 | https://docs.google.com/spreadsheets/d/1PpiRxv4Cnjqod9zNTnls4Lfn8lknHFnWk1DmaTZgZC8/edit#gid=0 555 | """ 556 | 557 | _filename = "test/data/cs-ui.csv" 558 | 559 | @classmethod 560 | def setUpClass(cls): 561 | cls._df = pd.read_csv(cls._filename, sep=",") 562 | cls._params = {"close": cls._df["Close"], "window": 14, "fillna": False} 563 | cls._indicator = UlcerIndex(**cls._params) 564 | 565 | @classmethod 566 | def tearDownClass(cls): 567 | del cls._df 568 | 569 | def test_ulcer_index(self): 570 | target = "ulcer_index" 571 | result = self._indicator.ulcer_index() 572 | pd.testing.assert_series_equal( 573 | self._df[target].tail(1), result.tail(1), check_names=False 574 | ) 575 | 576 | def test_ulcer_index2(self): 577 | target = "ulcer_index" 578 | result = ulcer_index(**self._params) 579 | pd.testing.assert_series_equal( 580 | self._df[target].tail(1), result.tail(1), check_names=False 581 | ) 582 | 583 | 584 | if __name__ == "__main__": 585 | unittest.main() 586 | -------------------------------------------------------------------------------- /test/unit/volume.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import pandas as pd 4 | 5 | from ta.volume import ( 6 | AccDistIndexIndicator, 7 | EaseOfMovementIndicator, 8 | ForceIndexIndicator, 9 | MFIIndicator, 10 | OnBalanceVolumeIndicator, 11 | VolumePriceTrendIndicator, 12 | VolumeWeightedAveragePrice, 13 | acc_dist_index, 14 | ease_of_movement, 15 | force_index, 16 | money_flow_index, 17 | on_balance_volume, 18 | sma_ease_of_movement, 19 | volume_price_trend, 20 | volume_weighted_average_price, 21 | ) 22 | 23 | 24 | class TestOnBalanceVolumeIndicator(unittest.TestCase): 25 | """ 26 | https://school.stockcharts.com/doku.php?id=technical_indicators:on_balance_volume_obv 27 | """ 28 | 29 | _filename = "test/data/cs-obv.csv" 30 | 31 | @classmethod 32 | def setUpClass(cls): 33 | cls._df = pd.read_csv(cls._filename, sep=",") 34 | cls._params = { 35 | "close": cls._df["Close"], 36 | "volume": cls._df["Volume"], 37 | "fillna": False, 38 | } 39 | cls._indicator = OnBalanceVolumeIndicator(**cls._params) 40 | 41 | @classmethod 42 | def tearDownClass(cls): 43 | del cls._df 44 | 45 | def test_obv(self): 46 | target = "OBV" 47 | result = on_balance_volume(**self._params) 48 | pd.testing.assert_series_equal( 49 | self._df[target].tail(), result.tail(), check_names=False 50 | ) 51 | 52 | def test_obv2(self): 53 | target = "OBV" 54 | result = self._indicator.on_balance_volume() 55 | pd.testing.assert_series_equal( 56 | self._df[target].tail(), result.tail(), check_names=False 57 | ) 58 | 59 | 60 | class TestForceIndexIndicator(unittest.TestCase): 61 | """ 62 | https://school.stockcharts.com/doku.php?id=technical_indicators:force_index 63 | """ 64 | 65 | _filename = "test/data/cs-fi.csv" 66 | 67 | @classmethod 68 | def setUpClass(cls): 69 | cls._df = pd.read_csv(cls._filename, sep=",") 70 | cls._params = { 71 | "close": cls._df["Close"], 72 | "volume": cls._df["Volume"], 73 | "window": 13, 74 | "fillna": False, 75 | } 76 | cls._indicator = ForceIndexIndicator(**cls._params) 77 | 78 | @classmethod 79 | def tearDownClass(cls): 80 | del cls._df 81 | 82 | def test_fi(self): 83 | target = "FI" 84 | result = force_index(**self._params) 85 | pd.testing.assert_series_equal( 86 | self._df[target].tail(), result.tail(), check_names=False 87 | ) 88 | 89 | def test_fi2(self): 90 | target = "FI" 91 | result = self._indicator.force_index() 92 | pd.testing.assert_series_equal( 93 | self._df[target].tail(), result.tail(), check_names=False 94 | ) 95 | 96 | 97 | class TestEaseOfMovementIndicator(unittest.TestCase): 98 | """ 99 | https://school.stockcharts.com/doku.php?id=technical_indicators:ease_of_movement_emv 100 | """ 101 | 102 | _filename = "test/data/cs-easeofmovement.csv" 103 | 104 | @classmethod 105 | def setUpClass(cls): 106 | cls._df = pd.read_csv(cls._filename, sep=",") 107 | cls._params = { 108 | "high": cls._df["High"], 109 | "low": cls._df["Low"], 110 | "volume": cls._df["Volume"], 111 | "window": 14, 112 | "fillna": False, 113 | } 114 | cls._indicator = EaseOfMovementIndicator(**cls._params) 115 | 116 | @classmethod 117 | def tearDownClass(cls): 118 | del cls._df 119 | 120 | def test_ease_of_movement(self): 121 | target = "EMV" 122 | result = ease_of_movement(**self._params) 123 | pd.testing.assert_series_equal( 124 | self._df[target].tail(), result.tail(), check_names=False 125 | ) 126 | 127 | def test_ease_of_movement2(self): 128 | target = "EMV" 129 | result = self._indicator.ease_of_movement() 130 | pd.testing.assert_series_equal( 131 | self._df[target].tail(), result.tail(), check_names=False 132 | ) 133 | 134 | def test_sma_ease_of_movement(self): 135 | target = "SMA_EMV" 136 | result = sma_ease_of_movement(**self._params) 137 | pd.testing.assert_series_equal( 138 | self._df[target].tail(), result.tail(), check_names=False 139 | ) 140 | 141 | def test_sma_ease_of_movement2(self): 142 | target = "SMA_EMV" 143 | result = self._indicator.sma_ease_of_movement() 144 | pd.testing.assert_series_equal( 145 | self._df[target].tail(), result.tail(), check_names=False 146 | ) 147 | 148 | 149 | class TestAccDistIndexIndicator(unittest.TestCase): 150 | """ 151 | https://school.stockcharts.com/doku.php?id=technical_indicators:accumulation_distribution_line 152 | """ 153 | 154 | _filename = "test/data/cs-accum.csv" 155 | 156 | @classmethod 157 | def setUpClass(cls): 158 | cls._df = pd.read_csv(cls._filename, sep=",") 159 | cls._params = { 160 | "high": cls._df["High"], 161 | "low": cls._df["Low"], 162 | "close": cls._df["Close"], 163 | "volume": cls._df["Volume"], 164 | "fillna": False, 165 | } 166 | cls._indicator = AccDistIndexIndicator(**cls._params) 167 | 168 | @classmethod 169 | def tearDownClass(cls): 170 | del cls._df 171 | 172 | def test_adl(self): 173 | target = "ADLine" 174 | result = acc_dist_index(**self._params) 175 | pd.testing.assert_series_equal( 176 | self._df[target].tail(), result.tail(), check_names=False 177 | ) 178 | 179 | def test_adl2(self): 180 | target = "ADLine" 181 | result = self._indicator.acc_dist_index() 182 | pd.testing.assert_series_equal( 183 | self._df[target].tail(), result.tail(), check_names=False 184 | ) 185 | 186 | 187 | class TestMFIIndicator(unittest.TestCase): 188 | """ 189 | https://school.stockcharts.com/doku.php?id=technical_indicators:money_flow_index_mfi 190 | """ 191 | 192 | _filename = "test/data/cs-mfi.csv" 193 | 194 | @classmethod 195 | def setUpClass(cls): 196 | cls._df = pd.read_csv(cls._filename, sep=",") 197 | cls._params = { 198 | "high": cls._df["High"], 199 | "low": cls._df["Low"], 200 | "close": cls._df["Close"], 201 | "volume": cls._df["Volume"], 202 | "window": 14, 203 | "fillna": False, 204 | } 205 | cls._indicator = MFIIndicator(**cls._params) 206 | 207 | @classmethod 208 | def tearDownClass(cls): 209 | del cls._df 210 | 211 | def test_mfi(self): 212 | target = "MFI" 213 | result = self._indicator.money_flow_index() 214 | pd.testing.assert_series_equal( 215 | self._df[target].tail(), result.tail(), check_names=False 216 | ) 217 | 218 | def test_mfi2(self): 219 | target = "MFI" 220 | result = money_flow_index(**self._params) 221 | pd.testing.assert_series_equal( 222 | self._df[target].tail(), result.tail(), check_names=False 223 | ) 224 | 225 | 226 | class TestVolumeWeightedAveragePrice(unittest.TestCase): 227 | """ 228 | https://school.stockcharts.com/doku.php?id=technical_indicators:vwap_intraday 229 | """ 230 | 231 | _filename = "test/data/cs-vwap.csv" 232 | 233 | @classmethod 234 | def setUpClass(cls): 235 | cls._df = pd.read_csv(cls._filename, sep=",") 236 | cls._params = { 237 | "high": cls._df["High"], 238 | "low": cls._df["Low"], 239 | "close": cls._df["Close"], 240 | "volume": cls._df["Volume"], 241 | "fillna": False, 242 | } 243 | cls._indicator = VolumeWeightedAveragePrice(**cls._params) 244 | 245 | @classmethod 246 | def tearDownClass(cls): 247 | del cls._df 248 | 249 | def test_vwap(self): 250 | target = "vwap" 251 | result = volume_weighted_average_price(**self._params) 252 | pd.testing.assert_series_equal( 253 | self._df[target].tail(), result.tail(), check_names=False 254 | ) 255 | 256 | def test_vwap2(self): 257 | target = "vwap" 258 | result = self._indicator.volume_weighted_average_price() 259 | pd.testing.assert_series_equal( 260 | self._df[target].tail(), result.tail(), check_names=False 261 | ) 262 | 263 | 264 | class TestVolumePriceTrendIndicator(unittest.TestCase): 265 | """ 266 | Original VPT: https://en.wikipedia.org/wiki/Volume%E2%80%93price_trend 267 | One more: https://www.barchart.com/education/technical-indicators/price_volume_trend 268 | According to TradingView: PVT = [((CurrentClose - PreviousClose) / PreviousClose) x Volume] + PreviousPVT 269 | 270 | Smoothed version (by Alex Orekhov (everget)): https://ru.tradingview.com/script/3Ah2ALck-Price-Volume-Trend/ 271 | His script is using `pvt` (TradingView built-in variable) as described in TradingView documentation of PVT and 272 | just smoothing it with ema or sma by choice. 273 | You can find smoothing here (13 row of script): 274 | `signal = signalType == "EMA" ? ema(pvt, signalLength) : sma(pvt, signalLength)` 275 | """ 276 | 277 | _filename = "test/data/cs-vpt.csv" 278 | 279 | @classmethod 280 | def setUpClass(cls): 281 | cls._df = pd.read_csv(cls._filename, sep=",") 282 | 283 | # default VPT params, unsmoothed 284 | cls._params = { 285 | "close": cls._df['Close'], 286 | "volume": cls._df['Volume'], 287 | "fillna": False, 288 | "smoothing_factor": None, 289 | "dropnans": False, 290 | } 291 | 292 | # smoothed VPT params 293 | cls._params_smoothed = { 294 | "close": cls._df['Close'], 295 | "volume": cls._df['Volume'], 296 | "fillna": False, 297 | "smoothing_factor": 14, 298 | "dropnans": False, 299 | } 300 | cls._indicator_default = VolumePriceTrendIndicator(**cls._params) 301 | cls._indicator_smoothed = VolumePriceTrendIndicator(**cls._params_smoothed) 302 | 303 | @classmethod 304 | def tearDownClass(cls): 305 | del cls._df 306 | 307 | def test_vpt1(self): 308 | target = "unsmoothed vpt" 309 | result = volume_price_trend(**self._params) 310 | pd.testing.assert_series_equal( 311 | self._df[target].tail(), result.tail(), check_names=False 312 | ) 313 | 314 | def test_vpt2(self): 315 | target = "unsmoothed vpt" 316 | result = self._indicator_default.volume_price_trend() 317 | pd.testing.assert_series_equal( 318 | self._df[target].tail(), result.tail(), check_names=False 319 | ) 320 | 321 | def test_vpt3(self): 322 | target = "14-smoothed vpt" 323 | result = volume_price_trend(**self._params_smoothed) 324 | pd.testing.assert_series_equal( 325 | self._df[target].tail(), result.tail(), check_names=False 326 | ) 327 | 328 | def test_vpt4(self): 329 | target = "14-smoothed vpt" 330 | result = self._indicator_smoothed.volume_price_trend() 331 | pd.testing.assert_series_equal( 332 | self._df[target].tail(), result.tail(), check_names=False 333 | ) 334 | 335 | 336 | if __name__ == "__main__": 337 | unittest.main() 338 | --------------------------------------------------------------------------------