Skip to content

feat: support closed any in market and event lists - #362

Open
kartojal wants to merge 3 commits into
mainfrom
feat/closed-any
Open

kartojal wants to merge 3 commits into
mainfrom
feat/closed-any

Conversation

@kartojal

@kartojal kartojal commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Market identifier lookups can include open and closed results with closed="any". Add the literal to synchronous and asynchronous list_markets/list_events and their shared request builders. Preserve current defaults (None/omitted for markets, False for events); invalid SDK values and any without a supported market identifier raise the existing UserInputError before HTTP. Existing six identifier selectors are sufficient; oracle/event selector additions remain in their separate open PRs.

Contract: markets-tooling#2836. Verified the final diff/review, release v0.350.166, production promotion, live schema and safe list/keyset reads on 2026-10-15. any removes only the closed filter; existing visibility, active/archive and protocol defaults still apply.

Validation: Ruff lint/format, strict Pyright, non-integration pytest suite (3,246 passed) and uv build; representative sync/async HTTP serialization and public typing coverage. Independent read-only SDK/API review found no blockers.

Production caveat: /events/count is advertised by the service schema but returns 422 id is invalid; this SDK change uses only the functioning keyset routes.

Companions: documentation, TypeScript.


Note

Low Risk
Additive API surface with client-side validation; defaults unchanged and behavior is covered by new unit tests.

Overview
Adds closed="any" support on Gamma list_events and list_markets (sync/async public and secure clients), so callers can include both open and closed results without changing existing defaults (False for events, omitted/None for markets).

Shared gamma builders introduce a ClosedFilter type (bool | "any"), _check_closed validation, and a guard that closed="any" on markets requires at least one identifier (ids, slug, clob_token_ids, condition_ids, position_ids, or question_ids); invalid values raise UserInputError before HTTP. Docstrings and unit tests cover param serialization, typing, and the identifier requirement.

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

@kartojal
kartojal marked this pull request as ready for review October 15, 2026 15:11

This branch has not been deployed

No deployments
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