efcd6216c1
The rolling-window VWAP indicator (`wickra_core::RollingVwap`) was only available in the Rust crate, even though the README's Volume-family table already advertised "VWAP (cumulative + rolling)" as a cross- language feature. Users on Python, Node or in the browser had to fall back to the cumulative `VWAP` or re-implement the rolling variant themselves. This commit closes the gap end-to-end: - Python: `wickra.RollingVWAP(period)` — same constructor / `update` / `batch` / `reset` / `is_ready` / `warmup_period` surface as `VWAP`, plus a `period` property and a typed `__repr__`. The `__init__.py` re-exports it and `__all__` lists it; the `.pyi` stub matches. - Node: `RollingVWAP(period)` — napi class with the same lifecycle, exported from `index.js` and declared in `index.d.ts`. - WASM: `RollingVWAP(period)` — wasm-bindgen class with the same `Float64Array` I/O as `VWAP`. Tests added: - Python: `test_rolling_vwap_streaming_matches_batch` — exercises `update == batch` plus the full lifecycle on the shared OHLC fixture. - Node: `RollingVWAP` row in the `candleScalar` parity table — covered by the generic streaming-vs-batch + lifecycle harness. - WASM: dedicated `wasm-bindgen-test` mirrors the Python test. The wiki page `Indicator-Vwap.md` drops the "Rust-only" caveat and gains Python / Node / WASM examples.
wickra-wasm
WebAssembly bindings for the Wickra streaming-first technical indicators library.
Build
You need wasm-pack and the
wasm32-unknown-unknown Rust target:
rustup target add wasm32-unknown-unknown
cargo install wasm-pack
Then from the repository root:
wasm-pack build bindings/wasm --target web --release --features panic-hook
The compiled package lands in bindings/wasm/pkg/. Targets:
--target webfor native ES modules in browsers--target bundlerfor webpack/Vite/Rollup--target nodejsfor Node.js
Example
import init, { SMA, RSI, MACD, version } from "./pkg/wickra_wasm.js";
await init();
console.log("wickra:", version());
// Streaming
const rsi = new RSI(14);
for (const price of livePrices) {
const v = rsi.update(price);
if (v !== undefined && v > 70) console.log("overbought");
}
// Batch (returns a Float64Array; NaN for warmup positions)
const sma = new SMA(20).batch(new Float64Array(historicalPrices));
An interactive demo lives in examples/wasm/index.html
(top-level alongside the other language examples). After building the package
with wasm-pack build, serve the repository root and open
examples/wasm/index.html in a browser.