Glossary
Slippage Estimation
Slippage estimation predicts the difference between an expected trade price and the price or token amount likely to be received at execution.
Slippage estimation predicts the gap between a trade’s expected price and its likely execution price, usually expressed in currency, ticks, percentage points, or basis points. It matters because a strategy can look profitable before execution costs yet lose money once spreads, market impact, latency, partial fills, and failed transactions are included. A sound estimate helps trading systems size orders, choose execution logic, reject weak signals, and set realistic slippage protection.
What the Estimate Actually Measures
The first decision is the reference price. For an exchange order, this may be the midpoint when the signal fired, the best ask or bid when the order arrived, or a scheduled price such as volume-weighted average price (VWAP). For an automated market maker (AMM) swap, it is usually the quoted output computed from the pool state before submission. These references answer different questions, so mixing them creates tidy numbers that say very little.
For a buy, a common signed measure is 10,000 × (fill VWAP - reference price) / reference price. For a sell, reverse the sign so a worse fill remains positive cost. With several fills, use quantity-weighted prices; a simple average can understate cost when the largest fill occurs at the worst level. Fees, gas, and taxes should stay separate unless the metric is explicitly total execution cost.
From Quote to Expected Fill
A useful estimate starts with the order’s actual path through the market. A small market order may pay roughly the spread and consume one quote level. A larger order can sweep several levels, while a limit order may avoid immediate spread cost but face queue delay, non-fill risk, and adverse selection. That’s the awkward trade: cheaper-looking execution can become expensive when the market moves away while the order waits.
- Capture the decision timestamp, order-arrival timestamp, side, size, venue, and reference price.
- Simulate available depth or the AMM curve for the requested quantity.
- Add latency and expected price movement during the execution window.
- Calibrate the result against live fills grouped by instrument, session, volatility, and order type.
Order Book and AMM Models
On a central limit order book, the direct method is book replay: walk the ask levels for a buy or bid levels for a sell until the quantity is filled, then calculate the expected fill VWAP. Top-of-book data alone works only for tiny orders. Once size approaches visible depth, cancellations, hidden liquidity, queue position, and replenishment matter; order-flow imbalance can also explain short-term price movement better than raw traded volume alone.
On an AMM, slippage comes from the pool’s pricing rule and current liquidity. Constant-product pools require reserve-based simulation, while concentrated-liquidity pools require tick-by-tick traversal through active ranges. The quote must use the same token decimals, route, fee tier, and block state as the submitted transaction. A quote from block N may be stale by the time the transaction executes at block N+k, especially when arbitrage or maximal extractable value activity changes the pool first.
Calibration for Backtests and Live Trading
Backtests often use a fixed slippage value because it is simple. It is also easy to fool. A single rate pooled across quiet and volatile sessions hides the trades that hurt most. A better model conditions cost on spread, volatility, participation rate, time of day, side, and available depth, then validates the estimate on fills that were not used for calibration.
A common production failure appears when canceled or unfilled orders vanish from the dataset. The remaining fills look unusually good because the model excludes opportunity cost and failed execution. Operators usually compare predicted and realized slippage by bucket, inspect the error distribution rather than only the mean, and watch for drift after fee changes, venue migrations, symbol remaps, or liquidity regime shifts. Real-time slippage alone also does not prove that the order caused the move; other traders may be reacting to the same information.
Momentum Trading Bot: Broker Api Execution Engine
Our product processes live market streams, detects rules and controls execution with configurable risk settings.
ETF Slippage From NAV
For an exchange-traded fund (ETF), slippage from net asset value (NAV) can be measured as the signed difference between the execution price and NAV per share, divided by NAV. Yet published NAV is often a closing value, while ETF shares trade throughout the day. Comparing a midday fill with an end-of-day or stale NAV can label normal price discovery as slippage.
Use a contemporaneous reference where possible: the ETF midpoint, an indicative basket value, or a fair-value estimate of the underlying holdings. Then report the bid-ask spread and premium or discount to NAV separately. ETFs can trade above or below NAV, and the spread itself is a real trading cost, so NAV deviation is not a complete execution-cost measure.
Bridge and Relayer Edge Cases
Teams searching for a slippage estimator for bridges, Geth, or a relayer need to separate swap slippage from bridge fees, gas, relayer charges, and destination-chain price movement. Geth supplies Ethereum node access; it does not define a universal bridge-slippage formula. The relayer should simulate the exact contract call with eth_call, preserve token decimals and route data, and compare the quoted minimum output with the amount encoded in the transaction.
The message error: estimated aidoge amount invalid. check your slippage configuration is implementation-specific, not a standard Ethereum error. Likely causes include a stale quote, an amount rounded to zero after decimal conversion, a mismatched token address, an invalid route, or a minimum-output value that the contract cannot satisfy. The practical check is to log raw integer amounts, token decimals, quote block, route, fee fields, and revert data before raising the tolerance. Raising tolerance blindly may stop reverts, but it also permits a worse fill.
Where Estimates Break Down
A slippage estimate is a forecast, not a guarantee. It becomes unreliable during halts, news shocks, opening auctions, thin overnight sessions, chain congestion, oracle delays, pool migrations, or sudden liquidity withdrawal. Bar data also cannot reproduce the sequence of trades inside a candle, so high-frequency backtests built from one-minute OHLC data may invent fills that were never available.
- Use slippage tolerance as an execution guard, not as the estimate itself.
- Reject or resize orders when predicted cost consumes too much of the signal’s expected edge.
- Store quote, submission, fill, and settlement states so errors can be traced later.
- Recalibrate after material changes in venue rules, liquidity, routing, or contract logic.
Frequently Asked Questions
How to estimate slippage?
Estimate slippage by choosing a clear reference price, simulating how the order will consume market liquidity, and comparing the predicted fill price with that reference. For live calibration, calculate quantity-weighted realized fills and group errors by instrument, order size, spread, volatility, session, and order type. Keep commissions, gas, and taxes separate unless you are measuring total execution cost.
How to estimate slippage from NAV for ETFs?
Estimate ETF slippage from NAV as the signed difference between the execution price and NAV per share, divided by NAV. Use a NAV or fair-value estimate that matches the execution time; a stale closing NAV can create a false premium or discount when the underlying market is closed or moving. Report bid-ask spread and NAV deviation separately because each reflects a different source of trading cost.