Paging

Every list takes limit and cursor.

json
"meta": {
  "page": {
    "limit": 100,
    "hasMore": true,
    "nextCursor": "eyJvIjoxMDAs…",
    "total": null,
    "retryAfter": null
  },
  "next": "/v1/gpu/prices?limit=100&cursor=eyJvIjoxMDAs…"
}
python
url = "/v1/gpu/prices?limit=100"
while url:
    page = get(url)
    wait = page["meta"]["page"]["retryAfter"]
    if wait:
        sleep(wait)
        continue
    rows += page["data"]
    url = page["meta"]["next"]
  • Request meta.next until it is null. Where a route counts its rows, meta.page.total is how many match on every page. A change feed counts none: its total is null.
  • A page whose rows were still being read when it answered has meta.page.retryAfter, in seconds, and the same Retry-After header: it may hold fewer rows than the query matches, and its hasMore: false is not the end. Send the same request again after that wait. That page is free; the repeat is charged as usual. On every other page retryAfter is null.
  • In a batch, limit counts per listing and one cursor pages them all; meta.page.total counts every listing's rows, on every page.
  • Without limit, a route reads its default page size, listed in the reference.
  • A cursor belongs to its query. Change a filter and start again; limit may change between pages.
  • A cursor from another query is a free 400 cursor_invalid.
  • Search and SEC lists page 5,000 rows deep: 100 pages of 50. The last page stops at row 5,000 with hasMore false and, with rows left, a depth_limit notice that names the route's window, from and to on /filings. Split the window to reach older rows. POST /v1/datasets/cost says how many rows a listing holds.
  • A change feed ends meta.next once caught up, but its meta.cursor stays where your next poll resumes: send it as cursor. /v1/insider-trades/changes and /v1/catalysts/changes give one for all their symbols; /v1/catalysts/changes also gives each listing's in meta.symbols.
  • Routes that do not page answer "page": null.

Only what changed

updatedSince keeps the rows updated at or after a moment, on /v1/perps/markets, /v1/hiring/momentum and /v1/gpu/prices. It pages like any other filter, and meta.page.total and meta.coverage count only the rows it keeps.

python
from urllib.parse import quote
url = f"/v1/hiring/momentum?updatedSince={quote(last_sync)}"
  • It is inclusive: a row updated at exactly last_sync comes back again. Start from the last sync's time and drop rows you already hold.
  • URL-encode the time. A + in an offset such as +02:00 reads as a space and is a 400 that says to send %2B02:00.
  • Perpetual markets are read from their venue every few minutes, so most active markets match each poll.
  • Each page is charged like any other, even when it holds no rows. A listing read with symbols= that finds nothing stays free, as in any batch.