quantlab.backtest.live.mirror_new_bars#

quantlab.backtest.live.mirror_new_bars(source, store, end)[source]#

Bring a store copying some of source’s variables up to end.

The store holds a subset of source’s variables on (timestamp, symbol), written once from source.panel (the example’s prices.zarr, a copy of the index roster store). source’s bars after the store’s last, up to end, are appended (widen_and_append, index coordinates in one chunk). When source holds a symbol the store lacks, appending would give it no history, so the store is instead rewritten from source over its own first bar to end (through a sidecar and two renames, so an interrupted rewrite leaves the old store or the new one): what a fresh copy would be.

Parameters:
sourceBaseDataset

The dataset copied.

storestr or os.PathLike

The copy’s Zarr store.

endstr or datetime-like

The last bar to copy.

Returns:
str

"current" (nothing to do), "appended" or "rewritten".

Raises:
KeyError

If source lacks a variable of the store.

Examples

>>> mirror_new_bars(index_dataset(), WORK / "prices.zarr", "2026-10-07")
'appended'