HomeBlogSmart Order Routing: How to Get the Best Price Across DEXs
Strategy10 min readApril 3, 2026

Smart Order Routing: How to Get the Best Price Across DEXs

How smart order routing works for DEX perpetuals, why it can save 30-70% on execution costs, and how to build one with the LiquidView API.

What Is Smart Order Routing and Why Does It Matter?

Smart order routing (SOR) is the practice of automatically directing a trade to the venue — or combination of venues — that offers the best overall execution quality at the time of order submission. In traditional finance, SOR is built into every major brokerage platform and handles billions of dollars of daily volume. In DeFi, it is a competitive advantage that most retail traders still do not have — and that gap is costing them real money every day.

For spot DEX trading, SOR is relatively well understood: aggregators like 1inch or Paraswap split your swap across multiple AMM pools to find the best blended price. For DEX perpetuals, the concept is newer and more complex — you are not just comparing prices, you are comparing execution costs across fundamentally different market structures, fee schedules, and liquidity profiles. Getting this right requires understanding what "best execution" actually means for a leveraged perpetual position.

LiquidView provides the real-time execution cost data across nine DEX perpetual platforms that makes smart routing decisions possible. Whether you use LiquidView's built-in router or build your own with the API, the underlying data is the same.

How Smart Routing Works for Perpetuals: Not Just Price

In spot trading, routing is primarily about finding the best price for an asset swap. For perpetuals, the problem is fundamentally different and more complex. You are not buying an asset — you are entering a position. The "price" you pay is not the mark price itself but rather the cumulative cost of entering and maintaining that position. Smart routing for perps must therefore compare execution costs, not just mid-market prices.

Execution cost for a perp trade has four components: the taker fee, the half-spread (half the bid-ask spread), price impact from order size, and for held positions, the ongoing funding rate. A routing algorithm that only looks at the taker fee will send you to an exchange with a 1.5 bps fee but a 4 bps spread, when you would have been better off on an exchange with a 2.5 bps fee and a 0.5 bps spread. True smart routing must aggregate all four cost components into a single comparable figure.

An additional complication is that perp positions cannot be trivially split across exchanges the way spot swaps can. If you split a $200K BTC long 50/50 across Hyperliquid and Lighter, you now have two separate positions to manage, two margin requirements to maintain, and two sets of funding payments to track. The overhead of managing split positions is a real cost that a routing algorithm must account for. In practice, this means perp routing is usually about selecting the single best venue, rather than splitting across multiple venues as spot SOR commonly does.

  • Taker fee: the exchange's fee schedule for market orders or aggressive limit orders
  • Half-spread: half the current bid-ask spread, representing the cost of "crossing" to execute immediately
  • Price impact: additional cost for large orders that consume multiple levels of order book depth
  • Funding rate: ongoing hourly or 8-hourly cost (or benefit) of holding the position
  • Composite execution cost: sum of fee + half-spread + impact, the key routing metric

For short-term trades (under 4 hours), funding rate differences between exchanges are small relative to entry cost. For positions held longer than 24 hours, funding rate differences can easily exceed entry cost differences — and should be the dominant factor in routing for longer-term holds.

Why Smart Routing Can Save 30–70% on Execution Costs

The claim that smart routing can save 30–70% on execution costs sounds like marketing hyperbole. It is not. LiquidView's data on execution cost variance across exchanges demonstrates this range clearly, particularly for order sizes above $50K.

Consider a $100K ETH-USD market order during a typical trading hour. On the best-available venue (Hyperliquid or Lighter, depending on current depth), all-in execution cost might be 3.5–5 bps. On a mid-tier platform with adequate but not exceptional liquidity, the same order costs 8–12 bps. On a less-liquid exchange, 15–25 bps. The ratio between best and worst is 4–7x. Even comparing Hyperliquid to the third-best option, the gap is regularly 40–60%. Smart routing captures this gap — sending your order to the best venue is the routing decision.

Over a year of active trading, consider a trader executing $5M per month in volume. At a naive average of 10 bps per round trip (entry + exit), total execution cost is $50,000 per month or $600,000 per year. With smart routing to consistently achieve 5 bps per round trip, cost drops to $25,000 per month — a saving of $300,000 per year. For a fund trading $50M per month, the savings scale to $3M per year. This is why institutional desks invest heavily in execution optimization.

For retail traders, the savings are smaller in absolute terms but identical in percentage terms. A trader doing $100K per month who reduces average execution cost from 12 bps to 5 bps saves $700 per month — not enough to quit your job, but meaningful relative to typical trading profits. More importantly, reducing execution cost is one of the few edges that compounds with volume: the more you trade, the more you save.

The 30–70% saving range applies to market orders on orders above $10K. For very small orders (under $5K), price impact is negligible on all exchanges and the routing benefit is smaller — perhaps 10–20% from fee differences alone. Smart routing provides diminishing returns at small trade sizes.

How LiquidView's Router Works

