quantlab.runs.run_metrics.decided_bars#
- quantlab.runs.run_metrics.decided_bars(rebalances)[source]#
Return the bars of the decided rebalances of a rebalance record.
- Parameters:
- rebalancesxarray.Dataset
A rebalance record:
scheduledanddecidedontimestamp.
- Returns:
- numpy.ndarray
The
timestampvalues wheredecidedis true, in order.
Examples
>>> bars = pd.bdate_range("2024-01-01", periods=3) >>> record = xr.Dataset({ ... "scheduled": ("timestamp", [True, True, False]), ... "decided": ("timestamp", [True, False, False]), ... }, coords={"timestamp": bars}) >>> pd.DatetimeIndex(decided_bars(record)).strftime("%Y-%m-%d").tolist() ['2024-01-01']