Why Cost Modeling Matters
A strategy that trades 2× daily with 0.04% taker fees on Binance futures pays ~29% annually in fees alone. Ignoring this — or using a flat 0.1% assumption — produces backtests that have no resemblance to reality. ClyptQ models costs at the venue level: each exchange-account pair has its ownCostModel with maker/taker fees, slippage, and tick size.
CostModelSpec
CostModelSpec is the user-facing configuration for cost modeling. It’s specified per AccountSpec:
Fields
How Fees Are Calculated
taker_fee. Limit orders always pay the maker_fee.
For LATENT mode (orderbook simulation), maker/taker is determined dynamically:
- Maker: limit price is better than best bid/ask (order rests in book)
- Taker: limit price crosses the spread (order fills immediately)
How Slippage Is Applied
Fee Resolution Priority
ClyptQ resolves fees throughVenueFeeResolver with a clear priority chain:
1. User Override (Highest Priority)
If you specify aCostModelSpec in your AccountSpec, it takes absolute precedence:
2. CCXT Auto-Fetch
For crypto exchanges without explicit overrides, ClyptQ fetches current fee schedules from the exchange API via CCXT:3. Fallback Default
If all resolution methods fail, the fallback matches typical Tier 0 futures rates:Orderbook-Based Execution (LATENT Mode)
When orderbook data is available, BacktestFactory uses theBacktestSimulator to match orders against the book:
- Price impact: large orders walk the book and get progressively worse prices
- Partial fills: if liquidity is insufficient, only available quantity fills
- Maker/taker detection: limit orders that rest in the book pay maker fees
Example: Full Cost Configuration
Cost Impact Analysis
To understand how much costs affect your strategy, compare backtests with different cost configurations:Related Pages
Exchange Specifics
Per-exchange fee tables, minimum order amounts, and market type support
Execution Pipeline
How Intention → Delta → Order → Fill works with cost models

