At 10:07:03, a sell order for 50,000 shares touches the bid and walks through five price levels. The order completes, but the average fill is 31 basis points below the price displayed one second earlier. Nothing went wrong with the exchange, the broker, or the order router. The stock simply did not have enough resting liquidity to absorb that order at the displayed price.

This failure mode is more common than most retail execution models assume. A chart can show a tradable price, a broker can display sufficient buying power, and an order can still receive materially worse fills when the order exceeds the depth actually available. The distinction is especially important in thin equities, volatile small caps, crowded openings, and fast markets where resting orders disappear within milliseconds.

For technical traders, “the market is liquid” is not a complete description. Liquidity is a set of measurable properties—immediate availability, depth, breadth, elasticity, resilience, and implementation shortfall—that determine whether an order can be executed at the expected price. This article defines those properties, connects them to order-book behavior, and provides production-grade Python for calculating executable liquidity metrics from real-time depth events.

1. The Mistake Behind “Liquidity Is Good”

The word liquidity compresses several different questions into one. A market can offer a tight spread but have very little size behind the best quote. It can display large orders at the best level that vanish when a competitor approaches. It can contain substantial resting depth that replenishes quickly after a shock, or depth that takes minutes to recover.

These are not interchangeable properties. They lead to different execution outcomes.

Property Core question Typical metric Practical implication
Immediate liquidity Can the order trade now? Spread, top-of-book size Determines the minimum entry cost
Depth How much size is available near the mid? Bid and ask notional within N levels Estimates how much can trade without consuming multiple levels
Breadth How far does liquidity extend? Number of levels and price range Indicates whether the book is narrow or distributed
Elasticity How much price moves for a given order size? Price impact per unit of executed size Estimates execution cost as participation rises
Resilience How quickly does liquidity recover? Recovery time and replenishment ratio Measures stability after cancellation or shocks
Execution quality What did the order actually receive? Implementation shortfall Connects observable liquidity to realized trading cost

A useful working definition is:

Liquidity is the market’s capacity to absorb an order with limited price concession, low delay, and predictable execution cost.

That definition contains an important condition: limited price concession. Liquidity is not about how many shares a broker says you may buy. It is about how much depth exists, how that depth responds, and how much of the quoted price survives after execution costs.

A Synthetic Market Snapshot

The following snapshot illustrates why a single metric cannot describe liquidity. The numbers are synthetic and serve only as a controlled example.

Property Instrument A Instrument B Instrument C
Spread 1.2 bps 18.0 bps 7.5 bps
Top-level bid notional $1.8M $80K $420K
Ten-level bid notional $12.4M $0.9M $3.1M
Ten-level ask notional $11.9M $0.6M $0.7M
Buy/sell pressure ratio 1.04 1.50 4.43
Estimated 50K-share buy cost 3.8 bps 41.0 bps 28.5 bps
Depth recovery after 20% cancellation 0.8 seconds 12.0 seconds 7.4 seconds

Instrument A supports the order with little price impact. Instrument B has a narrow absolute spread but very little size. Instrument C displays an apparently favorable imbalance, yet the imbalance reflects thin ask-side depth that disappears quickly when participation increases.

A trader who looks only at the spread chooses B as the most liquid instrument. A trader who looks only at the imbalance chooses C. An execution model that consumes the book selects A.

2. Depth, Breadth, and Elasticity

2.1 Depth measures the amount of available size

Depth answers a narrow question: how much quantity is available within a defined distance from the midpoint?

For (N) bid levels:

[
D_N^{bid} = \sum_{i=1}^{N} q_i^{bid} p_i^{bid}
]

For (N) ask levels:

[
D_N^{ask} = \sum_{i=1}^{N} q_i^{ask} p_i^{ask}
]

The calculation can use:

  • Share depth: the sum of order quantities.
  • Notional depth: the sum of price multiplied by quantity.
  • Base-currency depth: volume expressed in the instrument’s underlying currency.
  • Quote-currency depth: volume expressed in the currency used to pay for the asset.

