Token Impact

How We Calculate Price Impact

Our methodology for calculating slippage and comparing exchange liquidity

The Problem with Quoted Prices

When you see a price like "$95,000 per BTC", that's the mid-price—the average of the best bid and best ask. But when you actually execute a trade, you don't get that price. You get whatever prices are available in the orderbook.

Orderbook Walking Algorithm

To calculate true execution cost, we "walk" the orderbook, consuming liquidity level by level until your order is filled.

For Buy Orders

We consume the ask side from lowest to highest price. You pay the price at each level until your full quantity is filled.

For Sell Orders

We consume the bid side from highest to lowest price. You receive the price at each level until your full quantity is sold.

Worked Example

Let's say you want to buy 10 BTC and the orderbook looks like this:

Ask Side (Sell Orders)
$95,0103.0 BTC
$95,0052.0 BTC
$95,0005.0 BTC

Step 1: Buy 5.0 BTC @ $95,000 = $475,000

Step 2: Buy 2.0 BTC @ $95,005 = $190,010

Step 3: Buy 3.0 BTC @ $95,010 = $285,030

Total: 10.0 BTC for $950,040

Average Fill Price: $95,004

Price Impact Formula

Price impact measures how much worse your execution is compared to the mid-price:

Price Impact = ((avgFillPrice - midPrice) / midPrice) × 100

Using our example above, if the mid-price is $94,995:

= (($95,004 - $94,995) / $94,995) × 100

= ($9 / $94,995) × 100

= 0.0095% price impact

For buy orders, positive impact means paying more than mid-price. For sell orders, negative impact means receiving less than mid-price.

Data Sources

We fetch real-time orderbook data directly from exchange APIs:

  • BN
    Binance/api/v3/depth — up to 5000 levels
  • CB
    Coinbase/products/book — top 50 levels (Level 2)
  • KR
    Kraken/0/public/Depth — up to 500 levels

Data Freshness

  • Orderbook data is fetched fresh for every calculation
  • Results show a timestamp indicating when data was captured
  • Data older than 5 seconds is flagged as potentially stale
  • 24-hour volume data is cached for 5 minutes

Calculation Outputs

For each exchange, we calculate:

FieldDescription
avgFillPriceWeighted average execution price
totalCostTotal amount spent (buy) or received (sell)
priceImpactPercentage difference from mid-price
volumePctYour order as % of 24h volume
depthConsumedNumber of orderbook levels consumed
fillableWhether full quantity can be filled

Limitations

  • Snapshot data: Orderbooks change rapidly; actual execution may differ
  • No fees included: Trading fees vary by exchange tier and are not factored in
  • Market orders only: This calculates impact for immediate execution, not limit orders
  • Visible liquidity: Hidden orders and iceberg orders are not captured