Arb Lab
Two pools hold the same pair of tokens and neither knows what the other is doing. When their prices drift apart, the same token can be bought from one and sold into the other in a single round trip. This page is a simulated version of that trade — drag a control and every figure below is recomputed in your browser. Everything here is arithmetic over numbers you chose, and nothing on this page is measured.
Seven steps, each adding one live control: the two pools and the gap between them, a control that opens the gap, a trade size you can push past the point where it stops paying, a button that computes the size that pays most, a fee on each pool, a cost that does not scale with the trade, and finally the trade itself.
Every figure on this page is simulated — arithmetic over numbers you chose, computed in this tab. Nothing here is measured and nothing here is a price: there is no chain, no node, no pool address and no API behind any of it.
Loading the model…
1 Two pools, one pair
Each pool prices its two tokens off its own reserves alone: x × y = k, the same invariant a single constant-product pool uses. Both pools below hold the same k, so they are the same size; the only thing separating them is where on their curve they are sitting, which is their price.
Pool A
Pool B
2 Open the gap
This control moves pool B’s price while holding its k fixed, so the pool stays the same size and only slides along its own curve. Drag it and watch the gap above open and close — and cross zero, which swaps which pool is the cheap one.
A ten percent gap between two pools on one pair would not survive a block on a real network. The range here is deliberately wider than anything you would find, because at a realistic half-percent gap the best trade on a pool this size earns single-digit USD — correct, and impossible to see move.
3 Pick a size
The round trip spends USD on the cheap pool, takes the TKN it gets back, and sells all of it into the dear pool. Both legs pay their own pool’s fee, and both legs move the pool they touch — which is why a bigger trade is not simply a bigger version of a smaller one.
Push the size far enough and the trade stops paying altogether. That is the lesson of this page: an arbitrage is not a gap you collect, it is a gap you can collect part of, and pushing past that part costs you money. The curve below plots the profit at every size the control offers, and the mark on it is where you are.
4 The size that pays most
There is exactly one size that earns the most, and it does not have to be hunted for. Profit as a function of size has a single peak, so setting its derivative to zero gives the answer outright — a square root of the two pools’ reserves and fees, and nothing to search.
The slider moves in whole thousands, so it lands on the nearest step to the exact figure rather than on the figure itself. Both are shown, because rounding one to look like the other would hide the only interesting thing about the difference.
5 A fee on each pool
Each pool takes its fee off the input of the swap it prices, so the round trip pays twice: once in USD on the way in, once in TKN on the way out. Together they carve out a band of prices where no size is worth trading — not a small profit, none at all.
Raise either fee and the shaded band widens. The band depends on the two fees and nothing else — not on how deep either pool is, which is the surprising part: a deeper pool lets you trade more once trading pays, but it does not change whether it pays at all.
The two fees are charged in different tokens, so the page shows them separately and never adds them. Converting one to the other would need a third price on a page that is about two of them.
6 A cost that does not scale
This control adds a flat charge to the round trip: the same amount whatever the trade size. It is a fixed cost and it is a stand-in, not an estimate of anything. It has the shape of what a network charges to include a transaction, and this page has no network, no block and no transaction to measure — so calling it by that name would be claiming a figure nothing here produced.
Raise it and watch the same gap stop being worth taking. Notice what does not move: the best size. A charge that does not scale with the trade shifts the whole profit curve down by a constant, so it decides whether to trade and never how much.
7 Run it
Both legs move the pool they touch: buying pushes the cheap pool’s price up, selling pushes the dear pool’s price down. So the trade that collects the gap is also the trade that removes it, which is the whole reason a gap between two pools is short-lived.
| After the round trip | Pool A | Pool B |
|---|---|---|
| TKN in the pool | — | — |
| USD in the pool | — | — |
| Price afterwards | — | — |
What the model does and does not include
Each leg is one constant-product swap with the fee taken off the input: out = y · in(1−f) ÷ (x + in(1−f)). The round trip is two of those, and everything above is derived from that and nothing else. There is deliberately no block ordering, no mempool, no competing searcher, no failed transaction, no flash loan, no multi-hop route and no fixed cost that varies with congestion. Each of those is real, and each would make this page worse at its one job: the profit at a given size should be something you can check, and a figure a reader can verify unaided is worth more here than a figure that looks realistic.
The two pools, the two token names and every number on this page are invented. Nothing here is a quote, a price, a strategy, a recommendation or financial advice, and the arithmetic is a teaching model rather than a description of any deployed contract or any market.