Calculation method
How MoonMath calculates pool arbitrage
Multi-pool Arbitrage Simulator — Is a cross-pool price gap executable?
The formula
Two sequential constant-product swaps — buy in one pool, sell in the other — with net profit being the proceeds minus the input and the gas cost.
What it reads
- Reserves and fees for both the buying and the selling pool
- The input amount in dollars
- An estimated gas cost for the whole route
What it assumes
- Each pool's quote side is treated as dollar-valued, so no quote-asset price risk enters the round trip
- Both legs execute against the entered reserves with no other trade in between: the reserves are a frozen snapshot
- The gas figure is one lump estimate for every transaction in the route
- Reserves must be positive and each fee below 100%
What this does not establish
- The quoted spread between the two pools is a pre-trade gap, not an achievable profit — the executed legs decide that
- It does not establish that the route is winnable: no competition, extraction, failed-transaction cost or ordering is modelled
- Moving tokens between the two venues is assumed free and instant
- It does not apply to concentrated-liquidity or stable-swap venues, which cannot enter the constant product
Run it
Simulate a two-pool arbitrage round trip after pool fees, price impact and gas. A visible price gap is not necessarily executable profit.
Open the Pool Arbitrage calculatorHow the market itself works
This page describes MoonMath's arithmetic. The mechanics section describes the market: how an order book forms a price, why order-book depth is not the same thing as pool liquidity, and what a public book does and does not let you observe.
Read the market mechanics