Skip to content
Finance
Skill

/feature-engineering

Feature construction from market data for ML trading models including price, volume, on-chain, and microstructure features

From plugin
trading-skills
58868 skills

Claude Code

$ npx -y skills add agiprolabs/claude-trading-skills --skill feature-engineering --agent claude-code

SKILL.md

feature-engineering.SKILL.md
name: feature-engineering
description: Feature construction from market data for ML trading models including price, volume, on-chain, and microstructure features

Feature Engineering for Trading ML

Feature engineering is the single highest-leverage activity in building ML trading models. Model selection (XGBoost vs. neural net vs. logistic regression) matters far less than the quality and diversity of input features. A simple model on great features will outperform a complex model on raw prices every time.

This skill covers constructing, validating, and selecting features from market data for use in classification (signal-classification) and regression models targeting crypto/Solana token trading.

Why Features Beat Models

Raw OHLCV data is non-stationary, noisy, and high-dimensional. Models trained directly on price series will overfit. Feature engineering transforms raw data into stationary, informative signals that capture distinct aspects of market behavior:

  • **Compression**: Reduce thousands of price bars to dozens of descriptive statistics
  • **Stationarity**: Convert non-stationary prices into stationary returns and ratios
  • **Domain knowledge**: Encode trader intuition (support/resistance, volume climax)

as computable quantities

  • **Regime awareness**: Features that behave differently in trending vs. ranging

markets help models adapt

Feature Categories

1. Price Features

Derived purely from OHLCV price columns. These capture trend, momentum, and volatility from the price series itself.

| Feature | Formula | Lookback | |---------|---------|----------| | `log_return` | `ln(close_t / close_{t-1})` | 1 bar | | `abs_return` | `abs(log_return)` | 1 bar | | `return_volatility` | `std(log_return, N)` | 20 bars | | `momentum_N` | `close_t / close_{t-N} - 1` | 5, 10, 20 | | `acceleration` | `momentum_5 - momentum_5[5]` | 10 bars | | `high_low_range` | `(high - low) / close` | 1 bar | | `close_position` | `(close - low) / (high - low)` | 1 bar | | `gap` | `open_t / close_{t-1} - 1` | 1 bar | | `rolling_skew` | `skew(log_return, N)` | 20 bars | | `rolling_kurtosis` | `kurtosis(log_return, N)` | 20 bars |

2. Volume Features

Volume confirms or contradicts price movements. Divergences between price and volume are among the most reliable signals in short-term trading.

| Feature | Formula | Lookback | |---------|---------|----------| | `volume_ratio` | `volume_t / mean(volume, N)` | 20 bars | | `volume_ma_ratio` | `sma(volume, 5) / sma(volume, 20)` | 20 bars | | `obv_slope` | `slope(OBV, N)` | 10 bars | | `vwap_deviation` | `(close - VWAP) / VWAP` | intraday | | `volume_acceleration` | `volume_ratio_t - volume_ratio_{t-1}` | 21 bars | | `buy_volume_ratio` | `buy_volume / total_volume` | 1 bar | | `dollar_volume` | `close * volume` | 1 bar | | `volume_cv` | `std(volume, N) / mean(volume, N)` | 20 bars |

3. Technical Features

Standard technical indicators computed via `pandas-ta`. Use the `pandas-ta` skill for full parameter documentation.

| Feature | Source | Lookback | |---------|--------|----------| | `rsi` | RSI(14) | 14 bars | | `macd_histogram` | MACD(12,26,9) histogram | 33 bars | | `bb_position` | `(close - BB_lower) / (BB_upper - BB_lower)` | 20 bars | | `bb_width` | `(BB_upper - BB_lower) / BB_mid` | 20 bars | | `atr_ratio` | `ATR(14) / close` | 14 bars | | `adx` | ADX(14) | 14 bars | | `stoch_k` | Stochastic %K(14,3) | 14 bars | | `cci` | CCI(20) | 20 bars | | `mfi` | MFI(14) | 14 bars | | `supertrend_direction` | Supertrend direction (+1/-1) | 10 bars |

4. Microstructure Features

Derived from trade-level data (individual swaps/transactions). Require on-chain or DEX API data.

| Feature | Description | |---------|-------------| | `trade_count_ratio` | Trades this bar / avg trades per bar | | `avg_trade_size` | Mean trade size in USD | | `large_trade_pct` | % of volume from trades > $10k | | `unique_traders` | Count of distinct wallet addresses | | `buy_count_ratio` | Buy trades / total trades | | `trade_size_entropy` | Shannon entropy of trade size distribution |

5. On-Chain Features

Derived from blockchain state changes. Require Helius or Solana RPC data.

| Feature | Description | |---------|-------------| | `holder_count_change` | Change in unique holders over N periods | | `whale_net_flow` | Net tokens moved by top-10 holders | | `token_velocity` | Transfer volume / circulating supply | | `liquidity_change` | Change in DEX liquidity pool TVL |

6. Cross-Asset Features

Capture relationships between the target token and broader market.

| Feature | Description | |---------|-------------| | `sol_correlation` | Rolling correlation with SOL price | | `btc_beta` | Rolling beta to BTC returns | | `sector_momentum` | Average return of tokens in same sector |

7. Time Features

Cyclical encoding of calendar time. Use sin/cos encoding to preserve cyclical continuity (hour 23 is close to hour 0).

import numpy as np

hour_sin = np.sin(2 * np.pi * hour / 24)
hour_cos = np.cos(2 * np.pi * hour / 24)
day_of_week = np.sin(2 * np.pi * day / 7)

Stationarity

**Non-stationary features will cause your model to fail on new data.** A feature is stationary if its statistical properties (mean, variance) don't change over time.

Testing for Stationarity

Use the Augmented Dickey-Fuller (ADF) test:

from scipy.stats import adfuller

result = adfuller(feature_series.dropna())
p_value = result[1]
is_stationary = p_value < 0.05

Making Features Stationary

| Non-Stationary | Stationary Transform | |----------------|---------------------| | Price | Log return | | Volume | Volume ratio (vol / avg vol) | | OBV | OBV slope (regression coefficient) | | Holder count | Holder count change | | RSI | Already stationary (bounded 0-100) | | Dollar volume | Dollar volume / rolling mean |

**Rule**: If a feature trends upward or downward over time, it is non-stationary. Transform it into a ratio, difference, or rate of

Read more
@agiprolabs
Ships withtrading-skills

A comprehensive collection of 68 ready-to-use trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools.

Stars on GitHub

Momentum

stars in total
588
Star history of agiprolabs/claude-trading-skills on GitHub, a chart by star-history.com

Other skills on trading-skills.

coingecko-api

coingecko-api

Broad crypto market data from CoinGecko covering 13,000+ tokens. Global market stats, historical price data going back years,…

More skills from other plugins.

ccxt-cli

ccxt-cli

CCXT command-line interface (ccxt-cli) for interacting with 100+ cryptocurrency exchanges directly from the terminal — no code…

ccxt2w45k
@ccxt@ccxtInstall Skill

Questions about feature-engineering.

Which coding agents can use feature-engineering?
feature-engineering installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.