These measures answer different questions. Share depth is useful for execution capacity. Notional depth is usually more appropriate for comparing instruments with different prices. Volume-weighted depth is better for estimating the average cost of consuming the book.

Depth must also have a boundary. “There is $20 million of depth” is incomplete unless the reader knows the price range over which that depth exists and how much of it is likely to be canceled before the order arrives.

2.2 Breadth measures the distribution of liquidity

Breadth describes how far the order book extends across price levels. A simple breadth measure is the number of populated levels:

[
B_N = \min(n_{bid}, n_{ask})
]

A price-based measure is more informative:

[
W_N = p_N^{ask} - p_N^{bid}
]

A broad book can absorb an order through multiple levels without a sharp discontinuity in price. A narrow book may display the same aggregate depth while concentrating it in a small price interval.

Breadth also affects robustness. When quotes update frequently, the number of visible levels can change even when total notional remains stable. A tracker should therefore preserve both the level count and the underlying quantities.

2.3 Elasticity measures the response to consumption

Elasticity describes how price reacts when an order consumes available depth. One practical proxy is the average price concession required to execute a fixed quantity:

[
E(Q) = \frac{VWAP(Q) - M}{M} \times 10{,}000
]

where (M) is the decision-time midpoint and (VWAP(Q)) is the volume-weighted average fill obtained by walking the book.

For a sell order, the sign is reversed so that positive values consistently represent a cost:

[
E(Q) =
\begin{cases}
\frac{VWAP(Q)-M}{M}\times 10{,}000, & \text{buy}\
\frac{M-VWAP(Q)}{M}\times 10{,}000, & \text{sell}
\end{cases}
]

This estimate includes the cost of crossing the spread and consuming multiple levels. It is not, by itself, a measure of permanent market impact. Permanent impact requires comparing price changes after execution and controlling for broader market movements.

2.4 Resilience measures recovery after a liquidity shock

Resilience captures how quickly the book rebuilds after cancellations, market orders, or other disruptions. A simple post-shock recovery ratio is:

[
R = \frac{D_{after}}{D_{before}}
]

A related measure is recovery time:

[
T_{recover} = t_{recovered} - t_{shock}
]

The exact thresholds depend on the market and the definition of “recovered.” A robust system might require both:

  1. Aggregate depth to return to at least 80% of its pre-shock value.
  2. The condition to persist for several consecutive updates.

Without persistence, a single transient quote can produce a false recovery signal.

3. From Order Book to Execution Decision

Liquidity measurement should sit inside a complete execution workflow. Treating the order book as an isolated indicator creates a common analytical error: it estimates what the book looks like, but not what an order can obtain after latency, queue position, partial fills, and fees.

+------------------+       +--------------------+       +------------------+
| Market data      |       | Normalization      |       | Liquidity        |
| source           |------>| and validation     |------>| feature engine   |
|                  |       |                    |       |                  |
+------------------+       +--------------------+       +------------------+
                                                               |
                                                               v
                                                        +------------------+
                                                        | Pre-trade        |
                                                        | simulation       |
                                                        +------------------+
                                                               |
                                                               v
                                                        +------------------+
                                                        | Order routing    |
                                                        | and execution    |
                                                        +------------------+
                                                               |
                                                               v
                                                        +------------------+
                                                        | Post-trade       |
                                                        | cost analysis    |
                                                        +------------------+

3.1 The Pre-Trade Stage

The pre-trade stage converts the current book into an expected execution distribution. A simple model estimates:

  • The quantity expected to fill at the best quote.
  • The quantity expected to fill after crossing the spread.
  • The expected implementation shortfall at several participation rates.
  • The probability that the relevant depth disappears before arrival.
  • The expected time and cost of partial fills.

For example, a trader might compare three order schedules:

