npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ta-math

v1.0.49

Published

Technical analysis library in javascript. Calculates indicators and overlays from ohlcv data

Downloads

618

Readme

Technical analysis math bundlephobia Codecov Total alerts

Library for calculating technical indicators and overlays. You can choose format of price data from provider and library will return result. It distributed with Typescript, ES6 and ES5.

btc-with-bollinger-bands

Check example with plotly library, ccxt data provider and BTC prices from Binance exchange.

Technical Overlays

| Function | Technical Overlay | Tested | Developed by | Year | |:----------|:--------------------------------------|:--------:|:------------------:|:----:| | bb | Bollinger Band | ✔️️ | John Bollinger | 1980s| | dema | Double Exponential Moving Average | ️ ✔️️ | Patrick Mulloy | 1994 | | ema | Exponential Moving Average | ✔️️ | | | | ebb | Exponential Bollinger Band | ✔️️ | Based on Welford's| | | keltner | Keltner Channels | ✔️️ | Chester Keltner | 1960 | | psar | Parabolic SAR | :suspect: | Welles Wilder | 1978 | | sma | Simple Moving Average | ✔️️ | | | | tema | Triple Exponential Moving Average | ️ ✔️️ | Patrick Mulloy | 1994 | | vbp | Volume by Price | ✔️️ | | | | vwap | Volume Weighted Average Price | ✔️️ | James Elkins | 1984 | | zigzag | ZigZag Indicator | ✔️️ | Arthur Merrill | 1977 |

Technical Indicators

| Function | Technical Indicator | Tested | Developed by | Year | |:----------|:--------------------------------------|:-------:|:---------------------------------:|:----:| | adl | Accumulation / Distribution line | ✔️ | Marc Chaikin | 1970s| | atr | Average True Range | ✔️ | Welles Wilder | 1978 | | adx | Average Directional Index | ✔️ | Welles Wilder | 1978 | | bbp | Bollinger Bands Percent Bandwidth %B | 👌 | | | | cci | Commodity Channel Index | ✔️ | Donald Lambert | 1980 | | cho | Chaikin Oscillator | 👌 | Marc Chaikin | | | expdev | Exponential Weighted Deviation | ✔️ | | | | fi | Force Index | ✔️ | | | | kst | Know Sure Thing | ✔️ | | | | macd | Moving Average Convergence/Divergence | ✔️ | Gerald Appel | 1979 | | madev | Mean Absolute Deviation | ✔️ | | | | mfi | Money Flow Index (volume-weighted RSI)| ✔️ | Gene Quong and Avrum Soudack | 1989 | | obv | On Balance Volume | ✔️ | Joseph Granville | 1963 | | roc | Rate-of-Change | ✔️ | | | | rsi | Relative Strength Index | ✔️ | Welles Wilder | 1978 | | stdev | Standard Deviation | ✔️️ | | | | stoch | Stochastic Oscillator (Slow/Fast/Full)| ✔️ | George Lane | 1950s| | stochRsi | Combines Stochastics with the RSI | ✔️ | Welles Wilder | 1994 | | vi | Vortex Indicator | ✔️ | Etienne Botes and Douglas Siepman | 2010 | | williams | Williams %R | ✔️ | | |

Error methods

| Function | Error methods | Tested | |:----------|:--------------------------------------|:-------:| | mae | Mean Absolute Error | ✔️ | | mape | Mean Absulute Percentage Error | ✔️ | | nrmse | Normalized Root-Mean-Square Error | ✔️ | | rmse | Root-Mean-Square Error | ✔️ |

Price transformations

| Function | Price transformation | Tested | |:-------------|:-----------------------------------|:-------:| | trueRange | True Range | ✔️ | | typicalPrice | Typical Price | ✔️ |

Statistical methods

| Function | Statistical methods | Tested | |:----------|:--------------------------------------|:-------:| | cov | Covariation | ✔️ | | cor | Correlation | ✔️ | | mean | Mean (Average) | ✔️ | | sd | Standard deviation | ✔️ |

Correlation matrix

correlation-matrix

Usage

  const ohlcv = [[t,o,h,l,c,v], [t2,o2,h2,l2,c2,v2],  ...  ,[tN,oN,hN,lN,cN,vN]];
  const ta = new TA(ohlcv, TA.exchangeFormat);
  const emaShort = ta.ema(10);
  const emaLong = ta.ema(21);
  const bband = ta.bb(15, 2);
  const bbUpper = bband.upper;
  const bbLower = bband.lower;
  const smaOpenPrice = TA.sma(ta.$open);

Installation

Install npm package npm i ta-math or add ta-math.js script file on web page.

2do list

  • [X] basic indicators and overlays
  • [X] unit tests
  • [X] es5 with babel
  • [X] coverage
  • [X] good looking example
  • [X] migrate to typescript
  • [ ] fix PSAR

Contributing

Feel free to contribute. Here reference how to implement new indicators. There are test samples in the .xls files, also you can generate testing data with 'generator.py' file. To convert columns into rows in .xls you can use this tool.