Skip to content

Polymarket CLOB: ignore superseded same-token late deltas without reconnecting #441

Description

@proerror77

Parent

#313

Change contract

When the public Polymarket CLOB WebSocket delivers a price-change delta whose source timestamp is older than the already-applied state for the same token, treat that delta as superseded: do not mutate the cached L2 book, do not broadcast it, and continue processing independent entries in the same batch. Keep malformed fields, invalid depth, and crossed final books fail-closed.

Counterexample

Live public wire capture on 2026-07-29 delivered timestamp 1785305941291 for a token followed by 1785305941290. Current market_updates_from_price_change returns an error for the one-millisecond late delta; the caller reconnects and emits quote_collection_failure for every subscribed token, preventing an otherwise usable source-closed segment from becoming canonical.

Acceptance criteria

  • A focused test reproduces a mixed batch containing one superseded same-token delta and one current independent-token delta.
  • The superseded entry does not mutate or broadcast the older token state.
  • The current independent entry is still applied and broadcast.
  • A crossed final book and malformed delta remain errors.
  • Focused ploy-market-data tests and formatting pass.

Out of scope

Production collector deployment/cutover; ACK Job mutation; uploader retry policy; ResearchSnapshot/evaluator/MCTS; weakening raw canonical or quote-quality policy.

PRD

None. This is a small, already-specified counterexample fix at the existing CLOB payload seam.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions