Definition
Slippage is the amount by which the actual fill price deviates from the expected price:
Slippage = |fill_price - expected_price|
In perpetuals on Hyperliquid this is usually a few cents per BTC contract; in thin altcoin perps or with large market orders it can be several dollars.
Sources
- Spread — the difference between best bid and best ask. The minimum slippage on a market buy is half the spread.
- Order size vs. depth — an order larger than top-of-book fills deeper into the liquidity book.
- Latency — the price moves between signal detection and order arrival. Not dramatic at a 30s loop interval; decisive in HFT.
- Price spikes — liquidation cascades, news events.
Why backtests can be fooled by this
Standard backtesters compute on close prices. In reality, fills happen at the next tick, not exactly at the close. A strategy that looks marginally profitable in a backtest can turn negative live due to slippage — especially at high trade frequency.
How Botty handles it
backtesting/config.py → FEE_PER_FILL models fees + implicit slippage combined (configurable, default 0.05%). This is more conservative than modeling fees alone.
In live mode: - Botty places limit orders where possible — price guaranteed, slippage = 0 (at the cost of fill risk). - Stop-loss orders are stop-market — fill guaranteed, but slippage is possible during fast moves. - During thin-liquidity windows such as weekends or overnight, slippage is higher.
Reducing it
- Split orders into smaller pieces (iceberg / TWAP) — not relevant at Botty's volume.
- More liquid instruments — the BTC perp usually has 100x more depth than small alts.
- Avoid quiet hours — typically Sunday evening UTC.