Slippage and Fee Simulator: Real Trading Cost Analysis
Calculate real trading costs including slippage, order book depth, market impact, and taker vs maker fees. Understand how trading costs affect strategy profitability.
Slippage and Fee Simulator: Real Trading Cost Analysis
A buddy of mine backtested a trading strategy that showed 40% annual returns. He deployed it live, and by month three he was down 8%. The difference? His backtest ignored slippage, bid-ask spreads, and fees. Those "tiny" costs ate his entire edge and then some.
The gap between a strategy that looks profitable on paper and one that actually makes money in the real world usually comes down to one word: costs. Let's break them down.
Photo by Maxim Hopman on Unsplash
Understanding Slippage
Slippage is the gap between what you expected to pay and what you actually paid:
Slippage = |Expected Price â Fill Price| / Expected Price Ă 100
Positive Slippage: You got a better price than expected. Rare, but delicious.
Negative Slippage: You got a worse price. The more commonâand more painfulâvariety.
What Causes It:
- Market volatility during execution
- Thin liquidity at your desired price level
- Your order exceeding what's available at the top of the book
- Network latency between submission and execution
The Bid-Ask Spread
The bid-ask spread is the most fundamental trading costâwhether you see it or not:
Spread = Ask Price â Bid Price
Spread % = Spread / Mid Price Ă 100
Example:
Bid: $100.00, Ask: $100.05 â Spread: 0.05% (5 basis points).
Typical Spreads:
- Large-cap equities: 0.01â0.05%
- Small-cap equities: 0.10â0.50%
- Major forex pairs: 0.01â0.03%
- Bitcoin: 0.01â0.10%
- Altcoins: 0.10% and up
Order Book Depth Analysis
The order book tells you what's available at each price level:
Level 1: Best bid and ask
Level 2: Multiple levels with quantities
Level 3: The full resting order book
Example:
You want to buy 10,000 shares:
- 5,000 at $100.00
- 3,000 at $100.01
- 2,000 at $100.02
Average fill: $100.007. Slippage: 0.007%. Tiny, but it adds up.
Market Impact Models
Large orders don't just take from the bookâthey push prices around:
Square Root Law:
Price Impact â â(Trade Size) / â(ADV)
Double your order size, and impact grows by about 40% (â2 â 1.41). Not linearâthankfully.
Linear Impact Model:
Impact = k Ă â(Order Size / Daily Volume), where k varies with market conditions.
Maker vs Taker Fees
Most exchanges charge differently based on whether your order adds or removes liquidity:
Maker Fee: Your order rests on the book, providing liquidity. Usually cheaper.
Taker Fee: Your order crosses the spread, consuming liquidity. Usually pricier.
Typical Ranges:
- Maker: 0.02â0.10%
- Taker: 0.04â0.20%
- Volume discounts available on most exchanges
Example:
Trading $100,000 with 0.02% maker / 0.04% taker fees:
- As maker: $20
- As taker: $40
That's a 2Ă difference. Be a maker when you can.
Total Cost of Trading
The full picture combines everything:
Total Cost = Spread Cost + Slippage + Commission + Market Impact
Example:
Buy $50,000 of stock:
- Spread (0.03%): $15
- Expected slippage (0.02%): $10
- Commission (0.03%): $15
- Market impact (0.01%): $5
- Total: $45 (0.09%)
Under 0.1%? That's actually pretty good.
Slippage in Different Market Conditions
Low Volatility: Tight spreads, minimal slippage, smooth execution.
High Volatility: Wider spreads, more slippage, possible delays.
Market Open/Close: Higher volume but also higher volatility.
News Events: Extreme slippage possible during major announcements. Brace yourself.
Limit Orders and Execution Quality
Limit orders give you price controlâbut they come with their own trade-offs:
Benefits:
- Set your maximum buy price (or minimum sell price)
- Potential for positive slippage
- No slippage beyond your limit
Risks:
- May never fill if the price doesn't reach your limit
- Partial fills in fast-moving markets
- Thin markets can leak information about your intentions
Cryptocurrency-Specific Considerations
Crypto markets throw extra challenges at you:
24/7 Markets: No closing auction, prices evolve continuously.
Fragmented Liquidity: Orders spread across multiple exchanges.
Higher Volatility: Bigger slippage potential.
Variable Fees: Different structures everywhere.
Network Fees: Blockchain transaction costs for withdrawals.
Strategy Backtesting Adjustments
If your backtest doesn't account for execution costs, it's a fantasy:
Minimum Assumptions:
- Bid-ask spread: Half the average spread
- Slippage: 0.01â0.05% depending on market
- Commission: Your actual broker fees
- Partial fills: Factor in realistic fill rates
Overfitting Risk:
A strategy that only works without transaction costs won't survive contact with the real market.
Reducing Trading Costs
Practical moves to keep costs in check:
- Use limit orders whenever possible
- Trade during high-liquidity periods
- Split large orders into smaller chunks
- Pick exchanges with favorable fee structures
- Use maker orders to qualify for lower fees
Conclusion
Real trading costs go far beyond what's printed on your commission statement. Slippage, spreads, market impact, and fee structures decide whether your strategy survives contact with live markets. Model these costs honestly in your backtesting, or prepare for a rude surprise.