Skip to content

fix: correct order snapshot subscription types - #7

Merged
poly-william merged 1 commit into
mainfrom
harley/order-snapshot-types
Sep 17, 2026
Merged

poly-william merged 1 commit into
mainfrom
harley/order-snapshot-types

Conversation

@harley-poly

@harley-poly harley-poly commented Sep 17, 2026

Copy link
Copy Markdown
Member

Changes

Allow SUBSCRIPTION_TYPE_ORDER_SNAPSHOT in private subscriptions and correct the OrderSnapshot discriminator. Add a consumer type fixture to the existing mypy job, cover request types and successful/failed EOF dispatch, and update the README to request snapshots separately from live orders.

Runtime dispatch stays the same. Consumers relying on the previous incorrect snapshot literal may need to update their type annotations. README code-block formatting also satisfies the current Ruff check.

Testing

  • uv run pytest — 131 tests pass.
  • uv run ruff check . and uv run ruff format --check . pass.
  • uv run mypy polymarket_us tests/types/order_snapshot.py — 32 files pass; the consumer fixture produces two expected errors against the original types.
  • uv build passes.

Checklist

  • Tests pass (pytest)
  • Linting passes (ruff check .)
  • Types check (mypy polymarket_us)

Note

Low Risk
Runtime WebSocket handling is unchanged; the main impact is stricter typings that may require consumer annotation updates.

Overview
Fixes WebSocket typing and docs so one-shot order snapshots use SUBSCRIPTION_TYPE_ORDER_SNAPSHOT, separate from live SUBSCRIPTION_TYPE_ORDER updates. OrderSnapshot’s subscriptionType literal is corrected accordingly, and PrivateSubscriptionType now allows subscribing with the snapshot type.

CI mypy also type-checks tests/types/order_snapshot.py as a consumer fixture. New offline tests assert live vs snapshot subscribe payloads differ and that terminal snapshot frames dispatch to order_snapshot or error when an error field is present. The README explains requesting snapshots separately, shows an extra subscribe call, and prints eof in the snapshot handler (plus minor example formatting).

Reviewed by Cursor Bugbot for commit e3e5ec6. Bugbot is set up for automated code reviews on this repo. Configure here.

@poly-william poly-william left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed this exact head. Snapshot typing matches the gateway contract, runtime dispatch is unchanged, and local tests, typing, lint and build passed. Current CI is green.

@poly-william
poly-william merged commit 83128f4 into main Sep 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants