@havklo/kraken-wasm
v0.1.1
Published
WASM bindings for Kraken orderbook engine
Readme
@havklo/kraken-wasm
WebAssembly orderbook engine for Kraken. Run the same high-performance orderbook logic used in HFT backends directly in the browser.
Install
npm install @havklo/kraken-wasmUsage
import init, { WasmOrderbook } from '@havklo/kraken-wasm';
await init();
const book = new WasmOrderbook("BTC/USD", 10);
// Apply snapshot from Kraken WebSocket
book.apply_snapshot(snapshotJson);
// Apply delta updates
book.apply_update(updateJson);
// Query orderbook
console.log("Spread:", book.spread());
console.log("Mid price:", book.mid_price());
console.log("Best bid:", book.best_bid());
console.log("Best ask:", book.best_ask());Features
- Near-native performance — Same Rust engine compiled to WASM
- Sub-microsecond operations — 3.5ns spread calculation
- CRC32 validation — Checksum verification on every update
- Zero dependencies — Pure WASM, no runtime bloat
- Financial precision — Decimal math, no floating point errors
Live Demos
See this package in action:
- https://havsyn.vercel.app — Real-time orderbook visualizer
- https://havdepth.vercel.app — Cumulative depth charts
- https://havflow.vercel.app — Order flow imbalance
- https://havnet.vercel.app — Multi-symbol dashboard
Documentation & Examples
- Full Documentation: https://miny.mintlify.app
- Example Integrations: https://github.com/hitakshiA/Havklo_sdk
Part of Havklo
This is the WASM build of kraken-book from the Havklo SDK.
For server-side Rust usage, see kraken-sdk on crates.io.
License
MIT
