Expand description
DAG-activations replay for any trading_data graph: one computation structure, multiple
interpretations. Prod evals via step; here the same tick chain runs under a recording
trading_data_dag::Observer, and the browser replays it tick-by-tick — layers lighting up,
values flowing — next to a candle chart.
A library, not a runner. The app owns the graph, the feed and the runtime; it attaches a
Recorder, hands it to its own tick_obs, and drives Viz::serve_on on a port of its
choosing. Every handler reads whatever has been recorded so far, so the server can run
alongside the recording — Viz::bind is separate precisely so the URL answers before the
work begins:
let (viz, mut rec) = Viz::new(Some(<Bar1m as Cell>::NAME), 100_000, 60_000, Backpressure::Block);
let server = viz.clone().serve_on(Viz::bind(port).await);
tokio::join!(server, async {
let out = graph.tick_obs(ts_ns, batches, &mut rec.at(ts_ns));
rec.seal(); // a finite recording says so; a live feed just drops the recorder
});The recording runs on its own thread: the graph’s leg of it is two renderings into a recycled
buffer and one channel push. Backpressure is what a full handoff means — a replay waits for
the tape, a live feed does not.
It owns no front-end either: the browser half is the sibling exec_viz_web bin, and the app
points EXEC_VIZ_WEB_DIR at a built bundle of it.
Modules§
- api_
types - Wire shapes shared by the axum server (serializes) and the Dioxus web client (deserializes).
#[cfg]-neutral — both features compile this module. The fat/api/daychart payload is deliberately absent from the client side: the web half holds it as an opaque JSON string and hands it straight to the chart shim. - record
- Exec-time recording surface: the
runs/{run_id}/layout + row schemas that scam_pump_liqs and zero_fee_arb each hand-roll today, standardized here. Row shapes are modeled onscam_pump_liqs/viz/src/read.rs(OrderEventRow,DrawingRow), which is the proven read-side contract; the order/fill/drawing lanes are still schema-only.
Structs§
- Rec
- One opened tick’s observer. Everything it writes goes into the recorder’s recycled buffers; the tick crosses to the tape thread when this drops.
- Recorder
- The write side, and the only one: the graph thread’s whole share of the recording. Not
Clone— it owns the handoff to the tape thread and the buffers being recycled across it. - Tape
- The recording’s owner: one per
Tape::new, and deliberately notClone. There is one tape, one end of it, and saving spends it — which is what lets the join handle be a plain field here instead of a one-shot slot every reader shares mutable access to. Readers areVizs taken off it, and aVizcan neither end the recording nor write it down. - Viz
- A read side, shared: what the server scrubs and what every replay op goes through. Cloning shares
the tape. It cannot end the recording or save it — that is
Tape’s, and there is one of those.
Enums§
- Backpressure
- What a full handoff queue means for the tick being recorded.
Functions§
- web_dir
- Root of a built
exec_viz_webbundle. The app supplies it — this crate ships no front-end, and guessing at a path inside its own checkout is how a stale bundle gets served silently.Nonerather than a panic so an app that records with a UI when there is one, and without when there is not, can ask instead of reading this crate’s env var behind its back.