client.depth_metrics() when you need derived liquidity metrics for market impact estimation and liquidity analysis. This method calculates depth, spread, imbalance, and slippage metrics from order book data.
Method signature
Parameters
Return value
A single-pass iterator of metric dictionaries by default, flat PyArrow batches withoutput="batches", or a Pandas DataFrame with output="dataframe".
Example response
Fields
Depth metrics records include:timestamp: observation time in UTC milliseconds; columnar output is timezone-aware UTCsource: source identifiermarket: normalized market IDsymbol: venue-native, human-friendly symbolspread: absolute bid-ask spreadspread_bps: spread in basis pointsbid_depth: total bid volume withindepth_pctof midask_depth: total ask volume withindepth_pctof midbid_ask_imbalance: (bid_depth - ask_depth) / (bid_depth + ask_depth)slippage_bps: estimated slippage in basis points forslippage_notionalsize
bid_ask_imbalance indicates more depth on bids (buy pressure), negative indicates more depth on asks (sell pressure).
Example
How it works
client.depth_metrics() derives liquidity metrics from order book snapshots
using snapshot-first replay. See
Snapshots for the full flow.
Related documentation
- L2 snapshots for raw order book data
- BBO if you only need top-of-book quotes
- Events if you need order book updates mixed with other event types
- Quickstart