quantlab.runs.record.record_read#

quantlab.runs.record.record_read(source, panel, *, symbols=None, variables=None, reread=None, store=None, part=None, reread_range=None, settings=None)[source]#

Log a read of source to the innermost open recorder, if there is one.

Called by the read seams only (BaseDataset.panel on a leaf dataset, Factor.read, RiskStore.read) after a successful read. Outside a recorder it returns at once; nothing is kept and nothing is hashed.

Parameters:
sourceBaseDataset, Factor or FactorRiskModel

The leaf dataset, the factor whose store was read, or the factor risk model one of whose stores was read.

panelxr.Dataset

What the read returned. Its first and last bar are the request’s range, so two requests spelled differently ("2020-01-01" and the first bar 2020-01-02T00:00:00) that read the same bars are one request. Only its timestamps are read here.

symbolssequence, optional

The requested symbols; None for every symbol.

variablessequence of str, optional

The requested variables; None for every variable.

rereadcallable, optional

Returns the same panel again; the recorder calls it once per distinct request when it closes, to hash it. Exactly one of reread and reread_range is given.

storestr, optional

The store actually read, for the fallback key of an unmapped source; defaults to source.store_path. A resampled dataset reading its source store passes that store.

partstr, optional

The part of source read, appended to its key as <key>.<part>: the regression or estimate store of a factor risk model.

reread_rangecallable, optional

For a store read a bar at a time (a risk model’s estimate row at each bar): the requests of the key that differ only in their range are one request, over the first to the last bar of them all, re-read once with reread_range(first, last) when the recorder closes. Bars between reads that were not read are hashed too. An empty read is not logged.

settingsmapping, optional

The settings the store was built with when they are not visible in its values, such as the session window and quote filters of NBBO bars resampled on the WRDS server. JSON-ready; recorded with the entry and folded into its digest (_with_settings), so other settings give another digest even over identical values.

Examples

A leaf dataset’s panel ends with (prices is a StockDataset):

record_read(
    self, panel, symbols=symbols, variables=variables,
    reread=lambda: self.panel(start, end, symbols, variables),
)