quantlab.utils.progress.ProgressEvent#

class quantlab.utils.progress.ProgressEvent(kind, vendor, completed=0, total=0, symbols=(), message=None, detail=<factory>)[source]#

Bases: object

One thing that happened during an acquisition or a conversion.

The acquisition loop emits run_started (total is the number of batches, message the bar label), coverage (detail holds counts of symbols already on disk versus still to fetch), batch_completed (completed rises from 1 to total), quota_exhausted (the rest of the batches are skipped, not fetched), cancelled and run_finished. batch_failed is reserved for reporting a single failed batch.

The conversion loop emits conversion_started (total is the number of planned time windows; detail holds the symbol count, the window size and the store path), then window_written or window_skipped for each window (skipped means an earlier run already wrote it), and finally conversion_finished. A cancelled conversion emits cancelled just before conversion_finished.

message never contains raw vendor error text. Some vendors echo the full request URL, API key included, in their errors, so the loop removes credentials before building the event. The class is frozen so that one reporter cannot change an event another reporter is about to receive.

Attributes:
kindstr

The event kind, one of EVENT_KINDS.

vendorstr

The vendor name (for example "tiingo"). Conversion events use the dataset config’s vendor, or the dataset class name if it has none.

completedint

How many batches or windows have finished so far.

totalint

How many batches or windows the run will process.

symbolstuple[str, …]

The symbols the event concerns, when it concerns any.

messagestr | None

A human-readable description with credentials already removed.

detaildict

Extra structured data whose keys depend on kind.

Examples

>>> event = ProgressEvent(kind="batch_completed", vendor="tiingo",
...                       completed=3, total=10, symbols=("AAPL",))
>>> event.kind, event.completed, event.total
('batch_completed', 3, 10)