Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaelzhang/bollinger-bands
Utilities to draw and calculate bollinger bands
https://github.com/kaelzhang/bollinger-bands
Last synced: 4 days ago
JSON representation
Utilities to draw and calculate bollinger bands
- Host: GitHub
- URL: https://github.com/kaelzhang/bollinger-bands
- Owner: kaelzhang
- License: other
- Created: 2015-07-14T09:27:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-03-24T03:10:24.000Z (over 3 years ago)
- Last Synced: 2024-04-15T12:32:56.427Z (7 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 19
- Watchers: 4
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/kaelzhang/bollinger-bands.svg?branch=master)](https://travis-ci.org/kaelzhang/bollinger-bands)
[![Coverage](https://codecov.io/gh/kaelzhang/bollinger-bands/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/bollinger-bands)# MAINTENANCE WARNING
This module is lack of maintenance.
If you are familiar with python programming maybe you could check [**stock-pandas**](https://github.com/kaelzhang/stock-pandas) which provides powerful statistic indicators support, and is backed by [`numpy`](https://numpy.org/) and [`pandas`](https://pandas.pydata.org/).
The performance of [**stock-pandas**](https://github.com/kaelzhang/stock-pandas) is many times higher than JavaScript libraries, and can be directly used by machine learning programs.
****
# bollinger-bands
Fintach math utility to calculate [bollinger bands](https://en.wikipedia.org/wiki/Bollinger_Bands).
## Install
```sh
$ npm install bollinger-bands
```## Usage
```js
import boll from 'bollinger-bands'boll([1, 2, 4, 8], 2, 2)
// {
// upper: [, 2.5, 5, 10],
// mid : [, 1.5, 3, 6],
// lower: [, 0.5, 1, 2]
// }
```## boll(datum, size, times, options)
- **datum** `Array.` the collection of data
- **size** `Number=20` the period size, defaults to `20`
- **times** `Number=2` the times of standard deviation between the upper band and the moving average.
- **options** `Object=` optional options
- ma `Array.=` the moving averages of the provided `datum` and period `size`. This option is used to prevent duplicate calculation of moving average.
- sd `Array.=` the standard average of the provided `datum` and period `size`Returns `Array.` the array of the `Band` object.
### struct `Band`
- **upper** `Number` the value of the upper band
- **mid** `Number` the value middle band (moving average)
- **lower** `Number` the value of the lower band## Related Fintech Modules
- [moving-averages](https://www.npmjs.com/package/moving-averages): The complete collection of utility methods for [Moving average](https://en.wikipedia.org/wiki/Moving_average).
- [s-deviation](https://www.npmjs.com/package/s-deviation): Math utility to calculate standard deviations.## License
MIT