Backtesting with Fees and Slippage: Accurate Cost Modeling

Realistic crypto strategy backtesting is impossible without accounting for all costs: commissions, slippage, and funding rates. Ignoring these factors leads to inflated expectations — a strategy showing 30% annualized on historical data can easily turn negative in reality. For example, a strategy ex

Blockchain Development Services

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1450
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1309
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    1004
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1270
  • image_logo-advance_0.webp
    B2B Advance company logo design
    719
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1011

Realistic crypto strategy backtesting is impossible without accounting for all costs: commissions, slippage, and funding rates. Ignoring these factors leads to inflated expectations — a strategy showing 30% annualized on historical data can easily turn negative in reality. For example, a strategy executing 100 trades per month with a 0.1% taker fee eats 10% of capital annually. Add market impact and funding, and you see the true return.

We develop systems that honestly account for all trading costs, including exchange fees, slippage, and funding rates. This approach reveals true performance and avoids illusions. One client shared a strategy showing 40% annualized on historical data without costs. After adding real fees and slippage, the return dropped to 12%, and with funding rate to 5%. This is a typical scenario where illusions turn into disappointment. We know how to avoid that. Order a cost model and get truthful analysis.

Why Backtesting Without Fees Is Useless

Even tiny costs accumulate: a 0.1% taker fee per trade with 100 trades per month consumes 10% of capital annually. Add slippage, and a strategy that seemed profitable turns negative. A realistic backtest must include:

  • Exchange fees: maker/taker, VIP discounts, rebates
  • Slippage: market impact, bid-ask spread, gap slippage
  • Funding rate for futures: payments every 8 hours
  • Indirect costs: latency, network fees

One client brought a strategy with 25% annualized on historical data without fees. After including the real fee schedule and slippage, the result dropped to 9%, and with funding rate to 4%. Only then did they realize that trading low-volume futures was consuming all profits. Our hybrid approach to slippage modeling helps avoid such surprises: it is at least twice as accurate as a fixed value on real data.

How to Correctly Account for Slippage

There is no single model. For low-volume strategies, a fixed percentage suffices. For large orders, a market impact model is needed — slippage grows with position size relative to candle volume. We use a hybrid approach: a combination of fixed spread and volume impact. Here is an example implementation of fixed slippage:

class FixedSlippage(SlippageModel): def __init__(self, slippage_pct: float = 0.0005): self.slippage_pct = slippage_pct def get_fill_price(self, order_price: float, bar, side: str) -> float: if side == 'BUY': return order_price * (1 + self.slippage_pct) else: return order_price * (1 - self.slippage_pct) 

And for volume-dependent slippage:

class VolumeImpactSlippage(SlippageModel): def __init__(self, impact_factor: float = 0.1): self.impact_factor = impact_factor def get_fill_price(self, order_price: float, bar, side: str, order_size_usd: float = 0) -> float: bar_volume_usd = bar.volume * bar.close market_impact = self.impact_factor * order_size_usd / bar_volume_usd if bar_volume_usd > 0 else 0 if side == 'BUY': return order_price * (1 + market_impact) else: return order_price * (1 - market_impact) 

Fee Structure: Realistic Schedules

Many strategies are designed for a specific exchange, so it is essential to incorporate its fee schedule. Here is an example for Binance Spot with VIP tiers:

@dataclass class FeeSchedule: maker_fee: float taker_fee: float vip_tiers: list[tuple[float, float, float]] = None def get_fee(self, order_type: OrderType, volume_30d: float = 0) -> float: if self.vip_tiers and volume_30d > 0: for min_vol, maker, taker in sorted(self.vip_tiers, reverse=True): if volume_30d >= min_vol: return maker if order_type != OrderType.MARKET else taker if order_type == OrderType.MARKET: return self.taker_fee else: return self.maker_fee BINANCE_SPOT = FeeSchedule(maker_fee=0.001, taker_fee=0.001, vip_tiers=[(1_000_000, 0.0009, 0.001), (5_000_000, 0.0008, 0.0009), (20_000_000, 0.0007, 0.0008)]) 

Funding Rate for Futures

For perpetual strategies, funding is a significant cost. We incorporate historical rates and calculate the total payment over a period:

class FundingRateModel: def __init__(self, funding_interval_hours: int = 8): self.interval = funding_interval_hours self.funding_history: dict[str, pd.Series] = {} def calculate_funding_cost(self, symbol, position_value, from_ts, to_ts, position_side) -> float: if symbol not in self.funding_history: return 0.0 rates = self.funding_history[symbol] mask = (rates.index >= from_ts) & (rates.index < to_ts) period_rates = rates[mask] total_funding = 0.0 for rate in period_rates: if position_side == 'LONG': funding_payment = -position_value * rate else: funding_payment = position_value * rate total_funding += funding_payment return total_funding 

What Cost Accounting Delivers: A Comparison

We test strategies in two modes: ideal (no costs) and realistic. The difference is striking:

Metric Ideal With Fees
Annualized Return +32% +18%
Sharpe Ratio 1.4 0.9
Fees as % of Gross P&L 0% 1.2%
Cost Type Impact on Annual Return
Taker fee only (0.1%) -12%
Taker fee + 0.05% slippage -18%
Taker + slippage + funding (1% annual) -25%

According to Binance, the average taker fee is 0.1%. More about slippage can be read on Wikipedia.

Case: Hidden Costs in a Real Example We analyzed a client's strategy that showed 25% annualized on an ideal backtest. After including real fees and slippage, the result dropped to 9%, and with funding rate to 4%. The client was surprised, but this helped them revise their approach. One client saved over $12,000 per year thanks to our analysis.

How We Do It: Our Process

  1. Analysis — study the strategy, its trading frequency, volumes, target exchange.
  2. Design — select fee and slippage models, tune parameters.
  3. Implementation — write the backtesting engine with data integration (historical candles, funding).
  4. Testing — run on synthetic and real data, verify via Tenderly.
  5. Deployment — deliver documentation, code, and a monitoring dashboard.

What's Included (Deliverables)

  • Cost model documentation
  • Source code of the engine (Python, integrated with your stack)
  • Integration with historical exchange data
  • Analysis of divergence between ideal and realistic backtest
  • 14 days of support after delivery

Common Pitfalls in Cost Accounting

  • Using only fixed slippage without volume dependency
  • Ignoring funding rate for long-term futures strategies
  • Overlooking VIP discounts for volumes >$1M
  • Treating bid-ask spread as constant without considering volatility

Timeline and Pricing

Development time: 5 to 15 business days depending on strategy complexity and number of exchanges. Pricing is individual — contact us for a same-day estimate. Our team has 5+ years of backtesting experience and has completed over 30 cost-modeling projects. Typical client savings reach up to $5,000 per year by uncovering hidden costs.

We guarantee model realism within 5% of actual trading results. Get in touch to request a consultation and order development. Receive a system that does not hide costs but reveals the real picture.