Skip to content

feat: add batch order helpers - #14

Merged
harley-poly merged 3 commits into
mainfrom
harley/python-batch-orders
Oct 8, 2026
Merged

harley-poly merged 3 commits into
mainfrom
harley/python-batch-orders

Conversation

@harley-poly

@harley-poly harley-poly commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Changes

Add orders.create_many(), cancel_many() and modify_many() to both Python clients, with typed requests/responses and usage examples. Each helper sends one authenticated request through the existing transport, preserving its no-retry policy for orders.

Document the 20-order limit and that cancel/modify response IDs confirm submission, not individual order outcomes. Accept fractional quantities in the reused create/modify request types. These two annotations overlap #6; its response quantity changes remain separate.

Set the additive SDK version to 2.4.0, to release after #15's 2.3.0. Follows the SDK follow-up in https://github.com/Polymarket/go-gateway-us/pull/751.

Testing

  • 271 tests pass on Python 3.10 and 3.13, including 48 new batch cases covering signatures, fractional/whole quantities, payloads, responses, authentication, API errors/timeouts and no retries or splitting.
  • Typed consumers exercise all new methods and exported types, including fractional and whole quantities.
  • Ruff lint/format, mypy and wheel/sdist build pass. No live orders submitted.

Checklist

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

Note

Medium Risk
New trading endpoints with non-idempotent POST semantics; incorrect client assumptions about cancel/modify response IDs could cause operational mistakes, though behavior matches existing single-order retry policy.

Overview
Adds batch order APIs to the sync and async clients: orders.create_many, cancel_many, and modify_many, each posting up to 20 items in one authenticated request to /v1/orders/batched (and /cancel, /modify). New TypedDicts cover batch request/response shapes; create/modify quantity is widened to int | float for fractional sizes.

README documents the 20-order cap, semantics of returned ID lists (create returns exchange IDs; cancel/modify echo submitted IDs without per-order confirmation), and that batches are not auto-retried or split—same as single-order POSTs. Package version bumps to 2.4.0; tests cover signing, payloads, errors, timeouts, auth, and server-side batch size validation.

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

@harley-poly harley-poly mentioned this pull request Oct 4, 2026
3 tasks done
@harley-poly
harley-poly merged commit b42ead1 into main Oct 8, 2026
11 checks passed
@harley-poly
harley-poly deleted the harley/python-batch-orders branch October 9, 2026 20:55
watashi pushed a commit to watashi/polymarket-us-python that referenced this pull request Oct 12, 2026
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