Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

WebSocket message dispatch for the Polymarket execution client.

Routes user-channel WS messages (order updates and trades) for orders submitted through this client into Nautilus order events (OrderAccepted / OrderFilled / OrderCanceled / OrderRejected / OrderExpired), building them from the identity captured at submit (OrderIdentityRegistry). Order-channel messages drive lifecycle events; trade-channel messages drive fills, and acceptance is synthesized before a fill or cancel that races ahead. Messages are emitted once the order is known (accepted, or with a submit in flight), otherwise buffered until acceptance. Reports are reserved for the generate_* query and reconciliation methods. Trade fills are deduped via a FIFO cache; maker and taker fills are handled separately to account for multi-leg maker order matching.