Skip to main content
T TON Adoption
← Glossary
NODE/03 · Term

TWAP

Time-Weighted Average Price — average price over a window with equal time weights. Used both as an execution benchmark and as a manipulation-resistant on-chain oracle.

Aliases: time-weighted average price

TWAP (Time-Weighted Average Price) is the asset’s average price over a window with equal weighting per unit of time. If TON traded for an hour at 5.00 USDT and an hour at 5.10, the 2-hour TWAP is 5.05 USDT.

Why it matters

Two main roles:

  1. Execution benchmark. A trader splitting a large order over time aims to fill near the period’s TWAP. It is the target the order is judged against.
  2. Manipulation-resistant oracle. An on-chain DEX exposes a TWAP over the last N blocks. To shift it, an attacker must hold a manipulated price across the entire window — orders of magnitude more expensive than a single-block manipulation.

TWAP in Uniswap V3 and TON DEXs

Uniswap V3 builds a TWAP oracle directly into the pool. Any contract can read “average price over the last 30 minutes” in one call.

TON DEXs (STON.fi, DeDust) lack a Uniswap V3-style native TWAP. Lending and perp protocols either compute their own TWAP over swap events or take an off-chain feed that already applies a TWAP.

Strengths

  • Manipulation is expensive. Pumping a 30-minute TWAP requires sustaining the anomaly for 30 minutes.
  • Noise smoothing. Micro-volatility and one-off large swaps barely move a long-window TWAP.
  • Volume-agnostic. Unlike VWAP, TWAP behaves the same in quiet and busy markets.

Weaknesses

  • Lag. A 30-minute TWAP can sit far above spot in a fast drop — risky for liquidations.
  • Volume-blind. A wafer-thin tick weights the same as a large fill. On low-liquidity assets this produces unrealistic values.
  • Manipulable on thin liquidity. If the attacker is most of the pool, holding the anomaly is cheap.

TWAP vs VWAP

  • TWAP — lending-protocol oracles, large-trade benchmarks.
  • VWAP — when “average market price” needs to reflect volume.

Inside DeFi oracles, TWAP is the de facto standard; VWAP shows up less often because tracking volume on-chain is harder.

Related terms