Back to Research
Microstructure September 20, 2026 • 8 min read

How One-Sided Is the Tape? Measuring Order Flow with Entropy

Two order books can print the same volume in a minute and mean opposite things: balanced two-way trade, or one long one-sided rush. Shannon entropy turns “how lopsided is the order flow?” into a single, comparable number.

Two order books can print the same volume in a minute and mean opposite things. In one, buyers and sellers trade back and forth, roughly matched — noise, two-way, no one in a hurry. In the other, the same volume is one long rush of buys lifting every offer. The tape looks equally busy; the second is informed, directional, and dangerous to stand in front of. “How much traded?” misses it entirely. The question is how one-sided the flow was — and information theory has measured exactly that since 1948.

1. Shannon entropy in a paragraph

Entropy measures how spread out a distribution is. Split activity into categories — buys versus sells, or volume across price buckets — and take the proportions. When they are even, entropy is at its maximum: maximum uncertainty about where the next unit lands. When one category dominates, entropy falls toward zero: the outcome is nearly certain. That single number captures “balanced vs lopsided” without any model of why.

H = − Σ pᵢ · log₂ pᵢ

2. Sign entropy: the buy/sell balance

Point it at trade signs — +1 for a buy, −1 for a sell — and entropy becomes a clean imbalance gauge. Perfectly balanced flow (half buys, half sells) scores 1; as one side takes over, the score slides toward 0. A reading well under 1 says the tape is directional right now, which is precisely the condition in which resting liquidity gets run over and quotes should widen.

3. Normalized entropy: comparing apples to apples

Raw entropy depends on how many categories you used — five price buckets can hold more entropy than two. Dividing by the maximum possible (the log of the number of categories) rescales it to a clean 0-to-1 number, so you can compare a two-venue split against a ten-bucket depth profile on the same axis: 0 means all the volume sat in one bucket, 1 means it was perfectly even.

4. Where it fits: VPIN, OFI, and toxicity

Entropy is deliberately model-free, which makes it a good complement to the sharper tools. VPIN estimates flow toxicity from volume-bucketed order imbalance; order-flow imbalance reads directional pressure at the book. Entropy adds a fast, assumption-light summary of concentration — a single number for how far the current flow sits from balanced — that you can compute per window and watch for regime shifts.

5. Computing it

Our open-source orderflow-metrics library ships all three, dependency-free, in TypeScript and Python:

import { signEntropy, shannonEntropy, normalizedEntropy } from "orderflow-metrics";

// trade signs over a window (+1 buy, -1 sell) — buy-dominated
const signs = [1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1];
signEntropy(signs);        // 0.811  — below 1.0: the flow is lopsided toward buys

// entropy of volume spread across venues / price buckets
const volume = [120, 80, 60, 30, 10];
shannonEntropy(volume);    // 1.997 bits
normalizedEntropy(volume); // 0.860  — 0 = all in one bucket, 1 = perfectly even

The Python distribution exposes the same functions (sign_entropy, shannon_entropy, normalized_entropy). They sit in the order-flow corner of the market-microstructure toolkit, next to VPIN and OFI — install from our open-source page (npm and PyPI, MIT-licensed).

6. Conclusion

Volume tells you how much traded; entropy tells you how evenly — and in microstructure, evenness is the signal. A high reading is calm two-way flow; a low one is a one-sided push that eats liquidity and moves price. As a model-free companion to VPIN and OFI, order-flow entropy turns “the tape feels lopsided” into a number you can threshold. Explore the rest of the toolkit in our quantitative research library, or read the implementation on our open-source page.

For more on market efficiency, regime diagnostics, and open-source tooling, visit our official resources:

🧩 Open Source 💻 orderflow-metrics on GitHub 📚 More Research