You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iotcat
74338fbb93
|
5 years ago | |
---|---|---|
.. | ||
tests | 5 years ago | |
.npmignore | 5 years ago | |
.travis.yml | 5 years ago | |
README.md | 5 years ago | |
index.js | 5 years ago | |
package.json | 5 years ago |
README.md
moving-average
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