Optimal trade size on Uniswap
Every AMM trade has two costs: a fixed gas fee and a variable slippage. Trade too small and gas dominates. Trade too large and slippage does. The optimal size sits exactly at the crossover.
Why this matters
On Ethereum mainnet a typical Uniswap V3 swap costs ~$3–8 in gas. On Arbitrum it's less than $0.05. If you trade $50 on Ethereum and pay $5 in gas, that's a 10% overhead before slippage. The optimal size is the point where gas cost = slippage cost.
The formula
For a constant-product pool (x·y=k), the total cost as a fraction of trade size A is:
Where R = pool TVL × 0.5 (single-sided depth), gas = network fee in USD, fee = pool fee. Minimising gives the exact optimal A:
The √(2·gas·TVL) approximation is commonly cited but overestimates optimal size by up to 2× — OrnyTools uses the exact constant-product derivation, not the shortcut. est souvent citée mais surestime la taille optimale jusqu'à 2× — OrnyTools utilise la dérivation exacte à produit constant, pas le raccourci. se cita frecuentemente pero sobreestima el tamaño óptimo hasta 2× — OrnyTools usa la derivación exacta de producto constante, no el atajo.
Practical steps
1. Load the target pool by address (or pick from the curated list). The optimizer fetches TVL and fee live from GeckoTerminal. 2. Check the gas estimate — the optimizer auto-fills based on the selected network. 3. The result gives you the optimal size, the expected slippage at that size, and the total cost breakdown.
Open Trade Size Optimizer →Aave V3 health factor — what it means and when to act
The health factor is Aave's single number summary of how close your position is to liquidation. Below 1.0, a liquidator can take your collateral.
The formula
Aave computes health factor as:
Where LT is the liquidation threshold per asset (e.g., WBTC = 75%, USDC = 85%). When HF drops to 1.0, your weighted collateral exactly equals your debt — any further drop and a liquidator takes over.
Estimated liquidation price
If you have a single collateral and single debt position, you can estimate the price level at which liquidation triggers:
This assumes all collateral value moves together. Real portfolios with mixed assets are more complex — use the Dashboard to see the on-chain estimate directly from the Aave V3 contract.
The Position Dashboard reads your HF, collateral, debt, and margin-to-liquidation directly from the Aave V3 contract — no wallet connection needed.
Check my position →GMX liquidation price — how to calculate it
On GMX, leveraged positions get liquidated when collateral drops to the maintenance margin. The exact liquidation price depends on opening fees, borrow fees, and leverage.
The formula (long position)
Where fees = opening fee (0.07% × 2 × size) + accrued borrow fees, and MAINT = 1% of position size. The higher your leverage and the longer you hold, the closer your liquidation price moves toward entry.
GMX V2 fee structure
Opening fee: 0.07% of position size, charged each way (open + close = 0.14% round-trip). Borrow fee: approximately 0.01%/hour on the borrowed portion. For a 5× leveraged $1,000 trade, borrowed = $4,000 → borrow fee ≈ $0.40/hour.
The GMX V2 Calculator lets you input size, leverage, and collateral, fetches the live BTC or ETH price, and outputs liquidation price, break-even, opening fees, and max borrow fees — all in one view.
Open GMX Calculator →Uniswap V3 range selection — concentrated liquidity explained
In Uniswap V3, you earn fees only while the price stays within your chosen range. Narrower range = higher yield per dollar, but more frequent out-of-range periods.
Capital efficiency formula
The capital efficiency multiplier compared to full-range V2 liquidity is:
A range of ±20% gives CE ≈ 5.5× — you need 5.5× less capital to provide the same depth as a V2 position. Narrower to ±10% gives CE ≈ 11×, but any wick beyond those bounds earns nothing.
The V3 Range Optimizer takes a pool, your capital, and a target range and shows you projected daily fees, capital efficiency, and time-out-of-range estimate based on recent volatility.
Open V3 Range Optimizer →Impermanent loss — when does it become permanent?
Impermanent loss (IL) is the opportunity cost of holding assets in an AMM pool vs. holding them in a wallet. It's "impermanent" only if the price returns to entry.
The formula
For a 50/50 pool with a price ratio of r (current price / entry price):
At 2× price move (r=2): IL ≈ −5.7%. At 5× (r=5): IL ≈ −25.1%. The loss is symmetric — a 5× price move up or down gives the same IL because the pool rebalances both ways.
Enter your entry price ratio and see IL across a range of scenarios. The IL Calculator also shows what fee yield you'd need to break even at each price level.
Open IL Calculator →