Overview
The execution pipeline converts strategy graph outputs into actual trades. It operates identically in backtest, paper, and live modes — only the fill engine changes.The Three Stages
Stage 1: Intention
An intention declares where you want to be, not what to buy or sell:Stage 2: Delta Calculation
The executor computes the delta between current position and target position:Stage 3: Order Execution and Fill
The delta is converted to an order and executed by the fill engine:Order Types
TimeInForce options:
GTC (Good Till Cancel), IOC (Immediate or Cancel), FOK (Fill or Kill), POST_ONLY
Execution Modes: INSTANT vs LATENT
INSTANT mode
Orders fill at the current bar’s close price with BPS-based slippage:LATENT mode
Orders fill against a simulated orderbook with depth-dependent slippage:TradingDriver: The Orchestrator
TheTradingDriver manages the complete lifecycle:
What from_spec() does
- Expands specs — Resolves SymbolSourceMap, ObservationSpecs, AccountSpecs
- Computes warmup — Traces graph backward to find minimum ticks needed
- Creates TradingState — Initializes cash, positions, margin for each account
- Creates executor —
BacktestFactoryfor backtest/paper,LiveFactoryfor live - Loads data — Parquet for historical, WebSocket for live
- Auto-injects funding — Adds
FundingRateSpecfor futures accounts
What each tick does
TickResult
Each iteration yields aTickResult:
Post-analysis
TradingState
The executor maintains portfolio state asTradingState, exposed to the graph as STATE: inputs:
State updates after every fill:
Cost Application
Fee calculation
- User override in
CostModelSpec - Auto-fetched from exchange via CCXT
- Fallback defaults (0.02% maker, 0.05% taker)
Slippage
INSTANT mode: BPS-basedFunding rates
For futures positions, funding is applied at settlement ticks (every 8 hours for most exchanges):Liquidation
After every fill, the executor checks margin ratio:Safety Features (Live Mode)
Execution Mode Differences
TP/SL in Backtest
Take-profit and stop-loss orders are simulated with OHLC-aware logic:Related Pages
Cost Models
Fee resolution, slippage, and VIP overrides
Liquidation Logic
Per-exchange margin and liquidation formulas
TradingSpec
Complete configuration hierarchy
Code Parity
Why the same pipeline runs in all modes

