How to Build a Realistic Slippage Model for Backtests
Learn how to construct a data‑driven slippage model for trading backtests, covering market data, statistical fitting, latency handling and validation.
Produced with automation, then checked by deterministic quality rules and an independent source-grounded review before publication.
- 01Derive slippage from granular market data instead of a flat rate.
- 02Fit an appropriate probability distribution to historical slippage observations.
- 03Add a latency buffer that reflects order submission delay.
- 04Separate slippage from fees because they affect P&L differently.
- 05Validate the model with out‑of‑sample data to avoid optimism.
A realistic slippage model translates the gap between expected and actual execution prices into a repeatable component of a backtest. It relies on high‑resolution market data, statistical representation of price impact, and a latency buffer that mimics order‑submission delay.
What market data is required?
Accurate slippage modeling starts with granular trade prints and level‑2 order‑book snapshots. Each record must include a timestamp, execution price, size, and depth across price levels. The data source should also expose freshness, coverage gaps and any quality warnings.
- Timestamped trade prints with price and volume.
- Level‑2 snapshots showing depth at multiple price levels.
- Metadata that identifies source, latency and data‑quality warnings.
How can slippage be expressed statistically?
A common approach is to fit a probability distribution to observed slippage values. Simple normal distributions are easy to implement but often underestimate tail risk. Empirical or skewed distributions such as log‑normal capture asymmetry and extreme events more accurately.
- 01Collect slippage observations from historical market orders.
- 02Fit candidate distributions and evaluate goodness‑of‑fit with statistical tests.
- 03Select the distribution that balances simplicity with tail accuracy.
- 04Store the parameters for use in the backtest engine.
Should slippage be fixed or variable?
A fixed‑percentage assumption is convenient but unrealistic because it ignores liquidity depth, order size and market volatility. A variable model ties slippage to the order‑book depth at the moment of execution, scaling with the proportion of available volume consumed.
"Liquidity‑aware slippage models tend to produce more credible backtest results than flat‑rate assumptions."
How does latency affect slippage modeling?
Latency creates a delay between the decision point and order submission, during which the market can move. Modeling this delay as a latency buffer drawn from observed network and processing times adds realism. The buffer can be a random variable or a deterministic offset depending on the desired fidelity.
- Measure typical round‑trip latency for your trading infrastructure.
- Add the latency to the decision timestamp before querying the order‑book snapshot.
- Re‑calculate slippage based on the shifted snapshot.
What are the practical limits of a slippage model?
Even a well‑calibrated model cannot eliminate all uncertainty. Market regimes shift, and rare events may fall outside the historical distribution. Stress‑testing with extreme‑value scenarios and documenting assumptions are essential to keep expectations realistic.
How often should the model be recalibrated?
Recalibrate whenever there is a material change in market structure, asset class or trading frequency. For stable markets a quarterly review is a reasonable baseline.
How do you validate a slippage model?
Validation compares the model’s predicted slippage against out‑of‑sample execution data. Consistent under‑estimation signals optimism, while over‑estimation can mask a strategy’s true potential. Adjust parameters or distribution choices based on validation results.
- 01Split historical data into calibration and validation periods.
- 02Run the backtest using the calibrated slippage model on the validation set.
- 03Compare predicted versus actual slippage statistics.
- 04Refine the model parameters or distribution as needed.
Where can I learn more about related cost factors?
For a broader view of how slippage interacts with fees, see Why Fees and Slippage Change a Trading Backtest. A practical checklist is available in Modeling Slippage in Trading Backtests. The guide on How to Detect Overfitting in a Trading Backtest helps keep your model honest.
Frequently asked questions
Market‑derived slippage captures real liquidity, order size and volatility effects, producing backtest results that better reflect live trading conditions.
A normal distribution is easy to implement but may miss heavy tails. Consider empirical or skewed distributions for more accurate tail risk representation.
Latency shifts the effective market snapshot used for execution, often increasing slippage. Modeling latency as a random or deterministic offset helps capture this effect.
Validate against out‑of‑sample data; systematic under‑prediction of realized slippage indicates optimism that should be corrected.
Recalibrate when market structure, asset class or trading frequency changes materially; a quarterly cadence works for stable markets.
Sources and verification
Product claims in this article were checked against these first-party references. Runtime status remains authoritative for current availability.
- Felix documentationfirst party
- Felix machine referencefirst party
Build with Felix now.
Felix infrastructure is live through MCP and the API. The Felix V1 retail quant-desk private beta is planned for September 22.
AI agents that trade without confirming current market, account, and system status can create costly mistakes. This article explains why runtime checks are essential and how to implement them responsibly.
AI agents act as disciplined overseers for a suite of trading models, handling order routing, risk limits, data verification and emergency stops. This guide explains the core functions, required controls and practical steps for safe deployment.