Execution Simulator for Crypto Traders: Model Slippage, Latency & Fees to Improve Order Execution
In crypto trading, the trade idea often matters less than how you execute it. Two traders can spot the same breakout, but execution — slippage, fees, routing, and latency — determines who keeps the profit. This post teaches you how to build and use a simple execution simulator to estimate real-world trade costs, compare exchanges (including Canadian platforms), and make trading decisions that survive friction. Practical examples, pseudo‑code, and a checklist let you start simulating with minimal data.
Why execution modeling matters for crypto trading
Crypto markets are 24/7, fragmented across many centralized and decentralized venues, and frequently illiquid for large orders. Unlike textbook backtests that assume fills at historical close prices, real traders face: slippage from market impact, order routing inefficiencies, maker/taker fees, and latency that turns a good idea into a break-even trade. An execution simulator turns those invisible costs into measurable metrics so you can: plan order sizes, choose order types, and pick exchanges that reduce net trading cost.
Core components to model
1. Market impact and slippage
Market impact is the price movement your order causes. It depends on order size relative to available depth. A basic model: slippage = k * (order_size / average_depth)^alpha, where k and alpha are calibrated from historical order book fills. Practically, measure slippage per exchange and per pair (e.g., BTC/USDT vs BTC/CAD).
2. Order book depth and liquidity
Depth at multiple price levels (Level 2 data) shows how much you can buy/sell within a given spread. Use cumulative volume at N basis points from mid to estimate the average fill price for market orders. If Level 2 isn't available, proxy with historical trade volumes within time slices.
3. Fees, rebates and fee tiers
Maker/taker fees, deposit/withdrawal fees, and spreads on fiat ramps matter. Canadian exchanges (Newton, Bitbuy) often have different fee and spread profiles vs global venues (Binance, Coinbase, Kraken). Model both percent fees and fixed costs (e.g., CAD withdrawal fees) into per-trade cost.
4. Latency and partial fills
Latency causes price moves during execution — especially for market or IOC orders. Simulate price movement during your fill time window, for example by applying realized volatility scaled by latency to expected mid-price drift.
5. Slippage from routing & smart order types
Simulate differences between market orders, limit orders, TWAP/VWAP slices, and smart order routing (split across exchanges). Each method changes the expected price curve and execution risk.
Data you need and where to start
- Historical order book snapshots or Level 2 for the pair and exchanges you trade (or tick-level trades if Level 2 missing).
- Historical trades with sizes and timestamps to infer impact and typical fill distributions.
- Fee schedules and maker/taker tiers for each exchange.
- Exchange-specific constraints (min order size, lot increments, fiat on/off ramps).
If you can't access Level 2 for every venue, start with high-frequency trade ticks and estimate the price impact of different trade sizes by creating synthetic market orders (consume ticks until desired size filled). This gives a practical slippage curve per exchange and pair.
Building a simple execution simulator (step-by-step)
Below is a minimal approach you can implement in Python or your favorite language. The goal: estimate expected execution price and total cost for a given order size, exchange, and order method.
Step 1 — Load market data
Load a series of Level 2 snapshots or trade ticks for the period you want to simulate.
Step 2 — Define execution method
Options include: market order (single-shot), limit order (passive), TWAP (time-sliced), or smart route (split across exchanges). For TWAP, pick number of slices and a scheduling rule.
Step 3 — Simulate fills
For each simulated order slice, consume the order book or trade ticks until that slice size is filled. Record average fill price, fees, and any unfilled remainder. Aggregate across slices to compute weighted average execution price.
Step 4 — Add latency and slippage noise
Apply a stochastic price move during each slice to represent latency and market drift. Use historical realized volatility scaled to the slice duration as the standard deviation for a normal shock.
Step 5 — Compute total cost and metrics
Compute metrics: effective price (average fill), slippage vs arrival mid-price, fees paid, percent cost, and execution variance. Repeat across multiple historical periods to get a distribution of execution outcomes.
pseudo-code:
for each day in history:
for each execution_time in day.sample_times:
arrival_price = mid_price_at(execution_time)
slices = create_slices(order_size, method)
for slice in slices:
book = orderbook_snapshot_at(slice.time)
fill_price = consume_book(book, slice.size)
apply_latency_noise(&fill_price, latency, vol)
weighted_sum += fill_price * slice.size
avg_fill = weighted_sum / order_size
total_fees = calc_fees(order_size, exchange, maker_taker)
record_metrics(avg_fill, total_fees, avg_fill - arrival_price)
Interpreting simulator outputs: charts and examples
A few practical charts to produce and what they tell you:
- Slippage vs Order Size curve: plot percent slippage on the Y axis and order size (in BTC or USD) on the X axis. A convex curve indicates rising marginal cost — use it to select safe order sizes for market orders.
- Cost heatmap by exchange and time-of-day: a matrix where cells show expected percent cost. This helps find quiet windows or favorable venues (e.g., local CAD liquidity on Bitbuy during Toronto hours).
- Execution distribution histogram: shows variance of realized slippage. High variance suggests a risk of large adverse fills and favors passive or sliced strategies.
Example (textual): imagine BTC mid-price 60,000 CAD. A 10 BTC market order on Exchange A yields an average fill of 60,360 CAD (0.6% slippage) and fees of 0.04% (taker). Effective cost = 0.64% — about 3,840 CAD on that trade. The same order sliced into 10 TWAP slices across two exchanges averages 60,120 CAD with 0.2% total cost, saving ~2,400 CAD. These numbers show why execution method matters as much as entry timing.
Practical tips to reduce execution cost
1. Size-to-liquidity rule: never exceed X% of 1-minute traded volume for market orders. A conservative starting point is 1-5% depending on pair volatility.
2. Use limit orders and post-only where feasible: Being a maker reduces fees and avoids immediate market impact. If immediacy is not critical, small passive orders often outperform market orders.
3. Slice large orders with TWAP/VWAP: For large fills, time-slicing smooths market impact. Adjust aggressiveness dynamically using realized volatility and depth.
4. Smart route across exchanges: For cross-listed assets consider splitting across venues where depth is higher or fees lower. Be mindful of withdrawal times and transfer fees when balancing across exchanges.
5. Monitor funding and maker credits: On perpetuals, funding and maker-taker mechanics can make one venue cheaper over time even if initial fees look higher.
6. Pre-calc expected cost before trade execution: Run a quick simulator check — many trading desks keep a pre-trade cost estimate tool as a guardrail.
Canadian note: compare fee+spread on local CAD ramps (Newton, Bitbuy) vs large US/Global venues. Sometimes paying a small spread for a CAD fiat on‑ramp is cheaper than incurring FX and withdrawal friction from a global exchange.
Trader psychology and discipline when executing
Execution often fails not because of math but because of behavior. Common psychological mistakes:
- Impulse market orders: Fear of missing out leads to market orders that blow up P&L via slippage. Use pre-trade simulator outputs to counter the impulse with numbers.
- Overconfidence in fills: Traders assume backtest fills are achievable; simulation shows the cost difference and forces a reality check.
- Changing strategy mid-run: If slices are underfilled or markets move, have pre-defined rules to accelerate or cancel rather than ad-hoc decisions driven by emotion.
A simple behavioral rule: every trade larger than a set threshold requires a pre-trade execution estimate and a written contingency (e.g., "If slippage > 0.5% on two consecutive slices, stop and re-evaluate"). This creates a disciplined stop-gap to emotional overreaction.
Putting it into practice: a 6‑point execution checklist
- Estimate percent slippage for your order size using recent book snapshots.
- Compare effective cost across exchanges (include fees and withdrawal costs).
- Choose order method: market, limit, TWAP, or smart route based on urgency and cost.
- Set contingency thresholds for slippage and partial fills.
- Log actual fills and compare to simulator predictions to recalibrate models.
- Review execution performance monthly and adjust rules (sizing, slicing, venues).
Conclusion
Execution is a measurable, improvable part of crypto trading. Building a lightweight simulator forces discipline, removes guesswork, and often saves more P&L than small alpha improvements in entry timing. Start small: use historical trade ticks or a few days of order book snapshots, simulate market vs TWAP fills for your typical sizes, and apply the six‑point checklist before larger trades. Over time, track your execution metrics and let the data guide your venue choice and order methods — you'll trade smarter, keep more returns, and reduce costly surprises.
Keywords: crypto trading, Bitcoin trading, crypto exchanges, crypto investing tips, altcoin strategies — this execution framework helps both spot and derivatives traders improve net outcomes across markets and exchanges, including Canada-focused venues.