quantlab.factor.kunquant.run_batch_graph#

quantlab.factor.kunquant.run_batch_graph(name, function, arrays, timestamps, symbols, njobs)[source]#

Compile function for a whole range (through compile_graphs) and run it over arrays.

For a computation whose inputs do not come from a dataset panel (a factor reading another factor’s store, say). The graph is compiled in the TS layout with BATCH_OPTIONS, the symbols padded and cut as FactorKunQuant does, and run on the shared executor.

Parameters:
namestr

The compiled module’s name.

functionKunQuant.Stage.Function

The graph; its Input names are the keys of arrays.

arraysdict[str, np.ndarray]

Contiguous float32 [time, symbol] inputs.

timestamps, symbolsnp.ndarray

The axes of the inputs and of the returned panel.

njobsint

Executor threads.

Returns:
xr.Dataset

Every output of the graph on (timestamp, symbol).

Examples

>>> b = Builder()
>>> with b:
...     Output(Input("x") * 2.0, "y")
>>> run_batch_graph("Double", Function(b.ops), {"x": x}, times, symbols, 2)["y"].shape
(3, 8)