Highlighted Metrics
L1 — Top of Book Datasets
Best bid and ask prices with quantities, midprice, quantity-weighted midprice, time/volume-weighted averages, and quote update frequency.
Key fields
Bid/ask imbalance, ratio, percentages — both instantaneous (last) and averaged over the interval.
Key fields
L2 — Order Book Datasets
Multi-depth (5, 10, 20, 25 levels) order book imbalance, ratio, and averages.
Key fields
Think of the order book as two lines at a checkout: one side wants to buy, the other wants to sell. The price is set by whoever is at the front of each line. When buyers start piling up faster than sellers, the price moves up and you can see that coming before it happens.
Depth is how many people are standing in line behind the front. A long line means a big order won't shift the price much. A short line means one large trade can send the price flying. A book that looks full at the top but empty underneath is the most dangerous — it feels safe until it isn't.
The spread is the price of immediacy — what the market maker charges to bear adverse selection risk right now. Huang & Stoll (1997) decomposed it into adverse selection, inventory, and order processing costs, which is why a widening spread is diagnostic, not just expensive. But the average hides the regime change: a bar with mean spread of 2 bps that was 0.5 bps for 55 seconds and 8 bps for 5 seconds tells a fundamentally different story than a steady 2 bps. Bollerslev & Melvin (1994) showed spread volatility itself predicts future return volatility — the instability of the spread matters as much as its level.
Cont, Kukanov & Stoikov (2014) showed it clearly: order book imbalance predicts the direction of the next mid-price change, and the relationship is monotonic — stronger lean, larger expected move. The mechanism is straightforward. When one side is substantially thicker, the thinner side depletes first and the midpoint shifts. But the real insight is in the layers. L1 and L2 can tell contradictory stories, and the divergence between them is often more informative than either alone.
Use Cases
Use average and instantaneous spread metrics to quantify market-making costs and estimate fill quality across instruments.
Measure aggregate bid and ask depth at multiple levels to understand resilience and liquidity beyond the top-of-book.
Detect directional pressure from top-of-book imbalance dynamics and build predictive features from multi-level imbalance ratios that capture it more robustly.
Detect large resting orders by monitoring depth anomalies and imbalance dynamics across book levels over time.
Quantify how quickly liquidity replenishes after consumption by analyzing depth averages and their variability.
Identify quote stuffing patterns and measure market-maker activity intensity using update frequency metrics.
Compare execution fills against bid/ask VWAP and TWAP to measure adverse selection in your order flow.
Combine weighted mid-price, imbalance averages, and bid/ask depth at 5, 10, 20, 25 levels into composite signals for HFT, market-making, and ML-based alpha strategies.
Get started in minutes
pip install aperiodicfrom datetime import date
from aperiodic import get_metrics
df = get_metrics(
api_key="your-api-key",
metric="flow",
timestamp="exchange",
interval="1h",
exchange="binance-futures",
symbol="perpetual-BTC-USDT:USDT",
start_date=date(2024, 1, 1),
end_date=date(2024, 1, 31),
)
print(df.head())Get access to our full catalog of market microstructure data.