Skip to content
zhou.
← Forum

Book Release Note v0.3.0 2026-08-18

zhouzhouzhouzhouNowQuant Book (NQBook)18 Aug 2026

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/kraken in util. The book handles the full action set the feed uses — modify keeps queue priority while the price is unchanged, clear drops 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::metrics record on its own ZMQ PUB socket, conflate set, 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 from util so 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.yml runs the service in the dev container with the metrics port published, replacing the flag-by-flag docker run.
  • NQBOOK_METRICS_ENDPOINT and a third positional argument configure the metrics socket; it defaults to tcp://0.0.0.0:5556.
  • nlib bumped to d248297: the split event_ns / recv_ns times, the fixed-point qty_scale, the modify and clear actions, nlib::metrics, and map::capacity() for the memory gauge.

Comments

Sign in to join the discussion.

No comments yet. Be the first.