What We’re Building
A spot-futures arbitrage strategy that:- Buys on Binance spot when the futures premium is high
- Sells short on Binance futures to hedge the position
- Uses
VenueAwareSizingto allocate capital across venues - Uses
TotalEquityCalculatorto track combined equity - Uses
PairIdGeneratorto link spot and futures legs atomically
Step 1: Multi-Venue Setup
Cross-exchange strategies need multiple entries inSymbolSourceMap and multiple AccountSpec entries:
Step 2: Price Inputs
Each venue has its own FIELD inputs:Step 3: Arbitrage Signal
Compute the futures premium (basis) as the arbitrage signal:Step 4: Per-Venue Equity
Track equity for each venue separately, then combine:TotalEquityCalculator sums equity from all venue-level calculators, giving you a portfolio-wide equity figure for risk management and position sizing.
Step 5: Venue-Aware Position Sizing
VenueAwareSizing allocates capital across venues based on the arbitrage signal:
"equal"— Equal split across venues"proportional"— Split based onallocation_ratio"inverse_hedge"— Spot long, futures short (or vice versa based on signal direction)
- Takes the arbitrage signal (per symbol)
- Allocates total equity to each venue based on config
- For
inverse_hedge: positive signal → buy spot, sell futures; negative → opposite - Outputs target notional per axis_key across all venues
Step 6: Pair ID Generation
Link spot and futures legs so they execute atomically:PairIdGenerator creates a unique pair ID when the same symbol has active signals on multiple venues. This tells the executor to execute both legs atomically — if one leg fails, the other is cancelled.
Step 7: Order Intentions
Create separate intentions for each venue, referencing the shared sizing output:Step 8: Configure and Run
The Complete Graph
Multi-Exchange Variant
The same pattern works across different exchanges:Key Considerations
Funding rate arbitrage
For spot-futures basis trading, the main return comes from collecting funding rates. When futures trade at a premium:- Long spot (earn the asset)
- Short futures (collect positive funding every 8 hours)
- Net return ≈ funding rate × time
Execution risk
- Leg risk: One leg fills but the other doesn’t.
PairIdGeneratormitigates this by linking legs - Timing: In live mode, both orders are submitted simultaneously
- Slippage: Use LATENT mode backtest to estimate realistic execution costs
Capital efficiency
Related Pages
Supported Exchanges
Exchange matrix with fees, leverage, and data
Funding Rates
How funding rate simulation works in backtest
Liquidation Logic
Per-exchange margin and liquidation rules
Code Parity
Same arb strategy runs from backtest to live

