Slippage: Calculate the Difference Between a Reference and Your Fill

Slippage compares an execution result with a stated reference. To measure it usefully, record the direction, quantity, time and fee treatment before calculating a percentage. These worked examples use hypothetical prices to distinguish the average execution price from the total cost and from a swap’s minimum acceptable output.

Slippage compares an execution result with a stated reference. To measure it usefully, record the direction, quantity, time and fee treatment before calculating a percentage. These worked examples use hypothetical prices to distinguish the average execution price from the total cost and from a swap’s minimum acceptable output.

One purchase, three different measurements
101.2Weighted execution price
1.2%Difference from a reference of 100
101.4024Unit cost including the example fee

Five hypothetical units, two price levels and a 0.2% quote-currency fee. These are calculations, not live quotes.

BTKWIN.COM · EDUCATIONAL EXAMPLE

Choose the reference before measuring the difference

A buyer generally benefits from a lower purchase price, while a seller benefits from a higher sale price. Therefore, an increase in price cannot be called adverse slippage without first identifying the direction of the trade. Record the reference price and why it represents your expectation: the best available ask, the best bid, a saved full-size quote or another clearly identified benchmark.

An exchange’s last trade is not necessarily a price available for your complete order. A midpoint is also not a promise that someone will trade with you there. Comparing an executed purchase against either number may be useful for a particular analysis, but it answers a different question from comparing it against a saved executable quote. Keep that distinction visible in your trading record.

Calculate a weighted purchase price

Suppose two units are available at 100 and three more at 102. You purchase all five, assuming that the offers remain available and ignoring fees initially. The first part costs 200 and the second costs 306. Total executed value is 506, giving a weighted average price of 506 divided by five, or 101.2.

FillQuantityUnit priceValue
First level2100200
Second level3102306
Total5101.2 average506

Taking the simple average of 100 and 102 would produce 101, which overlooks the unequal quantities. Use the same weighted method even if an order has dozens of small fills. Add the executed value of every fill and divide by the total filled quantity. An unfilled remainder contributes neither an executed quantity nor a hypothetical price to this calculation.

State the direction of the percentage

Against a purchase reference of 100, the adverse difference is (101.2 − 100) ÷ 100 × 100 = 1.2%. If your saved preview already quoted 101.2 for the full five units and execution matched it, the difference against that preview is zero. These statements are compatible because their references differ. Do not switch between them halfway through an explanation.

For a sale referenced to 100 and filled at 99.4, the adverse difference is (100 − 99.4) ÷ 100 × 100 = 0.6%. A sale at 100.3 instead improves on the reference by 0.3%. A spreadsheet can use a consistent adverse-difference convention, with a negative number indicating improvement, provided the convention is written beside the calculation.

Separate four possible causes

The first cause is order size relative to available liquidity. Our purchase needed two price levels even though no time passed in the hypothetical book. The second is a change between observation and matching: other participants can trade or cancel orders before yours reaches the market. A screenshot describes a moment, not a reservation of liquidity.

The third cause is an unsuitable reference, such as treating a small quote as a full-size offer. The fourth is mixing a fee-inclusive cost with a price that excludes fees. Product terminology also varies. The Uniswap developer glossary illustrates why you should read a service’s definition before comparing a displayed slippage number with your own calculation. Record the inputs rather than relying on the label alone.

Account for commissions independently

Add a hypothetical 0.2% fee paid in the quote currency to our purchase value of 506. The fee is 1.012 and total spending is 507.012. The raw average fill remains 101.2. Dividing the full spending by five gives an inclusive unit cost of 101.4024. Its difference from 100 is 1.4024%, but that percentage now combines the execution-price difference with the commission.

If the fee is deducted from the purchased asset, use the actual net quantity received when calculating inclusive cost. If it is paid in a third token, record the conversion rate and its time. A later withdrawal is another transaction with another cost. The transfer fee calculator can help isolate that component without rewriting the original execution price.

Understand what a swap tolerance permits

Consider an illustrative swap preview expecting 100 output units with a minimum acceptable receipt of 99. That minimum is an execution condition, not an instruction to deduct exactly one unit. Receiving 99.8 does not leave a missing 0.8 that should have been charged. Read the displayed minimum itself because rounding, exact-input and exact-output conventions can affect how percentages translate into token amounts.

The Uniswap swap documentation describes output and input constraints. A wider tolerance accepts a broader range of possible outcomes; it does not create liquidity or repair an incorrect token address. A narrower condition may prevent completion. For an on-chain attempt that reverts, network fees may still be consumed even when the swap does not complete; inspect the receipt and the execution route.

Compare order controls without promising execution

A buy limit of 100 for five units in our example could fill the two units offered at 100 while leaving three unpurchased, subject to its time-in-force instructions. The limit controls acceptable execution prices; it does not ensure that the desired quantity becomes available. An incomplete purchase is a different outcome from obtaining all five at the desired price.

Check the product’s current rules for market protection, cancellation and partial execution. The Coinbase Exchange limit-order documentation provides one service-specific example of controlling price with a limit. Availability and semantics vary by venue. Avoid transferring a protection percentage, order option or matching assumption to another market without checking its rules.

Review an actual trade in five steps

  1. Save the order identifier, pair, direction, time and individual fills.
  2. Calculate total executed value, filled quantity and weighted average.
  3. Identify a documented reference from the relevant decision or preview time.
  4. Measure the directional price difference, then calculate fees separately.
  5. Check the order’s remaining quantity and final status before submitting a replacement.

If the reference was not saved, you can still calculate execution price and inclusive cost, but you cannot reliably reconstruct the original expectation from today’s market. Mark the benchmark as unavailable. Likewise, splitting a purchase does not guarantee a better combined result: compare all fills and all fees across the complete sequence. For an unclear on-chain result, use the transfer diagnostic helper and keep recovery words and private keys out of screenshots or support messages.

Continue reading

English content and examples reviewed: 27 October 2026. Read the Arabic edition.

تامر طعمه
تامر طعمه
Articles: 484