finmlkit.feature.core.momentum module¶
- finmlkit.feature.core.momentum.roc(price: ndarray[tuple[int, ...], dtype[_ScalarType_co]], period: int) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]¶
Calculate the Rate of Change (ROC) feature.
- Parameters:
price – np.array, an array of prices.
period – int, the period over which to calculate ROC.
- Returns:
np.array, ROC values.
- finmlkit.feature.core.momentum.rsi_wilder(close: ndarray[tuple[int, ...], dtype[float64]], window: int) ndarray[tuple[int, ...], dtype[float64]][source]¶
Calculate the Relative Strength Index (RSI) using Wilder’s smoothing method. :param close: A one-dimensional numpy array of closing prices. :param window: The number of periods to use for the RSI calculation, default is 14. :return: A one-dimensional numpy array of RSI values, same length as close.
- finmlkit.feature.core.momentum.stoch_k(close: ndarray[tuple[int, ...], dtype[float64]], low: ndarray[tuple[int, ...], dtype[float64]], high: ndarray[tuple[int, ...], dtype[float64]], length: int) ndarray[tuple[int, ...], dtype[float64]][source]¶
Calculate the Stochastic Oscillator %K value.
- Parameters:
close – A one-dimensional numpy array of closing prices
low – A one-dimensional numpy array of low prices
high – A one-dimensional numpy array of high prices
length – The lookback period for the stochastic calculation
- Returns:
A one-dimensional numpy array of %K values, same length as input arrays