Skip to content

fix: omit ascending param when unset, default to descending#43

Open
mvanhorn wants to merge 1 commit intoPolymarket:mainfrom
mvanhorn:osc/17-sort-descending-default
Open

fix: omit ascending param when unset, default to descending#43
mvanhorn wants to merge 1 commit intoPolymarket:mainfrom
mvanhorn:osc/17-sort-descending-default

Conversation

@mvanhorn
Copy link

@mvanhorn mvanhorn commented Mar 10, 2026

Summary

  • When --ascending is not passed, the CLI was sending ascending=false to the Gamma API, which overrode the server's default descending sort
  • Changed all 7 call sites (markets, events, series, tags, comments, sports) to use .maybe_ascending() so the parameter is only included when the user explicitly requests ascending order
  • This lets the API return results in its natural descending order by default

Fixes #17

Test plan

  • cargo fmt --check passes
  • cargo clippy -- -D warnings passes
  • cargo test passes (131 tests)
  • polymarket markets list returns newest markets first (descending)
  • polymarket markets list --ascending returns oldest first

This contribution was developed with AI assistance (Claude Code).


Note

Low Risk
Small, mechanical change to request parameter construction; main risk is behavior change in default sort order for list commands.

Overview
Fixes list endpoints in the CLI to stop sending ascending=false by default, which previously overrode the Gamma API’s default (descending) sort.

Across comments, events, markets, series, sports teams, and tags list commands, request builders switch from .ascending(ascending) to .maybe_ascending(...), so the ascending parameter is only included when the user passes --ascending.

Written by Cursor Bugbot for commit b6da0e5. This will update automatically on new commits. Configure here.

…ding

When --ascending is not passed, the CLI was sending ascending=false to
the API, overriding the server's default sort order. Now we use
maybe_ascending to only send the parameter when explicitly requested,
letting the API return results in its natural (descending) order.

Fixes Polymarket#17

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

--ascending flag has no counterpart; sort defaults to ascending with no way to sort descending

1 participant