Skip to content

Conversation

@danytrackmania
Copy link

@danytrackmania danytrackmania commented Dec 8, 2025

Summary

This PR adds two convenience methods to ClobClient:

  • get_all_markets
  • get_all_simplified_markets

Both methods iterate through the paginated CLOB API using the next_cursor and
END_CURSOR convention and return a flat list of all markets.

Motivation

Currently, get_markets and get_simplified_markets only return a single
page of results and require client code to implement pagination manually.
These helpers provide a simple, ergonomic way to fetch all markets without
breaking the existing API surface.

Implementation details

  • get_all_markets calls get_markets in a loop and aggregates response["data"]
    until next_cursor == END_CURSOR.
  • get_all_simplified_markets does the same using get_simplified_markets.
  • No existing methods were modified; this is a purely additive change.

Testing

Manually tested against the CLOB API by verifying that:

  • all pages are fetched until END_CURSOR,
  • the length of the aggregated result matches the total across pages.

Note

Introduce get_all_markets and get_all_simplified_markets to iterate pagination and return full market lists; clarify and type-hint single-page get_markets and get_simplified_markets.

  • Client (py_clob_client/client.py):
    • New pagination helpers:
      • get_all_markets(next_cursor: str = "MA=="): loops through cursors until END_CURSOR, aggregates response["data"].
      • get_all_simplified_markets(next_cursor: str = "MA=="): same for simplified markets.
    • API clarifications + typing:
      • Add str type hints and clarify docs for get_markets and get_simplified_markets as single-page fetches.

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

Add get_all_markets and get_all_simplified_markets helpers that iterate
through pagination cursors until END_CURSOR and return full market lists.
@danytrackmania danytrackmania requested a review from a team as a code owner December 8, 2025 15:33
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