Files
wickra/bindings/wasm
kingchenc 1295b63e1f Wire release pipeline to crates.io, PyPI, and npm
On every v* tag push the release workflow now publishes the project to
all three public registries in parallel:

- crates.io: wickra-core then wickra-data then wickra, with a 45-second
  sleep between each so the registry index can refresh before the next
  publish step asserts the previous version is available.

- PyPI: maturin-action builds wheels for Linux x86_64 + aarch64, macOS
  x86_64 + aarch64, and Windows x64, plus an sdist; all artefacts upload
  to PyPI via MATURIN_PYPI_TOKEN.

- npm: napi-rs builds a native binary per platform (linux-x64-gnu,
  darwin-x64, darwin-arm64, win32-x64-msvc), publishes each as its own
  platform package, then publishes the main `wickra` meta-package
  that resolves to the right platform at install time.

- WASM: wasm-pack builds the bundler-target package and publishes it as
  `wickra-wasm` on npm, with the auto-generated package.json enriched
  with the author/repo/license metadata.

Package metadata was unified so all targets point at kingchenc/wickra
on GitHub; the Node binding is now plain `wickra` (the @wickra/ scope
was unnecessary because the bare name was free). README install table
updated to match.
2026-05-21 20:35:18 +02:00
..

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 web for native ES modules in browsers
  • --target bundler for webpack/Vite/Rollup
  • --target nodejs for 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.