feat(perps): paginate fills with the native cursor and sort - #188
Merged
kartojal merged 3 commits intoJul 29, 2026
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 188b932. Configure here.
kartojal
deleted the
feature/dev-427-support-native-fills-cursorsort-in-ts-and-python-sdks
branch
July 29, 2026 08:31
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.

Resolves DEV-427
Changes
list_fills(action andPerpsSession) now forwards the API's nativecursorparam instead of the SDK-managed opaque cursor (timestamp window + seen keys), which has been removed for fills. Cursors are treated as opaque pass-through values;next_cursorcomes from the last fill of each page per the documented cursor protocol.sortkeyword ("desc"default /"asc", typed asPerpsSortDirectionand exported frompolymarket.models) forwarded as the nativesortparam; invalid values raiseUserInputError.Note: previously issued SDK-encoded fills cursors are no longer decoded; cursors are short-lived pagination state, so this is not treated as a breaking migration.
Usage
Note
Medium Risk
Behavior change for fills pagination (no SDK-encoded cursors, no implicit 24h window) can affect integrators mid-pagination; scope is limited to the fills listing path with solid test coverage.
Overview
Perps
list_fills(account action andPerpsSession) no longer uses the SDK’s_descending_historyopaque cursor (timestamp window + seen keys). It now calls/v1/account/fillswith the API’scursorandsortquery params, setsnext_cursorfrom the last fill’strade_idwhenmoreis true, and passes through caller cursors unchanged.New optional
sort("desc"/"asc", typed as exportedPerpsSortDirection) is validated client-side; bad values raiseUserInputError. The fills-only default 24-hour window whenstartis omitted is removed so server defaults apply. Other account history paginators are unchanged.Tests add native fills pagination coverage and move malformed-cursor checks from fills to funding payments.
Reviewed by Cursor Bugbot for commit e9fc858. Bugbot is set up for automated code reviews on this repo. Configure here.