Schedule Participation assumption Primary objective Principal risk
Marketable limit 35% of top size Immediate execution Spread and book-walking cost
Passive limit 25% of quote size Lower explicit cost Non-fill and adverse-selection risk
Sliced hybrid 10–15% per slice Balance cost and urgency Scheduling and timing risk

The correct choice depends on the decision maker’s objective. A position that must be exited before an event has a different cost function from a patient order that can wait for replenishment.

3.2 The During-Order Stage

The pre-trade estimate becomes stale as soon as the order is submitted. Live monitoring should compare the expected fill with the realized fill and detect deterioration in:

  • The quoted spread.
  • The depth available at or near the arrival price.
  • The side of the book required to complete the order.
  • The rate at which displayed liquidity is being canceled.
  • The relationship between submission time and exchange acknowledgement.

A material deviation does not necessarily mean the original decision was wrong. It means the liquidity assumption embedded in the decision no longer holds.

3.3 The Post-Trade Stage

Post-trade analysis converts observed fills into a calibrated model. The most useful distinction is between:

  • Explicit cost: the spread paid and the price difference between the arrival benchmark and the average fill.
  • Market impact: the price movement associated with the order after controlling for concurrent market moves.
  • Opportunity cost: the difference between the realized price and a counterfactual price if the order had remained unfilled.
  • Delay cost: the price movement between the decision time and order arrival.

Without this decomposition, a model may attribute every loss to impact. In reality, some losses come from latency, stale decisions, or adverse selection while the order waited.

4. Production-Grade Real-Time Liquidity Monitoring

The following Python service consumes depth events over WebSocket and calculates:

  • Midpoint and spread in basis points.
  • Top-(N) bid and ask depth.
  • Buy/sell pressure ratio.
  • Estimated implementation shortfall for a configured order size.
  • Reconnect behavior with exponential backoff and jitter.

The code loads the API key from TICKDB_API_KEY and passes it as the WebSocket api_key query parameter. It sends a heartbeat, handles the 3001 rate-limit code, uses connection and receive timeouts, and never logs the API key.

Because subscription schemas can change between API versions, the service requires the current WebSocket URL and subscription payload as environment variables. This is safer than embedding an undocumented payload shape that silently produces incorrect metrics.

4.1 Configuration

Set the following environment variables using the current WebSocket endpoint and subscription schema from the API documentation:

export TICKDB_API_KEY="your-api-key"
export TICKDB_WS_URL="wss://your-tickdb-websocket-endpoint"
export TICKDB_DEPTH_SUBSCRIPTION_JSON='{"channel":"depth","symbol":"your-symbol"}'
export TICKDB_ORDER_SIZE="50000"
export TICKDB_DEPTH_LEVELS="10"

The subscription JSON must not contain the API key. Authentication belongs in the query parameter.

4.2 WebSocket Client and Metric Engine

import asyncio
import json
import os
import random
import sys
import time
from typing import Any, Dict, Iterable, List, Optional, Tuple
from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit

import websockets


API_KEY = os.environ.get("TICKDB_API_KEY")
WS_URL = os.environ.get("TICKDB_WS_URL")
SUBSCRIPTION_JSON = os.environ.get("TICKDB_DEPTH_SUBSCRIPTION_JSON")
ORDER_SIZE = int(os.environ.get("TICKDB_ORDER_SIZE", "50000"))
DEPTH_LEVELS = int(os.environ.get("TICKDB_DEPTH_LEVELS", "10"))

HEARTBEAT_SECONDS = 15
RECEIVE_TIMEOUT_SECONDS = 45
MAX_RECONNECT_DELAY = 60


class ConfigurationError(RuntimeError):
    pass


