Skip to content

Why Multi-DEX Aggregation?

Single-DEX data is incomplete, biased, and risky. Here's why aggregation matters.

The Problem with Single-DEX Data

Price Manipulation

A single DEX pool can be manipulated with flash loans, sandwich attacks, and oracle manipulation.

Liquidity Fragmentation

Liquidity is spread across multiple DEXes. Checking only Uniswap might show $2,450 while BaseSwap has $2,451.

Stale Data

Some DEXes update slower than others. A single-DEX price might be 5-10 seconds behind.

How 4SEC Solves This

Uniswap ($2,450.30) ──┐
BaseSwap ($2,450.35) ──┼──> 4SEC API ──> VWAP: $2,450.31
SushiSwap ($2,450.28) ─┘    3 sources, spread: 0.07%

Volume-Weighted Average Price (VWAP)

VWAP = Sum(price_i x liquidity_i) / Sum(liquidity_i)

More weight to DEXes with deeper liquidity = more accurate price.

Spread Detection

  • < 0.1% — Healthy, liquid market
  • 0.1% - 0.5% — Normal, some arbitrage opportunity
  • > 0.5% — Potential manipulation or low liquidity

Arbitrage Opportunities

When spreads are significant, we calculate:

  • Buy price (lowest DEX)
  • Sell price (highest DEX)
  • Estimated gas cost
  • Net profit after fees

Comparison

FeatureSingle DEX4SEC Aggregated
Price accuracyBiasedVWAP
Manipulation resistanceVulnerableProtected
Arbitrage detectionNoneReal-time
Liquidity awarenessSingle poolMulti-pool
Data freshnessVaries30s cache

Released under the MIT License.