atomicds.timeseries.polling.aiter_poll

async atomicds.timeseries.polling.aiter_poll(client, data_id: str, *, interval: float = 1.0, last_n: int | None = None, distinct_by: Callable[[DataFrame], Any] | None = None, until: Callable[[DataFrame], bool] | None = None, max_polls: int | None = None, fire_immediately: bool = True, jitter: float = 0.0, on_error: Callable[[BaseException], None] | None = None) AsyncIterator[DataFrame][source]

Asynchronously yield time series results without blocking the loop.

Uses the the same semantics as iter_poll.

Parameters:
  • client – API client instance forwarded to the provider.

  • data_id (str) – Identifier to fetch data for.

  • interval (float) – Seconds between polls. Defaults to 1.0.

  • last_n (int | None) – Last number of time series data points to poll. None is all.

  • distinct_by (Callable[[DataFrame], Any] | None) – Optional function mapping a result to a hashable key for deduping. If provided, only results with a new key are yielded.

  • until (Callable[[DataFrame], bool] | None) – Optional predicate; stop when it returns True for a result.

  • max_polls (int | None) – Optional maximum number of polls before stopping.

  • fire_immediately (bool) – If True, perform the first poll immediately; otherwise wait one interval before the first poll. Defaults to True.

  • jitter (float) – Optional random delay (0..jitter) added to each sleep to avoid thundering herds. Clamped at interval. Defaults to 0.0.

  • on_error (Callable[[BaseException], None] | None) – Optional error handler called with the raised exception when a poll fails. Errors are swallowed so polling continues.

Yields:

Any – Each (optionally deduped) time series data frame result.

Return type:

AsyncIterator[DataFrame]

Notes

  • Uses asyncio.to_thread so provider calls never block the event loop.

  • Drift-corrected scheduling preserves cadence even with slow polls.

  • Stops when until is satisfied or max_polls is reached (if set).