LiquidView's routing engine operates on a simple principle: at the moment you indicate your intent to trade, it queries the real-time state of all nine supported DEX perpetual exchanges and computes the projected all-in execution cost for your specific order on each one. It then presents you with a ranked list showing which exchange offers the best execution for that exact trade, in that exact moment.

The computation happens in under 100 milliseconds. The router retrieves live order book state (bid/ask spread and top-of-book depth), applies the exchange's current fee schedule for your volume tier, and runs the price impact model for your order size against the current depth profile. The result is a cost estimate in basis points for each exchange, accurate to within roughly 0.5–1 bps under normal conditions.

For funded accounts, LiquidView also factors in the current funding rate differential between exchanges. If Hyperliquid has a funding rate of 0.01%/8h and a competitor has 0.005%/8h, and you plan to hold a long position for 48 hours, the routing engine adjusts the effective cost on Hyperliquid upward to reflect the higher cumulative funding payment. This ensures that for longer-hold positions, you are routing to the exchange that minimizes total cost over your anticipated holding period.

Once you have the routing recommendation, execution is manual — LiquidView does not currently auto-execute trades. This keeps the tool accessible to traders at all levels and avoids the complexity of custodial connections to multiple exchanges. You see the recommendation, navigate to the recommended exchange, and execute there.

Building Your Own Router with the LiquidView API

For algorithmic traders and developers, LiquidView exposes its underlying execution cost data through a REST API that can be used to build a custom routing engine. The API provides real-time and historical execution cost data — the same data that powers the LiquidView dashboard — in a machine-readable format suitable for integration into automated trading systems.

A minimal smart router using the LiquidView API requires just a few components: a query function that polls the execution cost endpoint for a given token and order size, a selection function that picks the minimum-cost venue, and an execution module that submits the order to the selected exchange. The entire logic can be implemented in under 100 lines of Python, and the API returns results fast enough for real-time routing decisions.

The API endpoint for execution cost estimation accepts: token (e.g., BTC, ETH, SOL), side (buy or sell), size (in USD), and optionally a holding period in hours for funding-adjusted routing. The response includes an array of objects, one per supported exchange, each containing: exchange name, taker fee in bps, current half-spread in bps, estimated price impact in bps, funding rate adjustment in bps (if holding period specified), and total composite cost in bps. Selecting the minimum total cost entry is your routing decision.

  • GET /api/v1/execution-cost?token=BTC&side=buy&size=100000 — returns cost breakdown by exchange
  • GET /api/v1/execution-cost?token=ETH&side=sell&size=50000&hold=48 — includes funding rate adjustment for 48-hour hold
  • GET /api/v1/depth?token=BTC&exchange=hyperliquid — raw order book depth data for custom impact modeling
  • GET /api/v1/historical-cost?token=BTC&size=100000&from=2026-01-01 — historical execution cost time series for backtesting

When building an automated router, cache the API response for 10–30 seconds before re-querying. Market conditions change, but order book depth typically shifts slowly enough that a 15-second cache is fresh enough for routing decisions on all but the most latency-sensitive strategies.

Real Routing Examples: How the Decision Plays Out

Example 1: $75,000 ETH-USD market buy during peak hours. LiquidView API returns: Hyperliquid (3.8 bps), Lighter (4.1 bps), Paradex (6.2 bps), gTrade (7.5 bps), others 9–18 bps. Router selects Hyperliquid. Trade saves 2.4 bps versus third-best option = $180 on this single trade. Over 50 similar monthly trades, $9,000 in annual savings on ETH entries alone.

Example 2: $30,000 SOL-USD market buy, position expected to be held 72 hours. At entry: Hyperliquid (5.1 bps entry cost) with funding rate 0.012%/8h. Lighter (4.8 bps entry cost) with funding rate 0.008%/8h. Over 72 hours (9 funding periods), Hyperliquid funding totals 0.108% = 10.8 bps. Lighter funding totals 0.072% = 7.2 bps. Funding-adjusted total: Hyperliquid 15.9 bps, Lighter 12.0 bps. Router selects Lighter. Without funding adjustment, router would have selected Hyperliquid and cost 3.9 extra bps = $117 on this $30K trade.

Example 3: $500,000 BTC-USD market sell during low-volatility Asian session. Market is thin. Hyperliquid (8.5 bps), Lighter (14.2 bps), Paradex (22+ bps). Router selects Hyperliquid and adds a recommendation to consider delaying 3–4 hours until peak liquidity hours, when the same trade would cost an estimated 5.2 bps. Waiting saves 3.3 bps = $1,650. This timing recommendation is generated by comparing current cost against the 30-day rolling average cost at peak hours.

In all three examples, the routing decision added meaningful value. The common thread: execution cost varies more across time and venue than most traders realize, and routing systematically captures that variance. The key is having the data in real time.

smart order routingbest pricedex routingoptimization

See it in action

Compare execution costs across 9+ DEX perpetuals in real-time with LiquidView.