Moving Average
JavaScript
Switch branches/tags
Latest commit a3083ee Feb 15, 2016 @pgte v0.1.1
Permalink
Failed to load latest commit information.
tests
.gitignore
.travis.yml travis node versions Feb 8, 2016
README.md
index.js Merge branch 'johnmeisner-patch-2' of git://github.com/johnmeisner/mo… Feb 15, 2016
package.json v0.1.1 Feb 15, 2016

README.md

moving-average

Build Status

Exponential Moving Average for Node.js.

Also suports Moving Variance.

Install

$ npm install moving-average

Use

var timeInterval = 5 * 60 * 1000; // 5 minutes

var MA = require('moving-average');
var ma = MA(timeInterval);

setInterval(function() {
  ma.push(Date.now(), Math.random() * 500);
  console.log('moving average now is', ma.movingAverage());
  console.log('moving variance now is', ma.variance());
});

License

MIT