Skip to content

Fix: look up resolutions by condition_ids instead of paging all markets - #6

Open
mpont91 wants to merge 1 commit into
ent0n29:mainfrom
mpont91:fix/resolution-tracker-condition-ids
Open

Fix: look up resolutions by condition_ids instead of paging all markets#6
mpont91 wants to merge 1 commit into
ent0n29:mainfrom
mpont91:fix/resolution-tracker-condition-ids

Conversation

@mpont91

@mpont91 mpont91 commented Aug 26, 2026

Copy link
Copy Markdown

The resolution tracker pages through every closed market on Polymarket looking for matches against the condition IDs we care about. That dies partway through:

resolution_tracker - WARNING - Error fetching markets page 21: Client error
"422 Unprocessable Entity" for url ".../markets?closed=true&limit=100&offset=2100..."
resolution_tracker - INFO - Fetched 79 matching resolved markets

79 resolutions out of 2285 wanted, so most traded markets never get one.

The code says the API cannot filter by condition ID:

The Gamma API does not support efficient condition_id filtering, so we fetch resolved markets and match locally.

It can. Two things are needed to make it work, and missing either returns an empty list, which is likely why it was ruled out:

  • closed=true — without it only active markets match, so a resolved market returns nothing
  • an explicit limit — it silently caps at 20 results otherwise

Now queries the wanted IDs directly in batches of 40 (~3KB query string). A failing batch is skipped rather than aborting the whole run.

Verified locally: 909 resolutions for 2236 IDs, up from 79. The remainder are markets that genuinely have not closed yet.

The tracker paged through every closed market on Polymarket looking for
matches, which died on a 422 past offset 2100 and found 79 resolutions out
of 2285 wanted. Most markets we trade never got a resolution as a result.

The Gamma API does support condition_ids filtering, contrary to the comment
this replaces. It needs two things to work: closed=true, or it only matches
active markets and returns nothing, and an explicit limit, or it silently
caps at 20 results.

Now queries the wanted ids directly in batches of 40. A failing batch is
skipped instead of aborting the run.

Verified locally: 909 resolutions found for 2236 ids, up from 79.
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.

1 participant