{"id":18556338,"url":"https://github.com/rsocket/ewma","last_synced_at":"2025-04-10T00:31:05.887Z","repository":{"id":57231545,"uuid":"102155574","full_name":"rsocket/ewma","owner":"rsocket","description":"Exponentially Weighted Moving Average","archived":false,"fork":false,"pushed_at":"2017-09-08T21:06:23.000Z","size":111,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-28T15:39:25.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rsocket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-01T21:49:43.000Z","updated_at":"2022-09-17T04:25:39.000Z","dependencies_parsed_at":"2022-09-04T17:31:41.953Z","dependency_job_id":null,"html_url":"https://github.com/rsocket/ewma","commit_stats":null,"previous_names":["reactivesocket/ewma"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsocket%2Fewma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsocket%2Fewma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsocket%2Fewma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsocket%2Fewma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rsocket","download_url":"https://codeload.github.com/rsocket/ewma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223418566,"owners_count":17142165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T21:29:57.420Z","updated_at":"2024-11-06T21:29:57.929Z","avatar_url":"https://github.com/rsocket.png","language":"JavaScript","readme":"[![NPM Version](https://img.shields.io/npm/v/ewma.svg)](https://npmjs.org/package/ewma)\n[![Build Status](https://travis-ci.org/ReactiveSocket/ewma.svg?branch=master)](https://travis-ci.org/ReactiveSocket/ewma)\n\n# EWMA\n\nAn exponential weighted moving average for Node.js and the browser!\n\n```bash\nnpm install -g ewma\n```\n\n## Usage\n\nCompute the exponential weighted moving average of a series of values.  The\ntime at which you insert the value into `Ewma` is used to compute a weight\n(recent points are weighted higher).  The parameter for defining the\nconvergence speed (like most decay process) is the half-life.\n\ne.g. with a half-life of 10 unit, if you insert 100 at t=0 and 200 at t=10 the\newma will be equal to (200 - 100)/2 = 150 (half of the distance between the new\nand the old value).\n\n### `var ewma = new EWMA(halfLifeMs, initialValue, clock)`\n\n* `halfLifeMs` - `{Number}` parameter representing the speed of convergence\n* `initialValue` - `{Number}` initial value\n* `clock` - Optional `{Number}` clock object used to read time, must support\n            `Date.now()` style method. Defaults to `Date`.\n\nreturns an object computing the ewma average\n\n### `ewma.insert(x)`\n\n* `x` - The next value, `ewma` will automatically compute the EWMA based on the\n        clock difference between this value and the last time `insert` was\n        called\n\n### `ewma.reset(x)`\n\n* `x` - Set the EWMA to exactly `x`.\n\n### `ewma.value()`\n\nReturns the current EWMA value.\n\n## Examples\n\nThese are generated using a 500ms interval with a half life indicated in the\nkey. For the source code, or to reproduce yourself, check the\n[Example](./example) directory.\n\n![](./example/abs.png)\n![](./example/sin.png)\n![](./example/sawtooth.png)\n\n## Contributions\nContributions welcome, please ensure `make` runs clean.\n\n## License\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsocket%2Fewma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsocket%2Fewma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsocket%2Fewma/lists"}