def load_configuration() -> Dict[str, Any]:
    missing = [
        name
        for name, value in {
            "TICKDB_API_KEY": API_KEY,
            "TICKDB_WS_URL": WS_URL,
            "TICKDB_DEPTH_SUBSCRIPTION_JSON": SUBSCRIPTION_JSON,
        }.items()
        if not value
    ]
    if missing:
        raise ConfigurationError(
            "Missing required environment variables: " + ", ".join(missing)
        )

    try:
        subscription = json.loads(SUBSCRIPTION_JSON)
    except json.JSONDecodeError as exc:
        raise ConfigurationError(
            "TICKDB_DEPTH_SUBSCRIPTION_JSON is not valid JSON"
        ) from exc

    return {
        "subscription": subscription,
        "order_size": ORDER_SIZE,
        "depth_levels": DEPTH_LEVELS,
    }


def authenticated_ws_url(base_url: str) -> str:
    """Attach the API key without printing it to logs."""
    parts = urlsplit(base_url)
    query = dict(parse_qsl(parts.query, keep_blank_values=True))
    query["api_key"] = API_KEY
    return urlunsplit(
        (parts.scheme, parts.netloc, parts.path, urlencode(query), parts.fragment)
    )


def find_book_node(payload: Any) -> Optional[Dict[str, Any]]:
    """Locate a depth object in common wrapper structures."""
    if not isinstance(payload, dict):
        return None

    for key in ("depth", "book", "snapshot"):
        value = payload.get(key)
        if isinstance(value, dict):
            return value

    data = payload.get("data")
    if isinstance(data, dict):
        nested = find_book_node(data)
        if nested is not None:
            return nested
        return data

    return payload


def parse_levels(raw_levels: Any) -> List[Tuple[float, float]]:
    """Normalize price/size pairs into float tuples."""
    if not isinstance(raw_levels, list):
        return []

    parsed: List[Tuple[float, float]] = []

    for level in raw_levels:
        price: Optional[float] = None
        size: Optional[float] = None

        if isinstance(level, (list, tuple)) and len(level) >= 2:
            price = float(level[0])
            size = float(level[1])
        elif isinstance(level, dict):
            price_value = level.get("price", level.get("p"))
            size_value = level.get("size", level.get("quantity", level.get("q")))
            if price_value is not None and size_value is not None:
                price = float(price_value)
                size = float(size_value)

        if price is not None and size is not None and price > 0 and size >= 0:
            parsed.append((price, size))

    return parsed


def extract_depth(payload: Dict[str, Any]) -> Optional[Dict[str, Any]]:
    """Extract and sort bids/asks from a normalized depth event."""
    book = find_book_node(payload)
    if book is None:
        return None

    bids_raw = book.get("bids", book.get("bid", book.get("buys", [])))
    asks_raw = book.get("asks", book.get("ask", book.get("sells", [])))

    bids = parse_levels(bids_raw)
    asks = parse_levels(asks_raw)

    if not bids or not asks:
        return None

    bids.sort(key=lambda level: level[0], reverse=True)
    asks.sort(key=lambda level: level[0])

    return {
        "bids": bids,
        "asks": asks,
        "timestamp": payload.get("timestamp", payload.get("ts")),
    }


def calculate_metrics(
    bids: List[Tuple[float, float]],
    asks: List[Tuple[float, float]],
    order_size: int,
    depth_levels: int,
) -> Dict[str, float]:
    bids = bids[:depth_levels]
    asks = asks[:depth_levels]

    best_bid = bids[0][0]
    best_ask = asks[0][0]
    midpoint = (best_bid + best_ask) / 2

    if midpoint <= 0:
        raise ValueError("Midpoint must be positive")

    bid_notional = sum(price * size for price, size in bids)
    ask_notional = sum(price * size for price, size in asks)
    spread_bps = (best_ask - best_bid) / midpoint * 10_000
    pressure_ratio = bid_notional / ask_notional if ask_notional else float("inf")

    remaining = order_size
    filled = 0.0
    notional = 0.0

    # Conservative simulation: assume displayed ask liquidity is available.
    for price, size in asks:
        if remaining <= 0:
            break
        take = min(size, remaining)
        filled += take
        notional += take * price
        remaining -= take

    if filled > 0:
        vwap = notional / filled
        estimated_impact_bps = (vwap - midpoint) / midpoint * 10_000
        completion_ratio = filled / order_size
    else:
        vwap = float("nan")
        estimated_impact_bps = float("nan")
        completion_ratio = 0.0

    return {
        "midpoint": midpoint,
        "spread_bps": spread_bps,
        "bid_depth_notional": bid_notional,
        "ask_depth_notional": ask_notional,
        "pressure_ratio": pressure_ratio,
        "estimated_impact_bps": estimated_impact_bps,
        "completion_ratio": completion_ratio,
    }


