client-python icon indicating copy to clipboard operation
client-python copied to clipboard

limit is not respected in the response for the list_quotes function

Open yiweny opened this issue 6 months ago • 0 comments

Describe the bug

from polygon import RESTClient
from dataclasses import asdict

client = RESTClient()

date = "2025-06-12"

quotes = [asdict(q) for q in client.list_quotes("AAPL", limit=1)]

print(f"Number of quotes: {len(quotes)}")

will run infinitely because the next_url will always be returned as part of the http response regardless of the limit and we will always iterate to the next page when the response contains next_url To Reproduce

Expected behavior This code currently runs infinitely. Because the code always paginate when there's next_url

            if "next_url" in decoded:

Screenshots

Additional context

yiweny avatar Jun 12 '25 21:06 yiweny