A depth anomaly is a sharp departure from a pool's recent depth baseline that is not explained by normal intraday variance. It can be a sudden drop, a sudden spike, or an unusual depth curve shape where depth at 2% price impact is proportionally much lower than at 1% in a way that differs from the pool's historical pattern. These anomalies are useful signals for routing systems and research desks because they often precede elevated execution costs and sometimes precede routing failures outright.
Understanding what causes depth anomalies, how to detect them in a live data stream, and what routing actions they should trigger is the subject of this piece. The goal is practical: an analyst or routing system that can identify anomalies before execution will make better routing decisions than one that only sees them in post-trade analysis.
What causes depth anomalies
The most common cause of a depth anomaly is a large LP withdrawal. When a significant liquidity provider exits a pool, the total reserves drop, and the depth curve compresses. In a concentrated liquidity pool, the impact is non-linear: if the departing LP had their position concentrated near the current price, depth at 1% impact can drop far more than TVL does, because the removed capital was disproportionately contributing to near-price depth. If the departing LP had a wide position, the impact on depth at standard price impact thresholds is more proportional to their TVL share.
The second common cause is concentrated directional volume. A large one-sided trade absorbs liquidity on one side of the pool and shifts the reserve ratio. Depending on pool type, this manifests differently. For constant-product pools, the reserve ratio shifts and both sides of depth become asymmetric. For concentrated liquidity pools, directional volume can push the price out of an active liquidity band, causing depth to drop sharply at the new price level even though TVL is unchanged.
The third cause, less frequent but worth noting, is protocol-level changes: governance upgrades that modify fee tiers, reward structures, or pool parameters can trigger rapid LP repositioning. The v23 upgrade on Osmosis DEX is an example we have documented elsewhere. Protocol governance events are predictable at least in terms of timing, so this class of anomaly can be anticipated even if the magnitude is uncertain.
How to detect anomalies in depth data
Anomaly detection for depth data follows the same basic approach as anomaly detection for any time series: define a baseline, define a deviation threshold, and flag observations that exceed the threshold. The key parameters are the baseline window and the sensitivity of the threshold.
For depth at the 1% price impact threshold, a 7-day rolling average is a reasonable baseline for most actively traded pairs. Intraday variance means that a single hourly observation can deviate from the daily average by 15-20% in normal conditions. An anomaly threshold at 2 standard deviations from the rolling mean will flag observations that are genuinely unusual rather than normal intraday swings. For pairs with lower volume and more variable depth, a wider threshold may be appropriate to avoid excessive false positives.
The shape of the depth curve is a secondary anomaly signal that standard threshold detection misses. In normal pool operation, the relationship between depth at 1% and depth at 2% is relatively stable: the ratio depends on pool type (constant-product versus concentrated liquidity versus stableswap) and does not change quickly. If the 2%/1% depth ratio shifts significantly from its recent average, it can indicate that the pool's active liquidity distribution has changed in a way that is not yet visible in the 1% number. An unusually low 2%/1% ratio suggests that depth degrades sharply beyond 1%, meaning that trades only slightly above the 1% threshold will experience disproportionately worse slippage.
What depth anomalies signal for routing decisions
A depth anomaly in a pool that is on a routing path is a signal to recompute expected execution cost before committing to that path. It does not necessarily mean the path should be abandoned, because depth anomalies can be short-lived (LP exits are sometimes reversed, directional pressure can reverse). But it means that the cached depth estimate used for the original route selection may be stale in a way that understates true execution cost.
For routing systems that operate with periodic depth refreshes rather than real-time feeds, an anomaly detection layer that triggers an out-of-schedule depth refresh is a practical mitigation. If current depth at a routing decision point is below a threshold that would make the route unacceptable, the system can either switch to an alternative route or defer the transaction until depth recovers.
Research desks tracking routing efficiency over time should also record the depth state at each routing decision point, not just the execution outcome. This allows post-hoc analysis of whether anomalous depth states at routing time were predictive of poor execution outcomes, which over time calibrates the sensitivity of the anomaly detection threshold for specific pairs.
The distinction between structural and transient anomalies
Not all depth anomalies are the same from a routing perspective. A transient anomaly caused by intraday directional volume may resolve within hours as LPs rebalance or counter-directional volume arrives. A structural anomaly caused by a major LP withdrawal may persist for days or longer if the LP does not return. A protocol-change anomaly like the one observed after the Osmosis v23 upgrade may take weeks to reach a new equilibrium.
Routing decisions should respond differently to these anomaly types. For transient anomalies, deferring or rerouting for a few hours is often a sufficient response. For structural anomalies, the depth baseline may need to be recalibrated at the new lower level, and alternative routes should be seriously considered for any transaction with moderate size. For protocol-change anomalies, the full recalibration period needs to be expected and the depth model explicitly updated to treat the post-upgrade state as the new baseline once the repositioning period ends.
Classifying anomalies by type in real time is hard. The most reliable signal for structural versus transient is the LP activity data: if the anomaly coincides with a large LP exit visible on-chain, it is likely structural. If there is no corresponding LP event and the depth change is simultaneous with a large trade, it is likely transient. Monitoring both pool depth and LP activity together provides the necessary context that depth data alone does not.
Limits of anomaly detection
Anomaly detection is a signal, not a forecast. It tells you that current conditions differ significantly from recent history. It does not tell you whether depth will recover, worsen, or stabilize at the anomalous level. For research and routing purposes, the right response to a flagged anomaly is more information gathering and more conservative execution planning, not automated avoidance. Some of the best routing windows occur shortly after an anomaly resolves, when a pool that was temporarily thin recovers to above-average depth as LPs rebalance.
The goal is not to avoid depth anomalies entirely but to be aware of them before they affect your execution rather than learning about them from a worse-than-expected trade fill.