Fix: look up resolutions by condition_ids instead of paging all markets - #6
Open
mpont91 wants to merge 1 commit into
Open
Fix: look up resolutions by condition_ids instead of paging all markets#6mpont91 wants to merge 1 commit into
mpont91 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The resolution tracker pages through every closed market on Polymarket looking for matches against the condition IDs we care about. That dies partway through:
79 resolutions out of 2285 wanted, so most traded markets never get one.
The code says the API cannot filter by condition ID:
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 nothinglimit— it silently caps at 20 results otherwiseNow 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.