atomicds.timeseries.polling.start_polling_thread¶
- atomicds.timeseries.polling.start_polling_thread(client, data_id: str, *, interval: float = 1.0, last_n: int | None = None, on_result: Callable[[DataFrame], None], **kwargs) Event[source]
Start the sync poller in a background thread and stream results to a callback.
Wraps iter_poll in a daemon thread and invokes on_result(result) for each yielded item. Returns a threading.Event that can be set to stop polling gracefully.
- 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],None]) – Callback invoked with each yielded result.**kwargs – Additional keyword arguments forwarded to iter_poll (e.g., distinct_by, until, max_polls, fire_immediately, jitter, on_error).
- Returns:
Event that, when set, requests the polling thread to stop.
- Return type:
threading.Event