finmlkit.feature.core.reversion module

Implements mean reversion features.

finmlkit.feature.core.reversion.vwap_distance(close: ndarray[tuple[int, ...], dtype[float64]], volume: ndarray[tuple[int, ...], dtype[float64]], n_periods: int, is_log: bool) ndarray[tuple[int, ...], dtype[float64]][source]

Calculate the distance of the current price from the VWAP (Volume Weighted Average Price). The VWAP is calculated over a specified number of periods, and the distance is expressed as a percentage. :param close: close price series :param volume: corresponding volume series :param n_periods: number of periods to calculate VWAP :param is_log: if True, calculate log distance :return: array of distances from VWAP