-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add Polymarket Gamma API support for instrument loading #3141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cjdsellers
merged 79 commits into
nautechsystems:develop
from
DeirhX:gamma-markets-fetch
Nov 6, 2025
Merged
Add Polymarket Gamma API support for instrument loading #3141
cjdsellers
merged 79 commits into
nautechsystems:develop
from
DeirhX:gamma-markets-fetch
Nov 6, 2025
Conversation
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
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
See release notes.
7 tasks
8 tasks
|
I see the assertion comparison is probably not by value, will fix it tomorrow. |
cjdsellers
reviewed
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this @DeirhX 🙏
|
Thanks for the suggestions, hopefully I addressed them. |
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.
Pull Request
NautilusTrader prioritizes correctness and reliability, please follow existing patterns for validation and testing.
CONTRIBUTING.mdand followed the established practicesSummary
Watching a large number (1000+) instruments currently gives us two options for initialisation:
a) fetch every instrument separately (1000+ API calls, too slow)
b) sequentially iterate over all historic markets (faster, however, there are currently 160K of them and growing)
None of these options are particularly efficient and future-proof. This PR introduces a third option - use the Gamma API to fetch the market list, which supports server-side filtering, and we can query only for active markets.
Note, however, that the Gamma API is different and has some caveats:
Given that, this API gives us the opportunity to perform powerful server-side filtering without having to iterate through an increasingly larger list of (mostly dead) markets. However, since it's not without caveats, I've implemented it as an opt-in functionality and haven't changed the default one, which will still use the CLOB API.
Related Issues/PRs
Together with #3140 and (coming soon) enables Nautilus to work on thousands of polymarket subscriptions
Type of change
Breaking change details (if applicable)
None
Testing
I verified that the output is parsed into the fields returned by the CLOB API if we have them. This alternative is activated using
use_gamma_markets = True, so it should not affect existing behaviour. I leave it up to you to change the defaults if this proves to be both useful and safe (one disadvantage I know of - Gamma API doesn't report on fees, however, we know they are zero for now. Unless they become market-dependent, we can get away with updating a constant here).