Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Shared state for the Derive execution WebSocket dispatch loop.

Holds identity context for orders submitted through this client plus the cross-stream deduplication gates that keep replay frames and concurrent .orders / .trades updates from emitting duplicate events.

Tracked orders (those whose identity was registered at submission time) produce proper order events (OrderAccepted, OrderFilled, OrderCanceled, OrderExpired, OrderRejected). Untracked frames fall back to execution reports for downstream reconciliation.

Structs§

OrderIdentity
Order identity captured at submission time so the dispatch task can build proper order events without consulting the cache.
WsDispatchState
Shared dispatch state for the Derive WS execution loop.

Constants§

ORDER_DEDUP_CAPACITY
Capacity for the per-order accepted / filled dedup caches. Tracks active and recently-terminal orders so reconnect replays do not re-emit lifecycle events; need only span the live-stream replay window plus a margin.
TRADE_DEDUP_CAPACITY
Capacity for the cross-source trade-id dedup cache. Sized to cover any reconciliation lookback window plausible for live trading.