Skip to main content

Rolling Average Depth

Quick Reference

PropertyValue
Dimensionregime
Categoryorder_flow
Versionv1.0
Output Columnavg_depth

Rolling average of total order book depth 鈥?measures baseline liquidity

Formula

rolling_mean((best_bid_size + best_ask_size), window)

CDM Inputs

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

Parameters

ParameterTypeDefaultDescription
windowinteger300000Window for rolling average

Output

Column: avg_depth

Rolling mean of total depth

Market Intuition & Trading Rationale

Rolling average depth measures the baseline liquidity level: rolling_mean(bid_size + ask_size, window). This is the smoothed, expected depth 鈥?what a trader should expect to find at the touch under normal conditions. Deviations from this baseline (sudden depth drops) are more informative than the absolute level. Use this as the "normal" reference; compare current depth against it to detect anomalies.

Usage Cases

  • Depth anomaly detection: Current depth < 0.5 脳 rolling_average_depth 鈫?significant liquidity withdrawal. Investigate for stress or informed positioning.
  • Execution sizing baseline: Use rolling_average_depth as the expected depth for order sizing. Size orders as a fraction of this baseline to avoid outsized impact.
  • context: Used in depth_imbalance and liquidity_stress packs 鈥?provides the baseline against which depth deviations are measured.

YAML Definition

name: rolling_average_depth
description: Rolling average of total order book depth 鈥?measures baseline liquidity
category: order_flow
dimension: regime
version: v0.9.0 (Beta)
required_inputs:
- best_bid_size
- best_ask_size
output_column: avg_depth
output_description: Rolling mean of total depth
tags:
- regime
- liquidity
- depth
parameters:
window:
type: integer
description: Window for rolling average
required: false
default: 300000
formula: rolling_mean((best_bid_size + best_ask_size), window)