pub enum WsUpdate {
Snapshot {
market_id: String,
asset_id: String,
book: Arc<Orderbook>,
exchange_ts: Option<u64>,
local_ts: Instant,
local_ts_ms: u64,
seq: u64,
},
Delta {
market_id: String,
asset_id: String,
changes: ChangeVec,
exchange_ts: Option<u64>,
local_ts: Instant,
local_ts_ms: u64,
seq: u64,
},
Clear {
market_id: String,
asset_id: String,
reason: InvalidationReason,
local_ts: Instant,
local_ts_ms: u64,
seq: u64,
},
Trade {
trade: ActivityTrade,
local_ts: Instant,
local_ts_ms: u64,
},
Fill {
fill: ActivityFill,
local_ts: Instant,
local_ts_ms: u64,
},
}Expand description
Every per-market event the WebSocket surface emits. Closed tagged union;
no untyped escape hatch in the stable enum. If an exchange grows a
payload we want to surface in raw form, add a separate raw_events()
stream rather than another WsUpdate variant — keeps consumer
match exhaustiveness honest.
Variants§
Snapshot
Full orderbook snapshot — replace any cached book for (market_id, asset_id).
Fields
Delta
Incremental change to an existing book — apply in-place.
Fields
Clear
Book invalidation — drop the cached book and wait for the next Snapshot.
Fields
reason: InvalidationReasonTrade
A public trade (any counterparty), not tied to a local order.
Fill
A fill on one of the authenticated user’s orders.
Implementations§
Source§impl WsUpdate
impl WsUpdate
Sourcepub fn local_ts(&self) -> Instant
pub fn local_ts(&self) -> Instant
Uniform accessor for the ingest-side monotonic timestamp. Use for
metrics and cross-update ordering; for per-market sequencing prefer
the seq field on Snapshot / Delta.
Sourcepub fn local_ts_ms(&self) -> u64
pub fn local_ts_ms(&self) -> u64
Wall-clock millis paired with local_ts. Use for serialization and
any cross-process correlation; not monotonic.