> ## Documentation Index
> Fetch the complete documentation index at: https://dash-docs.nomos.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Walk long lists with the cursor each page hands you.

Lists page by a cursor taken from the previous answer's `next`. When `next` is `null`, you have everything. A page that comes back exactly full always has a `next`, so the last call of a walk can return an empty page.

| Style | Routes | Send |
| - | - | - |
| Newest first | Market and wallet `/trades` | `before=ts,block,logIndex` |
| Newest first | Market and wallet `/activity` | `before=ts,block,logIndex,seq` |
| Oldest first | `/v1/fills`, `/v1/fills/all` | `after=ts,block,logIndex`, with the same window |
| Offset | Wallet `/positions?status=`, `/exits` | `offset=` the previous `next` |
| Opaque keyset | `/v1/leaderboard` | `cursor=` the previous `next`, same sort and category |

Keyset cursors never skip or repeat a row while new data arrives, so you can walk a wallet's whole history at your own pace. Most `limit` values out of range are clamped, not refused; the fill routes refuse them.

## Walk a Wallet's Whole Trade History

<CodeGroup>
  ```python Python theme={null}
  # uses get() from Rate Limits
  def all_trades(wallet):
      before = None
      while True:
          params = {"limit": 500}
          if before:
              params["before"] = before
          page = get(f"/v1/wallets/{wallet}/trades", **params)
          yield from page["trades"]
          before = page["next"]
          if not before:
              break

  for t in all_trades("0x885783760858e1bd5dd09a3c3f916cfa251ac270"):
      print(t["ts"], t["side"], t["size"], t["price"], t["market"] and t["market"]["question"])
  ```

  ```javascript JavaScript theme={null}
  // uses get() from Rate Limits
  async function* allTrades(wallet) {
    let before = null;
    do {
      const page = await get(`/v1/wallets/${wallet}/trades`, before ? { limit: 500, before } : { limit: 500 });
      yield* page.trades;
      before = page.next;
    } while (before);
  }

  for await (const t of allTrades("0x885783760858e1bd5dd09a3c3f916cfa251ac270")) {
    console.log(t.ts, t.side, t.size, t.price, t.market?.question);
  }
  ```
</CodeGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.