Skip to content

Conversation

@fatihv
Copy link

@fatihv fatihv commented Dec 9, 2025

Summary

This PR adds four convenience methods to ClobClient:

  • getAllMarkets
  • getAllSimplifiedMarkets
  • getAllSamplingMarkets
  • getAllSamplingSimplifiedMarkets

Each helper iterates through the paginated CLOB API using next_cursor and
END_CURSOR, aggregating data from all pages into a single array.

Motivation

Currently, getMarkets, getSimplifiedMarkets, getSamplingMarkets and
getSamplingSimplifiedMarkets only return a single page of results. Client
code has to implement pagination manually. These helpers provide an ergonomic
way to fetch all markets without changing the existing API surface.

Implementation details

  • Reuses existing single-page methods and the existing INITIAL_CURSOR /
    END_CURSOR constants.
  • Loops until next_cursor === END_CURSOR and concatenates response.data.
  • No breaking changes, the original methods are kept as-is.

Note

Adds four ClobClient helpers to iterate paginated markets and return aggregated results.

  • Client (src/client.ts):
    • New pagination helpers:
      • getAllMarkets(next_cursor?): loops via next_cursor until END_CURSOR, aggregates response.data.
      • getAllSimplifiedMarkets(next_cursor?): same for simplified markets.
      • getAllSamplingMarkets(next_cursor?): same for sampling markets.
      • getAllSamplingSimplifiedMarkets(next_cursor?): same for sampling simplified markets.
    • Reuses existing single-page methods and INITIAL_CURSOR / END_CURSOR.

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

@fatihv fatihv requested a review from a team as a code owner December 9, 2025 14:47
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