Triangular Arbitrage Bot
Triangular arbitrage routes capital through three tokens in a closed loop to capture price misalignment. Start with USDC, swap to WETH, swap to WBTC, swap back to USDC. If the three pairwise prices are misaligned by enough to cover gas + fees, you end with more USDC than you started. In any market with three or more assets, the pairwise prices must be consistent: if 1 WETH = 3,000 USDC and 1 WBTC = 60,000 USDC, then 1 WBTC must equal 20 WETH. When the WBTC/WETH pool deviates from 20 — say 20.05 — there's a triangular arbitrage opportunity. On Ethereum DEXs, three-leg paths typically cost 60–200 basis points combined (gas + fees + slippage). On Binance, where each leg only costs 0.1% (or 0.075% with BNB rebate), the threshold to profitable opportunities is much lower — and competition is far tighter.
Triangular arbitrage is a subset of crypto arbitrage and works on both centralized exchanges (Binance, Coinbase) and Ethereum DEXs (Uniswap, Curve, Balancer). This guide explains the routing math, path-finding algorithms, and why DEX triangular arbitrage is harder than CEX triangular arbitrage.
- What is triangular arbitrage?
- Three-leg routing on Uniswap
- Triangular arbitrage on Binance
- Hummingbot triangular arbitrage setup
- Why DEX triangular arbitrage is harder than CEX
What is triangular arbitrage?
In any market with three or more assets, the pairwise prices must be consistent. If 1 WETH = 3,000 USDC and 1 WBTC = 60,000 USDC, then 1 WBTC should equal 20 WETH. When the WBTC/WETH pool deviates from 20 — say it's actually trading at 20.05 — there's a triangular arbitrage opportunity: convert WBTC → USDC → WETH → WBTC and end with more WBTC than you started, because one of the three pairs is mispriced.
On a single venue (one CEX, or one DEX), triangular arbitrage is well-understood and very competitive. Every trading firm runs it. Spreads are usually 0.01–0.10% per opportunity, and the bot that detects + executes fastest wins.
Three-leg routing on Uniswap
On Uniswap, a triangular arbitrage path is three sequential swaps in a single atomic transaction:
- Swap USDC → WETH on Uniswap V3 USDC/WETH 0.05% pool.
- Swap WETH → WBTC on Uniswap V3 WETH/WBTC 0.30% pool.
- Swap WBTC → USDC on Uniswap V3 WBTC/USDC 0.30% pool.
Each leg incurs the pool's fee + price impact. The combined cost must be less than the price misalignment for the opportunity to be profitable. Path-finding algorithms (Bellman-Ford, SPFA) continuously evaluate every possible 3-leg cycle across the universe of tracked pools to identify profitable opportunities.
Triangular arbitrage on Binance
Binance offers thousands of trading pairs, including most three-token combinations. Triangular arbitrage on Binance is one of the most popular automated strategies because: trades are atomic at the venue level (no on-chain settlement), fees are low (0.1% standard, 0.075% with BNB rebate), latency is low (millisecond order placement). The trade-off is competition — every major retail bot platform supports Binance triangular arbitrage out of the box, so spreads are razor-thin and only the fastest bots capture them.
Hummingbot triangular arbitrage setup
Hummingbot is the most credible open-source triangular arbitrage tool. Configuration involves: defining the three tokens (e.g., BTC/ETH/USDT), connecting your exchange API keys, setting minimum profit threshold (typically 0.1–0.3%), and starting the strategy. Hummingbot continuously monitors the three pairs, calculates the arbitrage opportunity each tick, and executes when the threshold is met. Spreads on Binance triangular arbitrage are tight enough that you'll see opportunities mostly during high-volatility windows; in steady markets, the strategy will sit idle.
Why DEX triangular arbitrage is harder than CEX
On a CEX, each leg of a triangular arbitrage executes against an order book at the posted bid/ask — the cost is the spread plus fees. On a DEX, each leg incurs the pool's fee (5–100 bps) plus price impact (which scales with trade size). Three DEX legs typically cost 60–200 basis points combined, while three CEX legs cost 30–60 basis points. The gross spread on a DEX triangular arbitrage opportunity has to be substantially larger to net profit. As a result, DEX triangular arbitrage tends to be opportunistic — concentrated in moments when a large trade pushes one of the three pools out of equilibrium — while CEX triangular arbitrage runs continuously. Production MEV bots like the one behind JaredFromSubway include triangular paths as part of their broader DEX arbitrage engine but rely on sandwich attacks and flash-loan arbitrage for the majority of profit.
Further reading and references
- Flash Boys 2.0 (Daian et al., 2019) — Includes triangular arbitrage detection and competitive bidding analysis on Ethereum.
- Flashbots MEV-Inspect (arbitrage classification) — Open-source pipeline that classifies multi-hop arbitrage transactions, including 3-leg and 4-leg cycles.
- Uniswap V3 whitepaper — Concentrated liquidity mechanics — required reading for routing arb cycles through V3 pools.
On-chain arbitrage — funded from its own capital (zero flash-loan fees) or flash loans (zero capital at risk), whichever nets more — runs from managed low-latency infrastructure, every trade settling on-chain and independently verifiable. Backed by a 30-day money-back guarantee.
See plans →