Metrics library · L1 & L2 order book
Imbalance, top 10 levels, BTC perps, last 24 hours
DELAYED 15 MIN…Updates by itself every 5 minutes
Imbalance, top 10 levels, latest
Above zero means more size on the bid. Watch for venues leaning opposite ways at the same time.
Bid size against ask size across the top 5, 10, 20 and 25 levels of the book.
Multi-depth (5, 10, 20, 25 levels) order book imbalance, ratio, and averages.
The 5m bar from 14:00 to 14:05 UTC on 14 May 2025, Binance BTC-USDT perpetual, from the free preview.
Step 1
Each book snapshot has the top 25 price levels on each side. Each depth sums the size on the top N levels, for N of 5, 10, 20 and 25. Level prices are not used.
Step 2
Each deeper band added more size to the asks than to the bids, so the ratio falls with depth.
Step 3
On average through the bar, the book leaned further to the asks than at the close.
Step 4
BTC-USDT perpetual on Binance, 5m bars, 1 to 31 May 2025, from the free preview.
Average book imbalance against the price move, by depth.
Correlation of each depth's average imbalance with the price move in the same bar and in the next. The top of book alone scored 0.38. For the next bar every depth was near zero, 0.002 at 5 levels and 0.003 at 25.
BTC's book on Binance has a quote on every tick, so 25 levels span $2.50 of price, and top-of-book and 25-level imbalance correlate 0.92. On this book the deeper levels add little. On thinner books 25 levels span more price. This page measures BTC only.
DELAYED 15 MINto 14:50 UTCUpdates by itself every 5 minutes
Highest
Lowest
imbalance_N is bid size minus ask size across the top N levels, and imbalance_ratio_N scales it from -1 to 1. N is 5, 10, 20 or 25.
The _avg fields are the mean over every book snapshot in the interval. The plain fields are the last snapshot.
Compare the top-of-book and deep imbalance. A thin bid at the touch with size behind it means the size sits just below the best bid, not that there are no buyers.
Order book imbalance is arguably the single most validated short-term predictive signal in the market microstructure literature. The intuition is immediate: if there's substantially more resting size on the bid than the ask, the next price move is more likely upward.
Cont, Kukanov & Stoikov (2014) provided the definitive empirical analysis, showing that order book imbalance — defined as:
predicts the direction of the next mid-price change with statistically and economically significant accuracy across multiple equity markets. The signal is monotonic: stronger imbalance produces larger expected price moves, and the relationship is approximately linear.
Their insight was that the imbalance captures the queue dynamics of the limit order book: when one side has substantially more depth, the probability that the opposite side is depleted first (triggering a price change toward the deeper side) increases mechanically.
A single snapshot of imbalance is noisy — market makers continuously refresh quotes, and a momentary asymmetry can be an artifact of staggered updates. Huang & Polak (2011) showed that time-averaged imbalance over longer windows provides a smoother, more predictive signal that captures the sustained directional tilt of the book rather than transient fluctuations.
We compute both:
The divergence between them — how much the closing snapshot differs from the average — itself carries information. A large divergence indicates recent quote instability, suggesting a potential regime change within the bar.
Top-of-book (L1) imbalance captures only the best bid and ask. But Cao, Chen & Griffin (2005) demonstrated that information about future price changes exists at deeper levels of the book. A thin top-of-book bid sitting in front of massive size at deeper levels is structurally different from a thin bid with nothing behind it.
We compute L2 imbalance at cumulative depth tiers: 5, 10, 20, and 25 price levels per side. This captures the full shape of supply-demand imbalance, not just the frontier.
The L1-L2 divergence is the most actionable signal. When L1 shows thin bids but L2 reveals deep bid-side support, the apparent weakness is a mirage — the top-of-book thinness is likely a market maker adjusting inventory, not a genuine absence of demand. Conversely, thick L1 bids with empty L2 behind them indicate a single concentrated quote — remove that one market maker and there's a price gap.
References:
# Install the Aperiodic CLI into ~/.local/bin
mkdir -p "$HOME/.local/bin"
curl -fsSL https://raw.githubusercontent.com/aperiodic-io/cli/main/install.sh | INSTALL_DIR="$HOME/.local/bin" bash
export PATH="$HOME/.local/bin:$PATH"
# Free preview — no API key required
aperiodic l2_imbalance --preview \
--exchange binance-futures \
--symbol perpetual-BTC-USDT:USDT \
--interval 5m \
--timestamp exchange \
--start-date 2025-05-01 \
--end-date 2025-05-31 \
--output-dir ./data && echo "Saved to $PWD/data"