WASM (browser, bundler, Node)
npm install wickra-wasmThe wickra-wasm bundle is the same Rust kernel compiled to WebAssembly via wasm-bindgen. It runs in the browser (any modern one), in bundlers (Vite / webpack / esbuild), and in Node 18+.
- Latest:
wickra-wasm 0.4.5 - Bundle size: ~80 KB gzipped (JS loader +
.wasm) - Try it live: Demo page
Initialise the module once
import init, { RSI, EMA, MACD, BollingerBands, version } from 'wickra-wasm'
await init() // fetches the .wasm binary
console.log('wickra-wasm v' + version())The default export is an async init() function. In Vite and other modern bundlers it resolves the WASM URL for you; in a plain <script type="module"> setup you can pass an explicit URL to init(url).
Streaming RSI in the browser
const rsi = new RSI(14)
for (const price of liveFeed) {
const v = rsi.update(price) // null during warmup
if (v != null && v > 70) console.log('overbought', v)
}Multi-output indicators
const macd = new MACD(12, 26, 9)
const out = macd.update(price)
// → { macd, signal, histogram } or null
const bb = new BollingerBands(20, 2.0)
const band = bb.update(price)
// → { upper, middle, lower, stddev } or nullBatch (Float64Array)
Every indicator class exposes batch(prices) returning a typed array. For multi-output indicators it is a flat array — e.g. MACD returns [macd0, sig0, hist0, macd1, sig1, hist1, ...] of length 3 * n.
const macd = new MACD(12, 26, 9)
const flat = macd.batch(prices)
// access column i with flat[3 * tick + i]Building from source
If you want to ship a custom build (e.g. with --features panic-hook enabled, or scoped to fewer indicators):
wasm-pack build bindings/wasm --target web --release --features panic-hookThe resulting pkg/ directory is publishable to npm or vendored into your app directly.