Skip to main content
Use 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 with output="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 UTC
  • source: source identifier
  • market: normalized market ID
  • symbol: venue-native, human-friendly symbol
  • spread: absolute bid-ask spread
  • spread_bps: spread in basis points
  • bid_depth: total bid volume within depth_pct of mid
  • ask_depth: total ask volume within depth_pct of mid
  • bid_ask_imbalance: (bid_depth - ask_depth) / (bid_depth + ask_depth)
  • slippage_bps: estimated slippage in basis points for slippage_notional size
Positive 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.
  • 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