Arbitrage
⭐ 1. What is Arbitrage?
Arbitrage = buying an asset where it’s cheap and selling it where it’s expensive to make risk-free profit.
In crypto:
-
Buy ETH on Binance for $1000
-
Sell ETH on Uniswap for $1020
Profit = $20 (minus fees)
No risk. No holding. No speculation.
Just exploiting a price difference.
⭐ 2. Why Arbitrage Exists in DeFi?
Because AMMs do NOT sync with real market prices automatically.
Example:
Uniswap price = 1 ETH = $1000
Binance price = 1 ETH = $1050
There is a price mismatch.
→ AMM does NOT magically update its price.
→ The pool still thinks ETH = $1000 because reserves haven't changed.
This is where arbitragers step in:
-
They buy cheap ETH from AMM
-
Sell at higher price on Binance
-
Profit
-
In doing so, they fix the AMM price.
⭐ 3. Arbitrage Is the “Invisible Mechanism” Balancing AMMs
Let’s say ETH price rises in the global market:
Binance = $2000
Uniswap pool still = $1000
Arbitrager will:
-
Buy ETH from Uniswap for $1000
-
Sell ETH on Binance for $2000
-
Profit = $1000 per ETH
-
Repeating this many times…
→ ETH in pool reduces
→ USDT in pool increases
→ Price on Uniswap rises naturally via x*y=k
→ price eventually becomes ≈ $2000
This mechanism fixes the pool price.
⭐ 4. Why Arbitrage MUST Exist in AMMs
Because AMMs use a pure mathematical formula for price:
This formula cannot fetch market prices from Binance, Coinbase, etc.
Only arbitrage trades can adjust:
-
Reduce one reserve
-
Increase other reserve
-
Shift price until balanced
Without arbitrage, AMMs would be permanently mispriced.
⭐ 5. Arbitrage Example (Step-by-Step)
AMM pool:
-
10 ETH
-
10,000 USDT
-
Price = 1 ETH = 1000 USDT
Global price jumps to 1500 USDT.
🧠 Arbitrager sees opportunity.
Buy ETH on AMM:
If arbitrager buys 1 ETH from pool:
New reserves:
-
reserveETH = 9
-
reserveUSDT = 11,111
New price inside pool:
Price = 11,111 / 9 = 1234 USDT/ETH
Still cheaper than $1500.
Arbitrager continues.
After enough trades, internal price ≈ external price.
⭐ 6. Arbitrage Creates Impermanent Loss
This is important:
When ETH price changes, LPs lose value because arbitragers extract profit.
Example:
-
ETH rises → arbitragers buy ETH cheaply from pool
-
LP ends up with less ETH (the appreciating asset)
-
This is the mechanism behind impermanent loss
So:
👉 Arbitrage protects AMM pricing
👉 But LPs pay the cost
LPs hope to earn fees to compensate.
⭐ 7. The Arbitrage Equation
To profit:
If:
-
AMM price < market price → buy from AMM, sell on CEX
-
AMM price > market price → buy from CEX, sell on AMM
-
Continue until no profit is possible.
AMMs always give arbitragers risk-free opportunities when prices diverge.
⭐ 8. Arbitrage Bot Behavior (How real bots work)
Real arbitrage bots:
✔ Monitor dozens of DEXs
✔ Monitor dozens of CEXs
✔ Look for price mismatches
✔ Compute profit potential
✔ Submit transaction instantly
✔ Pay high gas (priority fee)
✔ Use Flashbots / MEV protection
✔ Execute atomic multi-step swaps
If two trades happen in one block, bots bundle them.
Example in 1 transaction:
-
Buy 100 ETH on Uniswap
-
Sell 100 ETH on Binance
-
Repay flash loan
-
Keep profit
⭐ 9. What gives arbitragers “power”?
Because AMMs have no idea what the market price is.
They only know:
This price will be wrong until someone moves tokens.
That “someone” = arbitragers.
Arbitrage is not optional → it’s essential for AMMs to function.
⭐ 10. Are arbitragers bad?
NO. They are necessary.
Arbitragers:
✔ Keep AMM price accurate
✔ Prevent price manipulation
✔ Minimize slippage for traders
✔ Enable DeFi to integrate with CEX markets
✔ Maintain pool balance
They are the market maintenance crew of DeFi.
⭐ 11. Arbitrage and IL (Why LPs Lose)
Let’s see why impermanent loss exists:
ETH price rises globally:
-
Arbitragers buy ETH from pool
-
ETH leaves the pool
-
LP ends up with more USDT, less ETH
-
LP misses some of ETH’s price appreciation
-
That difference = impermanent loss
So arbitragers:
-
Win
-
LPs: lose a bit
-
But LPs earn fees from all the trades
The battle is:
Fees earned vs IL taken.
⭐ 12. Arbitrage Code Example (Conceptual)
A basic arbitrage bot in pseudo-code:
Real bots add:
-
Flash loans
-
Gas estimation
-
Slippage calculations
-
Multiple route optimization
-
MEV protection
⭐ 13. Real Example (ETH Price Differences)
Binance: 2000
Uniswap: 1910
Difference: 90 USDT
Arbitrager buys ETH on Uniswap at 1910, sells at 2000.
Profit:
-
Gross: 90
-
Minus gas: ~5–10
-
Net: ~80 USDT per ETH
They keep doing this until price = 2000 inside AMM.
⭐ 14. Summary Table (Interview Level)
| Topic | Explanation |
|---|---|
| Arbitrage | Buying cheap + selling expensive |
| Why needed | AMMs don’t know real market price |
| Who arbitrages | Bots → |
| flash-loan empowered | |
| Effect on pool | Changes reserves → updates price |
| Effect on LP | Causes impermanent loss |
| Effect on market | Keeps DEX prices equal to CEX prices |
⭐ 15. One-Line Summary
Arbitrage is the economic engine that keeps AMM prices correct.
Without arbitrage, AMMs fail.
With arbitrage, LPs face IL but earn fees; the market stays balanced.
Comments
Post a Comment