finmlkit.feature.kit module¶
- class finmlkit.feature.kit.Compose(*transforms: SISOTransform | MISOTransform)[source]¶
Bases:
BaseTransform- property output_name: str¶
Get the output name of the composed transform. The output name is a combination of the first transform’s output and the subsequent transforms’ produces. :return: Output name
- class finmlkit.feature.kit.Feature(transform: BaseTransform)[source]¶
Bases:
objectWraps a BaseTransform and enables mathematical operations between features.
- apply(func, *args, suffix=None, **kwargs)[source]¶
Apply an arbitrary function to the output of this feature.
- Parameters:
func – The function to apply to the feature output
args – Additional positional arguments to pass to the function
suffix – Optional suffix to add to the feature name (default is function name)
kwargs – Additional keyword arguments to pass to the function
- Returns:
A new Feature with the function applied
- clip(lower=None, upper=None)[source]¶
Clip the values of the feature between lower and upper bounds.
- Parameters:
lower – Lower boundary (optional)
upper – Upper boundary (optional)
- Returns:
A new Feature with clipped values
- ema(span, adjust=True)[source]¶
Calculate the Exponential Moving Average (EMA) of the feature.
- Parameters:
span – Span for the EMA calculation
adjust – Whether to adjust the EMA calculation (default is True)
- Returns:
A new Feature with EMA values
- lag(period)[source]¶
Create a lagged version of the feature.
- Parameters:
period – Number of periods to lag
- Returns:
A new Feature with lagged values
- static max(a, b)[source]¶
Calculate the element-wise maximum between two features.
- Parameters:
a – First feature or scalar
b – Second feature or scalar
- Returns:
A new Feature containing the element-wise maximum
- static min(a, b)[source]¶
Calculate the element-wise minimum between two features.
- Parameters:
a – First feature or scalar
b – Second feature or scalar
- Returns:
A new Feature containing the element-wise minimum
- property name¶
Get the output name from the wrapped transform
- rolling_mean(window)[source]¶
Calculate the rolling mean of the feature.
- Parameters:
window – Rolling window size
- Returns:
A new Feature with rolling mean values
- rolling_std(window)[source]¶
Calculate the rolling standard deviation of the feature.
- Parameters:
window – Rolling window size
- Returns:
A new Feature with rolling std values