Use OrderbookEngine for a managed local book. Enable PN1 integrity for price-sensitive decisions.
PN1 keeps price and size values as exact decimal strings. It validates the full-snapshot anchor, then validates sequence continuity and a deterministic checksum on each applicable update.
Managed state moves through initializing, ready, stale, resyncing, and failed. With stale reads disabled, queries are unavailable until a verified anchor is ready and become unavailable after a disconnect or integrity failure. The engine requests a fresh anchor before returning to ready.
Wildcard "*" subscriptions are unavailable in integrity mode. Use explicit token IDs, slugs, or condition IDs.
For raw messages, construct OrderbookWS(..., integrity=True), register snapshot, resyncing, error, and unknown handlers, then await subscribe(...). Close it with disconnect().
See the shared orderbook guide and PN1 protocol reference.