atomicds.timeseries.polling.start_polling_task¶
- atomicds.timeseries.polling.start_polling_task(client, data_id: str, *, interval: float = 1.0, last_n: int | None = None, on_result: Callable[[DataFrame], Any] | None = None, **kwargs) Task[None][source]
Start the async poller as an asyncio.Task and stream results to a callback.
Wraps aiter_poll in a background Task. If on_result returns a coroutine, it will be awaited before the next iteration.
- 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 for. None is all.on_result (
Callable[[DataFrame],Any] |None) – Optional callback invoked with each yielded result. If it returns a coroutine, it will be awaited.**kwargs – Additional keyword arguments forwarded to aiter_poll (e.g., distinct_by, until, max_polls, fire_immediately, jitter, on_error).
- Returns:
A created and started Task. Cancel it to stop polling.
- Return type:
asyncio.Task[None]
- Raises:
RuntimeError – If no running event loop is available when called.