async def heartbeat(websocket) -> None:
    """Send application-level heartbeat messages."""
    while True:
        await asyncio.sleep(HEARTBEAT_SECONDS)
        await websocket.send(json.dumps({"cmd": "ping"}))


def handle_api_error(payload: Dict[str, Any]) -> Optional[float]:
    """Return a retry delay for rate limits; raise for fatal auth errors."""
    code = payload.get("code")

    if code in (1001, 1002):
        raise PermissionError(
            "Invalid or missing API key — check TICKDB_API_KEY"
        )

    if code == 3001:
        retry_after = payload.get("retry_after", 5)
        try:
            return max(0.0, float(retry_after))
        except (TypeError, ValueError):
            return 5.0

    return None


async def run_stream(config: Dict[str, Any]) -> None:
    retry = 0

    while True:
        heartbeat_task: Optional[asyncio.Task] = None

        try:
            # ⚠️ This asynchronous implementation prioritizes maintainability.
            # For production HFT workloads, benchmark a lower-latency stack.
            async with websockets.connect(
                authenticated_ws_url(WS_URL),
                open_timeout=10,
                close_timeout=5,
                ping_interval=20,
                ping_timeout=10,
                max_size=1_048_576,
            ) as websocket:
                retry = 0
                heartbeat_task = asyncio.create_task(heartbeat(websocket))

                await websocket.send(
                    json.dumps(config["subscription"], separators=(",", ":"))
                )

                while True:
                    raw = await asyncio.wait_for(
                        websocket.recv(),
                        timeout=RECEIVE_TIMEOUT_SECONDS,
                    )
                    payload = json.loads(raw)

                    if not isinstance(payload, dict):
                        continue

                    retry_delay = handle_api_error(payload)
                    if retry_delay is not None:
                        await asyncio.sleep(retry_delay)
                        continue

                    depth = extract_depth(payload)
                    if depth is None:
                        continue

                    metrics = calculate_metrics(
                        depth["bids"],
                        depth["asks"],
                        config["order_size"],
                        config["depth_levels"],
                    )

                    output = {
                        "timestamp": depth["timestamp"]
                        or int(time.time() * 1_000),
                        **metrics,
                    }
                    print(json.dumps(output, separators=(",", ":")), flush=True)

        except asyncio.TimeoutError:
            print(
                json.dumps({"event": "stream_timeout_reconnecting"}),
                file=sys.stderr,
                flush=True,
            )
        except (PermissionError, ConfigurationError):
            raise
        except (OSError, websockets.WebSocketException, ValueError) as exc:
            print(
                json.dumps({"event": "stream_error", "detail": str(exc)}),
                file=sys.stderr,
                flush=True,
            )
        finally:
            if heartbeat_task is not None:
                heartbeat_task.cancel()
                await asyncio.gather(heartbeat_task, return_exceptions=True)

        delay = min(1 * (2 ** retry), MAX_RECONNECT_DELAY)
        jitter = random.uniform(0, delay * 0.1)
        await asyncio.sleep(delay + jitter)
        retry += 1


async def main() -> None:
    config = load_configuration()
    await run_stream(config)


if __name__ == "__main__":
    try:
        asyncio.run(main())
    except ConfigurationError as exc:
        print(f"Configuration error: {exc}", file=sys.stderr)
        raise SystemExit(2)
    except PermissionError as exc:
        print(f"Authentication error: {exc}", file=sys.stderr)
        raise SystemExit(3)

