fynance.features.roll_functions.roll_min¶
-
fynance.features.roll_functions.
roll_min
(X, w=None, axis=0, dtype=None)¶ Compute simple rolling minimum of size w for each X’ series.
\[roll\_min^w_t(X) = min(X_{t - w}, ..., X_t)\]Parameters: - X : np.ndarray[dtype, ndim=1 or 2]
Elements to compute the rolling minimum.
- w : int, optional
Size of the lagged window of the rolling minimum, must be positive. If
w is None
orw=0
, thenw=X.shape[axis]
. Default is None.- axis : {0, 1}, optional
Axis along wich the computation is done. Default is 0.
- dtype : np.dtype, optional
The type of the output array. If dtype is not given, infer the data type from X input.
Returns: - np.ndarray[dtype, ndim=1 or 2]
Simple rolling minimum of each series.
See also
Examples
>>> X = np.array([60, 100, 80, 120, 160, 80]) >>> roll_min(X, w=3, dtype=np.float64, axis=0) array([60., 60., 60., 80., 80., 80.]) >>> X = np.array([[60, 60], [100, 100], [80, 80], ... [120, 120], [160, 160], [80, 80]]) >>> roll_min(X, w=3, dtype=np.float64, axis=0) array([[60., 60.], [60., 60.], [60., 60.], [80., 80.], [80., 80.], [80., 80.]]) >>> roll_min(X, w=3, dtype=np.float64, axis=1) array([[ 60., 60.], [100., 100.], [ 80., 80.], [120., 120.], [160., 160.], [ 80., 80.]])