Skip to main content

Queue Position Imbalance

Quick Reference

PropertyValue
Dimensionsignal
Categoryorder_flow
Versionv0.9.0 (Beta)
Output Columnqueue_position_imbalance

Queue position adjusted order book imbalance with position weighting

Formula

CDM Inputs

ColumnCDM TableDescription
best_bid_sizecdm_*CDM source table
best_ask_sizecdm_*CDM source table

Parameters

ParameterTypeDefaultDescription
position_weightslist[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]Position weights (closer to mid price = higher weight)
normalization_windowinteger [10, 1000]100Window for z-score normalization

Output

Column: queue_position_imbalance

Normalized queue position weighted order book imbalance

Market Intuition & Trading Rationale

Queue position imbalance computes a position-weighted order book imbalance, normalized via rolling z-score. Unlike simple depth_imbalance (which weights all shares equally), queue position weights each share by its proximity to the front of the queue — the first share in line gets the highest weight, the last gets the lowest. This captures a critical microstructure reality: the marginal share at the front of the queue is more informative than the marginal share at the back.

The multi-step computation extracts sizes at each level, computes per-level imbalance ratios, applies position-based weights, and normalizes via rolling z-score. The default position weights (10 down to 1) heavily favor the touch. This makes queue_position_imbalance more responsive than depth_imbalance — it reacts faster to changes at the front of the queue while being less influenced by deep-book positioning.

The rolling z-score normalization makes this feature self-calibrating. A value of +2 means the current queue imbalance is two standard deviations above its recent mean — statistically significant buying pressure at the front of the queue.

Usage Cases

  • Micro-price prediction: queue_position_imbalance predicts short-term mid-price moves more accurately than raw depth_imbalance because it focuses on the most informative part of the book (the front of the queue). Trade in the direction of significant (|z| > 1) imbalances.
  • HFT signal: The position weighting makes this feature responsive enough for HFT — changes at the touch propagate immediately into the signal. Use for sub-second directional predictions.
  • Adverse selection detection: When queue_position_imbalance is strongly positive but price is falling, informed sellers may be absorbing the bid-side liquidity. The imbalance shows buying support, but it's being consumed — a bearish divergence.

YAML Definition

name: queue_position_imbalance
description: Queue position adjusted order book imbalance with position weighting
category: order_flow
version: v0.9.0 (Beta)
dimension: signal
status: Pre-release
required_inputs:
- best_bid_size
- best_ask_size
output_column: queue_position_imbalance
output_description: Normalized queue position weighted order book imbalance
tags:
- orderbook
- lob
- imbalance
- microstructure
- array
- advanced
parameters:
position_weights:
type: list
description: Position weights (closer to mid price = higher weight)
required: false
default:
- 10
- 9
- 8
- 7
- 6
- 5
- 4
- 3
- 2
- 1
normalization_window:
type: integer
description: Window for z-score normalization
required: false
default: 100
constraints:
min: 10
max: 1000
steps:
- primitive: TRANSFORM
op: array_extract
params:
array: best_bid_size
field: size
output_col: best_bid_size
- primitive: TRANSFORM
op: array_extract
params:
array: best_ask_size
field: size
output_col: best_ask_size
- primitive: TRANSFORM
op: array_elementwise_divide
params:
numerator:
op: sub
a: bid_sizes
b: ask_sizes
denominator:
op: add
a: bid_sizes
b: ask_sizes
output: imbalance_per_level
- primitive: TRANSFORM
op: array_wavg
params:
array: imbalance_per_level
weights: $position_weights
output: weighted_imbalance
- primitive: WINDOW
op: rolling_zscore
params:
window: $normalization_window
a: weighted_imbalance
output: queue_position_imbalance