Skip to main content

Features

Features sit one layer above indicators. They usually combine, re-express, lag, or contextualize price and volume information into model-ready signals or regime flags.

Use this page when you need to choose between feature helpers, understand their input requirements, or see what each helper adds to a frame. For lower-level signal primitives, see Indicators.

Conventions

  • Feature helpers usually append columns and return the original frame with the extra outputs attached.
  • Some helpers operate on plain kline data only. Others require trade-derived columns such as maker_ratio, no_of_trades, price, or quantity.
  • Not every helper is intended as a final predictor. Some are utilities used to build targets or wider feature families.
  • Several regime helpers output compact categorical-style columns such as regime_ma_slope or regime_price_band.
  • A few helpers return scalar values instead of frames. The main example is find_min_d, which searches for a stationarity-preserving fractional-differentiation order.

Quick Example

from limen.data import HistoricalData
from limen.experiment import Manifest
from limen.features import kline_imbalance, vwap
from limen.indicators import atr, roc
from limen.sfd.reference_architecture import logreg_binary


def manifest():
return (
Manifest()
.set_data_source(
method=HistoricalData.get_spot_klines,
params={'kline_size': 3600, 'start_date_limit': '2025-01-01'},
)
.set_test_data_source(method=HistoricalData._get_data_for_test)
.set_split_config(8, 1, 2)
.add_indicator(roc, period='roc_period')
.add_indicator(atr, period=14)
.add_feature(vwap)
.add_feature(kline_imbalance, window='imbalance_window')
.with_model(logreg_binary)
)

Kline-Derived Position And Volatility Features

These helpers work directly on bar data and are usually the easiest feature layer to add to a first manifest.

FunctionAdds by defaultNotes
atr_percent_smaatr_percent_smaATR scaled by close price using SMA smoothing.
atr_smaatr_smaSMA-smoothed ATR variant.
close_positionclose_positionClose location inside the current bar's high-low range.
distance_from_highdistance_from_highDistance from a rolling high.
distance_from_lowdistance_from_lowDistance from a rolling low.
gap_highgap_highCurrent high relative to the previous close.
price_range_positionprice_range_positionRolling range position over a wider window.
range_pctrange_pctCurrent bar range as a percentage.
trend_strengthtrend_strengthFast-versus-slow trend strength summary.
volume_regimevolume_regimeVolume context over a lookback window.
vwapvwapRequires a datetime-like datetime column because VWAP resets by trading day.

Breakout And Regime Features

These helpers are useful when you want state or structure, not just a continuous numeric series.

FunctionAdds by defaultNotes
breakout_featuresmany lagged breakout columns plus long_roll_mean, long_roll_std, short_roll_mean, short_roll_std, roc_long_12_1, roc_short_12_1Designed to enrich pre-existing breakout flags.
breakout_percentile_regimeprice_range_position, regime_breakout_pctUses percentile thresholds over price-range position.
ema_breakoutbreakout_emaRequires target_col; flags price displacement from EMA beyond breakout_delta.
hh_hl_structure_regimeregime_hh_hlCaptures higher-high and higher-low style structure.
ichimoku_cloudtenkan, kijun, senkou_a, senkou_b, chikouFull Ichimoku feature set.
ma_slope_regimeregime_ma_slopeRegime label based on moving-average slope.
price_vs_band_regimeregime_price_bandUses price distance relative to a band definition.
sma_crossovercrossover, signalCompact crossover-state helper.
window_return_regimeret_24, regime_window_returnReturn plus regime thresholding over a window.

Lag Helpers And Threshold Utilities

These helpers are mainly used to expand existing columns or define cutoffs for target construction.

FunctionAdds or returnsNotes
lag_columnone lagged column such as close_lag_2Requires col and lag.
lag_columnsone lag per listed columnRequires cols and lag.
lag_rangea lag range such as close_lag_1 through close_lag_3Requires col, start, and end.
lag_range_colsa lag range for each listed columnRequires cols, start, and end.
compute_quantile_cutoffscalar cutoff valueUtility helper, not a DataFrame transform.
quantile_flagquantile_flagCommonly used in targets after computing the cutoff on train only.

Stationarity And Long-Memory Helpers

These helpers are useful when you want to reduce non-stationarity while preserving more long-memory structure than a simple first difference would.

FunctionAdds or returnsNotes
fractional_diffone *_fracdiff column per selected input columnApplies fixed-width fractional differentiation. Original columns are preserved.
find_min_dscalar d valueIterates over candidate orders and uses the Augmented Dickey-Fuller test to find the smallest stationary order.

Two practical details matter:

  • fractional_diff needs cols=[...] and writes new columns such as close_fracdiff.
  • if one split is too short to produce the same fractional-diff column as another split, Manifest now drops that extra column during split alignment so the final data_dict stays consistent.

Trade-Shape And Microstructure Features

These helpers need richer data than ordinary OHLCV bars.

FunctionAdds by defaultNotes
kline_imbalanceimbalanceRequires maker_ratio and no_of_trades. Useful when those were carried through data retrieval or bar formation.
conserved_flux_renormalizationsynthetic OHLCV plus value_sum, vwap, flux_rel_std_mean, flux_rel_std_var, entropy_mean, entropy_var, Δflux_rms, Δentropy_rmsWorks on trade-level datetime, price, and quantity, then rolls those into kline-aligned diagnostics.

Choosing Between Indicators And Features

  • Use an indicator when you want a direct market calculation such as RSI, ATR, or MACD.
  • Use a feature when you want structure around those signals, such as lags, regimes, relative position, or multi-step aggregation.
  • Use the lag helpers when the main value is temporal context rather than a new market calculation.
  • Use compute_quantile_cutoff and quantile_flag when the target boundary itself is part of the split-safe training logic.
  • Use fractional_diff when stationarity itself is part of the design problem, not just a preprocessing afterthought.
  • Indicators for lower-level signal primitives
  • Transforms for target shaping and post-model calibration helpers
  • Experiment Manifest for how features plug into the split-first manifest pipeline
  • Utilities for the exported adf_test() helper that find_min_d builds on