Playground
Execution Simulator
Execution cost calculator using the Almgren et al. (2005) impact model: permanent and temporary impact, half-spread and latency risk for any order size.
Runs in your browser. Nothing you enter is uploaded, and no account or API key is needed.
Market-impact model and coefficients from Almgren, Thum, Hauptmann and Li (2005), fitted on Citigroup's US large-cap orders. Costs on small caps, other venues or stressed markets can be well above the fit; use this to size the order of magnitude of your slippage, not to approve a block trade.
1. Order & market inputs
Costs are symmetric: a sell pays the same basis points as a buy.
100 to 1.00M on a log scale; type any value.
100.0k to 100.00M on a log scale; type any value.
Full quoted spread; you pay half of it.
Standard deviation of daily returns (2% ≈ 32% a year).
Trading faster raises temporary impact; trading slower leaves the order exposed longer (timing risk).
10 to 5000 on a log scale; type any value.
Mid price used to turn basis points into dollars.
Estimated slippage
−12.4bps
$6.20k on $5.00M notional, 50.0k buy, 1.00% of ADV, fills in 39.0 min
Impact paid 8.4 bps (half the 2.5 bps permanent move plus 7.1 bps temporary), half-spread 4.0 bps. Risk around that cost (1σ): timing ±63.2 bps over the fill, latency ±0.51 bps (±0.72 at latency + 2σ jitter).
2. Fill schedule (participation-weighted)
Linear participation model: the order tracks a constant fraction of market volume until filled. Real VWAP/TWAP engines shape the curve (U-shape for VWAP, flat for TWAP) to match intraday liquidity.
Formulas
permanent_bps = γ · σ · (X / V) · (Θ / V)^(1/4) γ = 0.314 temporary_bps = η · σ · participation^(3/5) η = 0.142 realized_impact = permanent / 2 + temporary half_spread = spread_bps / 2 total_bps = realized_impact + half_spread duration_min = X / (participation · V / 390) timing_risk = σ · √(duration_min / 390) · 10_000 (bps, 1σ) latency_drift = σ · √(latency_ms / ms_per_day) · 10_000 (bps, 1σ)
σ is daily volatility, X the order, V the average daily volume and Θ the shares outstanding. γ and η are the coefficients Almgren, Thum, Hauptmann and Li (2005) fitted on Citigroup US large-cap orders; the model reproduces their Table 3 (a 10%-of-ADV IBM buy: 20 bp permanent, 32, 25 and 18 bp realized over 0.1, 0.2 and 0.5 days). Trading faster raises the temporary term; trading slower raises timing risk.
How to use it
- Set the order: side, order size in shares, and the stock's average daily volume — order size relative to ADV drives the impact.
- Set the market conditions: bid-ask spread (bps), daily volatility (%), and participation rate (% of volume).
- Set latency (ms) and latency jitter to see the drift band the delay adds, and enter a reference price to convert basis points into dollars.
- Set inverse turnover (shares outstanding divided by daily volume; 263 for IBM) to scale permanent impact to the stock. Then read the cost decomposition: half the permanent impact, the temporary impact of your trading rate and the half-spread, summed to total slippage in basis points and dollars, plus the trade duration and the 1σ timing risk over it. The output is closed-form and deterministic: same inputs, same result, no random paths.
- Increase order size to find the 'capacity ceiling' where slippage exceeds expected alpha. This is your strategy's practical capacity limit.
Questions people ask
What does the simulator model that backtests skip?
It decomposes the execution cost most backtests ignore into three parts: half of the permanent price impact your order causes, the temporary impact of trading at your chosen rate, and the half-spread you cross, plus 1σ timing risk over the fill and a latency-drift band. Most backtests assume instant, complete fills at the mid-quote, which overstates achievable returns. It does not model an order book, queue position, or partial fills — those are outside a closed-form impact estimate.
Where do the impact coefficients come from?
From Almgren, Thum, Hauptmann and Li (2005), who fitted them on Citigroup's US large-cap orders: permanent impact 0.314 × σ × (order/ADV) × (shares outstanding/ADV)^(1/4), temporary impact 0.142 × σ × participation^(3/5). The tool reproduces the paper's Table 3. The fit is for liquid US large caps; small caps, other venues and stressed markets can cost well more, so treat the output as an order-of-magnitude estimate, not a venue-accurate fill.
Does the simulator handle venues or dark pools?
No. There is no order book, no lit-versus-dark distinction, and no venue selection — the tool is a closed-form estimate of aggregate impact cost from your order size relative to daily volume. For venue-specific fill behavior you need order-book replay, not this.
What's the impact-cost output?
The cost your order pays, in basis points: half the permanent impact (which grows with order size relative to ADV) plus the temporary impact (which grows with how fast you trade) plus the half-spread, with σ the daily volatility. For a buy of 10% of a day's volume in IBM traded over half a day, the model gives about 18 bps of impact, as in the paper's Table 3; trading the same order in a tenth of a day costs about 32 bps. The formulas are printed under the tool.
Is the output deterministic?
Yes. The calculation is closed-form — identical inputs always produce identical output, with no Monte Carlo or random paths. What varies in real markets (arrival timing, book depth, adverse selection) is not simulated, so re-running the same inputs won't build a distribution; the tool gives a single point estimate of expected impact cost.
Related tools
- Playgrounds Agent Skill Tester for Markets
Paste a SKILL.md definition + sample input + your Anthropic API key. See structured extraction, token cost, and latency — all in your browser. No signup, key never leaves the page.
- Playgrounds Prompt Regression Tester
Run the same prompt against current Claude, GPT and Gemini models with your own keys. Diff outputs, score drift, catch regressions.
- Playgrounds Hallucination Detector
Paste a source document + an LLM's extraction. Every numeric claim in the output is checked against the source. Client-side. Catches silent fabrication before it ends up in your pipeline.
Articles
- 7 min read Almgren-Chriss Optimal Execution: A Worked Example
Almgren-Chriss optimal execution on a 250k-share sell: permanent and temporary impact, the mean-variance frontier and the cost at the 2005 calibration.
- 9 min read Real-Time vs End-of-Day Market Data: When You Need It
Real-time vs end-of-day market data: a signal-decay decision rule, and $99-$199 a month for real-time against free EOD data from Tiingo or Massive Basic.
Use it from code
The same calculation as a JavaScript module you can import. It runs where you import it, with no request, key or rate limit.
import { compute } from "https://aifinhub.io/engines/execution-simulator.js";