You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rescale synthetic prices to cents and throttle editorial cells to 4 Hz (#26)
Two related polish changes from observing the live demo at
https://meridian-orderbook.pages.dev.
First, the synthetic generator was emitting prices as integer dollars
in a narrow [95, 105] band, so the minimum spread was always $1 and
the "Spread 2.00" cell read as "200.0 bp wide" on the dashboard.
That is technically a $2 spread on a $100 stock, which is enormous
for a liquid name and looked broken. Rescale the price model: anchor
at 10000 cents ($100.00), reference walks +/-2 cents per event with
bounded mean reversion to anchor, limit orders cluster within 5
cents of the reference, per-order quantity range [5, 40]. Spreads
now land at 1 to 5 bp ("tight"), the dashboard reads like a real
instrument. Local verification at seed 42 over 20s steady state:
top size median 761 in [451, 1700], spread median 2 cents in [1, 5].
formatPrice and formatSpread in the frontend divide by 100 before
rendering so the cells display "$100.01" instead of "10001".
Second, the editorial cells (Hero Last, Spread, Top size; Ladder L1
row; DepthChart geometry; PerfPanel book-state cells) were updating
on every WebSocket delta at 30 Hz. Real-time financial dashboards
(Bloomberg, Refinitiv, Eikon) refresh headline numerics at 2 to 5 Hz
because faster reads as flicker rather than as throughput. Add a
displayedTop slice to the Zustand store that mirrors top at a
throttled cadence; a new useDisplayThrottle hook runs the mirror at
4 Hz (250 ms). Selectors reading displayedTop only re-render when
the reference changes, so the components that need live data (the
PerfPanel wire counters, the perf histogram) continue to read top
directly. A fresh snapshot eagerly populates displayedTop so the
dashboard leaves the connecting skeleton immediately.
Tests:
* `tests/unit/test_ws_origin.cpp` and the rest of the C++ suite stay
at 182/182.
* Three new Vitest cases cover the throttle: snapshot eagerly
populates displayedTop, deltas update top but leave displayedTop
alone until flushDisplayed is called, flushDisplayed is a no-op
when top has not advanced. Total Vitest count: 18/18.
0 commit comments