4.3 Important Implementation Limits

The metric engine assumes that displayed depth remains available until the order arrives. Real execution cannot guarantee this assumption. A conservative model should also account for:

  • Cancellation before arrival.
  • Queue priority for passive orders.
  • Adverse selection.
  • Partial venue fills.
  • Randomized execution latency.
  • Fees, rebates, taxes, and market-impact costs.

The code treats the estimated impact as an effective arrival-cost estimate. It does not claim to measure permanent impact or realized slippage.

5. Turning Raw Depth into Decision Variables

A production system should not treat each depth update as an independent observation. Order-book events are autocorrelated, and a single snapshot can be misleading.

5.1 Use Rolling Quantiles, Not a Single Snapshot

A reasonable baseline stores short rolling windows of:

  • Spread in basis points.
  • Top-level and multi-level depth.
  • Pressure ratio.
  • Estimated impact for several order sizes.
  • Cancellation and replenishment rates.

The relevant statistic is often the 90th or 95th percentile rather than the mean. Execution costs are driven by the states in which the trader most needs liquidity, and those states are precisely where the average is least informative.

5.2 Normalize Depth Before Comparing Instruments

Raw notional depth is affected by price, volatility, and instrument size. A normalized measure can compare how quickly depth disappears as the book is consumed.

For example:

[
D_{consumed}(x) =
\frac{D_{initial}-D_{remaining}}{D_{initial}}
]

This transforms a book into a depletion curve. The slope near the origin estimates the immediate cost of small orders; the curvature reveals whether additional depth appears or vanishes as size increases.

5.3 Track Imbalance Without Treating It as Direction

The buy/sell pressure ratio is:

[
P_N = \frac{D_N^{bid}}{D_N^{ask}}
]

A ratio of 3.0 does not automatically predict a price increase. It can reflect a large resting bid that will be canceled before the trader can fill against it. In a one-sided market, the ratio can become undefined or extremely large with very little additional information.

Pressure becomes more useful when combined with:

  • Depth recovery.
  • Spread stability.
  • Trade aggressiveness.
  • Price response.
  • Order cancellation rate.

5.4 Measure Cost Across Participation Regimes

A single 50,000-share simulation cannot characterize liquidity across the full order lifecycle. The system should calculate impact at multiple sizes:

Participation regime Simulation size Decision question
Small 5% of displayed top-level size Can the order remain near the touch?
Medium 25% of displayed top-level size How quickly does the book become sensitive?
Large 50% of displayed top-level size What price concession is required?
Scaled Actual order quantity What is the expected implementation shortfall?

The ratio between small and large simulated impact is informative. A stable ratio suggests a broad, replenishing book. A sharp increase indicates concentrated liquidity and nonlinear execution cost.

6. Data Granularity Changes the Question

Order-book data does not support every liquidity claim equally.

Data level What it supports What it does not support
L1 only Spread, top-of-book size, simple imbalance Multi-level depth, full book depletion, price impact across several levels
L2/L5/L10 Depth curves, breadth, level consumption, multi-level impact Hidden or reserve liquidity; guaranteed future availability
Trades plus depth Aggressor flow, replenishment, execution interaction A complete causal model of order placement
Historical snapshots Regime and stability analysis Reconstructing the exact order book seen by a live client unless timestamps align

TickDB’s depth capability has specific market boundaries:

  • US equities provide L1 depth.
  • Hong Kong equities and crypto provide L1–L10 depth.
  • Forex, precious metals, and indices do not support the depth channel.

That distinction is essential. A US equity implementation can measure the spread and displayed size at the best bid and ask, but it should not describe those fields as ten-level order-book depth. Multi-level claims require multi-level data.

For US equities, a responsible analytical design combines L1 depth with other supported feeds, such as historical OHLCV, rather than extrapolating a multi-level book that the feed does not contain.

