Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@kszongic/wma-cli

npm version license

Weighted Moving Average (WMA) calculator for the command line. Zero dependencies.

Recent values receive linearly increasing weights — useful for financial data, time series smoothing, and signal processing.

Install

npm i -g @kszongic/wma-cli

Usage

# From arguments
wma 10 20 30 40 50 --window 3

# From stdin
echo "10 20 30 40 50" | wma -w 3

# Pipe from seq
seq 10 | wma -w 4

# JSON output
wma 1 2 3 4 5 -w 3 --json

Options

Flag Description
-w N, --window N Window size (default: all input)
--json Output as JSON array
-h, --help Show help

How WMA Works

For window size w, each value in the window gets weight 1, 2, ..., w (most recent = highest weight):

WMA = (w₁·1 + w₂·2 + ... + wₙ·n) / (1 + 2 + ... + n)

Example

$ echo "10 20 30 40 50" | wma -w 3
10
16.666667
23.333333
33.333333
43.333333

License

MIT © 2026 kszongic

Releases

Packages

Contributors

Languages