The RESTClient handles pagination automatically, but you can control its behavior using the pagination parameter during initialization and the limit parameter in method calls.
When pagination=True (the default):
limit controls the page size (number of results per request).- The client automatically fetches all subsequent pages, yielding results until the entire dataset is exhausted.
To return only a fixed number of results and stop after the first page, set pagination=False when creating the client.
Note: When pagination=False, the limit parameter controls the total number of results returned.
# Default: Fetches ALL TSLA trades, 100 per page
client = RESTClient(api_key="<API_KEY>")
trades = [t for t in client.list_trades(ticker="TSLA", limit=100)]
# Disabled: Fetches AT MOST 100 total trades and stops
client = RESTClient(api_key="<API_KEY>", pagination=False)
trades = [t for t in client.list_trades(ticker="TSLA", limit=100)]
# Default (Pagination Enabled)
client = RESTClient(api_key="<API_KEY>")
trades = [t for t in client.list_trades(ticker="TSLA", limit=100)]
# Disabling Pagination
client = RESTClient(api_key="<API_KEY>", pagination=False)
trades = [t for t in client.list_trades(ticker="TSLA", limit=100)]