Skip to main content

resample_nb

resample_nb(
    close: numpy.ndarray,
    index: numpy.ndarray,
    freq: numpy.timedelta64,
) ‑> numpy.ndarray
Resample financial data to a specified frequency using a Numba-compiled function. This function utilizes Numba’s Just-in-Time (JIT) compilation to optimize performance for resampling time series data, keeping the last value within each resampling period. Parameters:
NameTypeDefaultDescription
closetp.Array2d--A 2-dimensional array of asset closing prices, where rows represent time and columns represent assets.
indextp.Array1d--A 1-dimensional array of datetime values corresponding to the time index of close.
freqnp.timedelta64--A Numpy timedelta64 object representing the desired frequency for resampling. For example, np.timedelta64(1, 'D') for daily data, np.timedelta64(1, 'W') for weekly, etc.
Returns:
TypeDescription
tp.Array2dA 2-dimensional array of resampled closing prices, with rows corresponding to the resampled time periods and columns to the assets.

resample

resample(
    data: vectorbtpro.data.base.Data,
    freq: str,
    **kwargs,
) ‑> vectorbtpro.data.base.Data
Reasample data. Parameters:
NameTypeDefaultDescription
datavbt.Data--Data object.
freqstr--Frequency. kwargs Feed dt.date_range. See vectorbtpro.
Returns:
TypeDescription
vbt.DataResampled vbt Data object.