quantlab.acquisition.refresh.RefreshedPart#

class quantlab.acquisition.refresh.RefreshedPart(name, summary=None, error=None)[source]#

Bases: object

What a refresh did for one part of a raw tier: refreshed, with a summary, or failed, with an error.

RefreshedPart(name, summary) is a part refreshed; RefreshedPart.failure(name, error) one that was not. A part holds exactly one of the two.

Attributes:
namestr

The part: a table code, an endpoint name or a series id.

summarystr or None, default None

For a part refreshed, one line saying what was pulled (rows, pages, the watermark after).

errorstr or None, default None

For a part not refreshed, why.

Raises:
ValueError

If neither or both of summary and error are given.

Examples

>>> RefreshedPart("sep", "window to 2024-01-05").line
'sep: window to 2024-01-05'
>>> RefreshedPart.failure("sf1", "HTTP 404").line
'sf1: failed: HTTP 404'
classmethod failure(name, error)[source]#

Return the part name, not refreshed because of error.

Examples

>>> RefreshedPart.failure("news", "HTTP 503").ok
False
property line#

<name>: <summary>, or <name>: failed: <error>.

Examples

>>> RefreshedPart("DTB3", "downloaded").line
'DTB3: downloaded'
property ok#

Whether the part was refreshed.

Examples

>>> RefreshedPart("dividends", "3 pages").ok
True