Backtest._window_at#
- Backtest._window_at(origin)[source]#
The estimation sample at one origin, in the shape
fitexpects.Rows
0 .. origin - 1under the expanding scheme, the lastwindowof them under the rolling one; a single series is handed back as(m,), the way it arrived. A view of the stored sample, not a copy.- Parameters:
- Return type:
- Returns:
The
(m, k)or(m,)window.
Example
>>> import numpy as np >>> y = np.random.default_rng(0).standard_normal((130, 2)) >>> Backtest(y, lambda w: w, start=100)._window_at(110).shape (110, 2) >>> rolling = Backtest(y, lambda w: w, start=100, scheme="rolling", window=60) >>> rolling._window_at(110).shape, bool(np.all(rolling._window_at(110) == y[50:110])) ((60, 2), True) >>> Backtest(y[:, 0], lambda w: w, start=100)._window_at(100).shape (100,)