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
{{ message }}
Repository navigation
Engineering challenge 01: separate estimated pressure from observed liquidation events #5
There are two different sources behind the liquidation-pressure presentation:
estimatePressureMap(state) in src/logic/zaiEngine.jsassignsmarket.liqLong and market.liqShort from open interest and heuristic adjustments.
connectLiveStreams(state, onTick) in src/services/market.js listens to Binance Futures @forceOrder and adds event notionals to those same fields.
Because scheduled market syncs also invoke estimatePressureMap, a user could reasonably mistake the combined or overwritten values for purely observed exchange liquidations. The README now distinguishes estimates and observations, but the runtime data model should too.
Proposed separation
Keep derived estimated pressure in distinct state fields (e.g. pressureEstimateLong, pressureEstimateShort) instead of the observed event counters.
Keep observed liquidation event notionals in separate counters with an explicit observation window and source/status.
Make the UI label each output as estimate or observed event volume, with appropriate source and freshness.
Ensure a periodic REST sync doesn't reset observed event totals or silently mix them with an estimate.
Reproducible acceptance test
Use synthetic market input and a synthetic @forceOrder event in a local development environment; no access to production accounts is needed.
After a market refresh, calculated pressure estimates exist and observed event totals remain unchanged.
When one liquidation event arrives, only the appropriate observed counter increases.
After the next refresh, the event count persists for its defined window and the pressure estimate may recompute independently.
When sources fail or the observation window rolls over, the interface reports the relevant status without presenting an estimate as a measurement.
A test plus a small PR would be especially valuable. Avoid real credentials, live trading, or stressing third-party services.
Discussion question: What is the least confusing way to present inferred liquidation risk beside actual exchange liquidation events?
Activity