7. A Deployment Guide by Trader Profile

7.1 Configuration by Use Case

User segment Primary objective Recommended metrics Order-sizing policy
Individual quant Reliable research and modest live orders Spread, top-level size, actual fill deviation Keep participation below 10–15% of displayed size
Small team Repeatable execution across several symbols Rolling depth percentiles, impact curve, cancellation rate Scale by measured impact rather than fixed share count
Institutional team Minimize implementation shortfall across large orders Venue-level impact, latency, fill probability, TCA Split by participation, urgency, and book state
Market maker or liquidity provider Quote placement and inventory control Queue position, replenishment time, cancellation hazard Quote conditionally on depth and toxicity estimates
Event-driven desk Fast execution under unstable liquidity Spread shock, depth collapse, recovery time Use pre-trade scenarios and explicit urgency limits

7.2 A Practical Pre-Trade Checklist

Before sending an order, the execution system should answer:

  1. What is the current executable midpoint?
    Use the best bid and ask rather than a stale last trade.

  2. How much depth exists within the acceptable price range?
    Determine both share quantity and notional.

  3. How does impact scale with size?
    Evaluate several participation levels, not only the intended order.

  4. How stable is the book?
    Inspect depth recovery and cancellation behavior.

  5. How long will the order remain exposed?
    Include expected latency and queue time in the cost estimate.

  6. What would make the order invalid?
    Define a spread, depth, or impact threshold before submission.

  7. What did the order actually achieve?
    Compare arrival price, average fill, benchmark-adjusted return, and opportunity cost.

7.3 Validation and Backtest Disclosure

This article does not present a strategy-return backtest, so it makes no claims about win rate, profit factor, Sharpe ratio, or maximum drawdown. The code provides a real-time measurement and cost-estimation framework rather than evidence of profitable execution.

A production validation program should record at least:

  • The decision-time book.
  • Arrival-time book.
  • Submitted and acknowledged timestamps.
  • Order-level fills and fees.
  • Market and benchmark returns over the execution window.
  • Venue and routing information.
  • Canceled depth and observed replenishment.

Before changing live order sizes, backtest the execution simulator over a substantial sample of real orders. Report fill rates, implementation shortfall, realized versus predicted impact, venue contribution, and performance during stressed liquidity periods. A model trained only on normal sessions will likely underestimate the tail costs that determine whether large orders remain practical.

8. From a Displayed Price to an Executable Price

At 10:07:03, the sell order did not begin at the displayed price. It began with the book the trader could actually access, after latency and cancellation risk, and ended at a volume-weighted price shaped by every level consumed along the way.

The core takeaway is direct: liquidity is not a spread, a volume statistic, or an imbalance indicator viewed alone. It is the measurable capacity of a market to absorb a specific order with limited price concession and predictable implementation shortfall.

A sound trading system therefore evaluates four questions together:

  1. How much depth is available?
  2. How broadly is that depth distributed?
  3. How does the book respond as the order consumes it?
  4. How quickly does liquidity recover after stress?

Only the fourth question determines what the order receives after it arrives.

Next Steps

If you are an investor looking for deeper market insight, subscribe to the TickDB newsletter for weekly supply-chain and market-microstructure analysis.

If you want to run this liquidity monitor yourself:

  1. Sign up at tickdb.ai and create an API key.
  2. Set TICKDB_API_KEY, TICKDB_WS_URL, and TICKDB_DEPTH_SUBSCRIPTION_JSON.
  3. Install the WebSocket dependency with pip install websockets.
  4. Run the service and compare estimated impact with realized fills.

If you need 10+ years of historical OHLCV data for strategy research, contact [email protected] for institutional data options.

If you use AI coding assistants, search for and install the tickdb-market-data SKILL in your AI tool’s marketplace.

This article does not constitute investment advice. Markets involve risk; past performance does not guarantee future results.