API Depth Level Aggregation Guide for Order Books
Aggregate bid and ask levels from Polymarket and Binance order book snapshots to compute depth, imbalance, spread, and slippage features.
Depth level aggregation turns raw bid and ask ladders into features a backtest can use. Instead of only storing every level, you can compute total depth near mid, imbalance, weighted mid price, and expected slippage.
Useful Aggregations
- Total bid depth within 1%, 2%, or 5% of mid
- Total ask depth within the same bands
- Bid/ask imbalance ratio
- Depth-weighted mid price
- Estimated market order slippage by notional size
Why It Matters
Raw snapshots are powerful, but models usually need stable features. Aggregated depth lets you compare Polymarket and Binance liquidity across many markets and timestamps without manually inspecting every ladder.