Snapshot, then replay
- Read
/v1/snapshotfor public books, or/v1/me/snapshotwith a session orreadcredential, and store itscursorwith the state. - Replay events after that cursor over HTTP or WebSocket.
- Apply each page in order, then persist your state and
next_cursoratomically.
503 SNAPSHOT_TOO_LARGE, stop quoting: history pages cannot replace a snapshot cursor.
HTTP replay
has_more: true: each scan of the shared journal covers at most 1,000 cursor positions. Always advance to next_cursor. Cursors are globally ordered decimal strings, not consecutive per subscriber. A cursor below the retained floor or ahead of the journal returns 410 RESYNC_REQUIRED: replace local state from a fresh snapshot. This also covers a reinitialized deployment.
WebSocket
Connect towss://api.lamarge.trade/v1/stream and send within five seconds:
reason can precede closure:
After a socket failure, resume from the last processed page’s cursor, not the last received. Replaying a page is safe: ignore revisions already applied. Revalidation does not consume the request budget; the initial authentication does. A stream outage is no reason to keep renewing quotes on stale state: let the lease expire or cancel.
Event kinds
occurred_at is the originating mutation time; data is rendered at publication and may include later changes. Private streams include public events. A credential sees its own identity’s orders, maker fills and lease only. Streams never carry bearers, transaction bytes, signatures or secrets. Keep an admission-deadline timer and reconcile periodically even while connected.
History pages
Order, fill, withdrawal and trade history pages use opaque backward cursors, independent of event cursors. Rows show current state: use the resource’s GET for signing and transaction details, and event replay for forward changes. For complete transfer receipts, useGET /v1/takes/history with a master session. It pages takes by creation time and ID and includes all their fills; a page never splits a take. The live /fills snapshot contains only the last 50 final fills and cannot establish a complete receipt or the outcome of an absent take. Transfer intents expose take_final for that purpose.