d42a0d7ad5
Two unrelated failures in the post-release CI run: - Python jobs: `maturin develop` requires an activated virtualenv on CI runners that don't have a system Python set up that way. Switch to `maturin build --release --out dist` followed by `pip install --find-links dist`, which is venv-agnostic and OS-portable. - WASM job: the wasm-opt bundled with wasm-pack is older than the WASM features rustc 1.92 enables by default. The fix is to opt every feature in explicitly via the package metadata — reference-types, multivalue, bulk-memory, sign-ext, mutable-globals, nontrapping-float-to-int — so wasm-opt accepts the input. Same code as before; only the build steps and the wasm-opt config changed.
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 bindings/wasm/examples/index.html. After building
the package serve the bindings/wasm/ directory and open examples/index.html.