Skip to main content

Liquidity Regime Classifier

Quick Reference

PropertyValue
Dimensionregime
Categorymarket_regime
Versionv0.9.0 (Beta)
Output Columnliquidity_regime

Liquidity regime: continuous 0-1 score from normalized spread

Formula

(best_ask_price - best_bid_price) / threshold_high

CDM Inputs

ColumnCDM TableDescription
best_bid_pricecdm_lob_snapshotOrder book snapshot data 鈥?depth levels, bid/ask prices and sizes
best_ask_pricecdm_lob_snapshotOrder book snapshot data 鈥?depth levels, bid/ask prices and sizes

Parameters

ParameterTypeDefaultDescription
threshold_highfloat0.005Spread value mapping to score 1
threshold_lowfloat0.001Spread value mapping to score 0

Output

Column: liquidity_regime

Normalized spread score 0 (tight) to 1 (wide)

Market Intuition & Trading Rationale

Liquidity regime classifier maps the bid-ask spread to a continuous 0鈥? regime score: (ask - bid) / threshold_high. At the default thresholds, a spread of 0.1% (10 bps) or below maps to score 0 (tight liquidity regime); a spread of 0.5% (50 bps) or above maps to score 1 (wide/stressed regime). Scores between 0 and 1 represent intermediate liquidity states.

This is the simplest regime classifier in the library 鈥?a single input (spread), a single output (0鈥? score). Despite (or because of) its simplicity, it's remarkably effective. Spread is the market's most direct liquidity signal: when it's tight, liquidity is abundant; when it widens, liquidity is stressed. The 0鈥? score is designed to be used as a continuous modulator for other signals 鈥?attenuate alpha when the score is high (expensive to trade), amplify when low (cheap to trade).

The threshold parameters should be calibrated per instrument. A 50 bps spread is normal for a small-cap but extreme for a large-cap. Set threshold_high at the instrument's 90th percentile spread and threshold_low at the 10th percentile.

Usage Cases

  • Signal attenuation: Scale directional signals by 1 - liquidity_regime. When liquidity is tight (score 鈮?0), signals pass through at full strength. When liquidity is stressed (score 鈮?1), signals are attenuated 鈥?execution costs would consume the edge.
  • Execution mode selection: score < 0.3 鈫?aggressive execution OK (low cost). 0.3鈥?.7 鈫?moderate (use limit orders). > 0.7 鈫?passive only (spreads too wide for aggressive trading).
  • Regime dimension in feature sets: Used in order_flow_imbalance pack 鈥?the liquidity_regime score modulates OFI signal confidence. Strong OFI in a tight-spread regime is high conviction; strong OFI in a wide-spread regime is less reliable.

YAML Definition

name: liquidity_regime_classifier
description: 'Liquidity regime: continuous 0-1 score from normalized spread'
category: market_regime
version: v0.9.0 (Beta)
dimension: regime
status: Pre-release
required_inputs:
- best_bid_price
- best_ask_price
output_column: liquidity_regime
output_description: Normalized spread score 0 (tight) to 1 (wide)
tags:
- liquidity
- regime
- spread
parameters:
threshold_high:
type: float
description: Spread value mapping to score 1
required: false
default: 0.005
constraints:
min: 0.0
threshold_low:
type: float
description: Spread value mapping to score 0
required: false
default: 0.001
constraints:
min: 0.0
formula: (best_ask_price - best_bid_price) / threshold_high