v0.3.0 — 2026-08-18
nqbook took a real exchange feed and grew an instrument panel: a monitoring
thread, a metrics socket, and a dashboard reading it live.
- The feed is Kraken's spot level3, normalized by
md/krakenin util. The book handles the full action set the feed uses —modifykeeps queue priority while the price is unchanged,cleardrops an instrument's resting orders ahead of a snapshot replay — and prices and quantities are fixed point at nlib's scales. - A metrics thread, off the hot path. The stages write single-writer,
cache-line-aligned counters (a relaxed load plus store, ~1 ns); the monitor
samples them every 100 ms and publishes each sample as a raw 120-byte
nlib::metricsrecord on its own ZMQ PUB socket,conflateset, so a subscriber always reads live state rather than a backlog. Monitoring never reads pipeline data and never takes a lock. - Apply latency is sampled, 1 in 1024 applies, as cumulative nanoseconds plus a count — the ratio is the mean per timed apply, at no cost to the untimed ones.
ui/, the dashboard, moved here fromutilso the service and its instrument panel version together. A Next.js route holds one conflated ZMQ SUB per browser client and relays samples over Server-Sent Events; the page keeps a rolling minute and turns counters into per-second rates over a sliding 1 s window of arrival times, tiled by stage. Runs on the host with Node, on port 3000.compose.ymlruns the service in thedevcontainer with the metrics port published, replacing the flag-by-flagdocker run.NQBOOK_METRICS_ENDPOINTand a third positional argument configure the metrics socket; it defaults totcp://0.0.0.0:5556.- nlib bumped to
d248297: the splitevent_ns/recv_nstimes, the fixed-pointqty_scale, themodifyandclearactions,nlib::metrics, andmap::capacity()for the memory gauge.
Comments
Sign in to join the discussion.
No comments yet. Be the first.