Pagination
Cursor paging - limit, meta.next_cursor and cursor - and which way each list walks.
A list answers one page and a cursor:
- Ask with
limit(rows per page; each route documents its maximum). - If
meta.next_cursoris notnull, ask again with the same parameters pluscursor=<next_cursor>. - Stop when
meta.next_cursorisnull.
Cursors are opaque and belong to the route and parameters they came from: a cursor used elsewhere answers 400 invalid_cursor. Walking the cursors never repeats or skips a row.
Direction. Market series (candles, open interest, funding, basis, long/short ratio, large trades) page backward in time: the first page holds the newest rows, each next page the rows before. Calendar events page forward through the window; news pages from the newest story back.
for bar in client.market.iter_candles(venue="binance", symbol="BTCUSDT", res="60", max_items=5000):
...for await (const bar of cd.market.candles.iterate({ venue: 'binance', symbol: 'BTCUSDT', res: '60', maxItems: 5000 })) { /* ... */ }Each page is a call and costs its units.