Book Pressure
Quick Reference
| Property | Value |
|---|---|
| Dimension | signal |
| Category | order_flow |
| Version | v0.9.0 (Beta) |
| Output Column | book_pressure |
Book pressure: sum(level_weight * level_imbalance for level in orderbook_levels) - weighted sum across levels
Formula
CDM Inputs
| Column | CDM Table | Description |
|---|---|---|
cdm_lob_snapshot.bids | cdm_* | CDM source table |
cdm_lob_snapshot.asks | cdm_* | CDM source table |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
max_levels | integer [1, 50] | 10 | Maximum number of levels to consider |
weight_decay | float [0.0, 1.0] | 0.9 | Decay factor for level weights (higher levels get lower weights) |
Output
Column: book_pressure
Weighted sum of level imbalances across order book
Market Intuition & Trading Rationale
Book pressure computes a depth-weighted imbalance across order book levels: Σ(level_weight × level_imbalance). Unlike simple depth_imbalance (which weights all levels equally), book pressure applies exponentially decaying weights — the touch (level 1) gets the highest weight, level 10 gets the lowest. This captures an important microstructure reality: imbalance near the mid-price is more predictive of short-term price moves than imbalance deep in the book.
The multi-step computation extracts bid/ask sizes at each level, computes per-level imbalances, generates a decay weight vector, and produces the weighted sum. This is an array-heavy feature — in DolphinDB Community Edition, it requires the consolidated LOB handler pattern (parsing JSON once, computing all LOB features in a single row loop).
Positive book pressure means more bid liquidity than ask liquidity, weighted toward the touch — buyers are positioning aggressively near the mid. Negative means sellers are positioned. The magnitude indicates conviction: strong pressure with tight clustering near the touch is higher quality than weak pressure spread across many levels.
Usage Cases
- Pre-trade direction signal: Positive book_pressure → bullish (more bids near the touch). Trade in the direction of pressure. This is a leading signal — liquidity providers position before aggressive traders arrive.
- Spoofing resistance: Weighted pressure is harder to manipulate than simple depth imbalance. A spoofer placing a large order at level 10 gets minimal weight; genuine positioning at the touch gets maximum weight. The decay weights act as an anti-spoofing filter.
- Execution entry timing: Execute buys when book_pressure is positive — there's ample bid liquidity to absorb your sell. Execute sells when negative. Your passive orders are more likely to fill when resting liquidity is deep on the opposite side.
YAML Definition
name: book_pressure
description: 'Book pressure: sum(level_weight * level_imbalance for level in orderbook_levels)
- weighted sum across levels'
category: order_flow
version: v0.9.0 (Beta)
dimension: signal
status: Pre-release
required_inputs:
- cdm_lob_snapshot.bids
- cdm_lob_snapshot.asks
output_column: book_pressure
output_description: Weighted sum of level imbalances across order book
tags:
- book_pressure
- orderbook
- weighted
- imbalance
- microstructure
- complex
parameters:
max_levels:
type: integer
description: Maximum number of levels to consider
required: false
default: 10
constraints:
min: 1
max: 50
weight_decay:
type: float
description: Decay factor for level weights (higher levels get lower weights)
required: false
default: 0.9
constraints:
min: 0.0
max: 1.0
steps:
- primitive: TRANSFORM
op: array_extract
params:
array: cdm_lob_snapshot.bids
field: size
output_col: bid_sizes
- primitive: TRANSFORM
op: array_extract
params:
array: cdm_lob_snapshot.bids
field: price
output_col: bid_prices
- primitive: TRANSFORM
op: array_extract
params:
array: cdm_lob_snapshot.asks
field: size
output_col: ask_sizes
- primitive: TRANSFORM
op: array_extract
params:
array: cdm_lob_snapshot.asks
field: price
output_col: ask_prices
- primitive: TRANSFORM
op: array_subtract
params:
output_col: level_imbalances
a: cdm_lob_snapshot.bids
b: cdm_lob_snapshot.asks
- primitive: TRANSFORM
op: generate_weights
params:
n_levels: $max_levels
decay: $weight_decay
output_col: level_weights
- primitive: TRANSFORM
op: weighted_sum
params:
values: level_imbalances
weights: level_weights
output_col: book_pressure