You want to sell 500 ETH within an hour. Placing a market order would cause slippage of 0.1–0.3%, and MEV bots would immediately spot the large volume and start hunting your order. Instead, use a TWAP (Time-Weighted Average Price) — split the order into 12 slices of 41.67 ETH every 5 minutes. This reduces market impact to noise and keeps your intent hidden. At $1M volume, savings on slippage can reach $200–500 thanks to limit orders.
We develop custom TWAP algorithms for executing large orders on crypto exchanges. With over 5 years of experience and 50+ implementations, each installation undergoes audit and stress testing. We guarantee stable algorithm performance even in highly volatile markets. Algorithmic trading demands reliable tools, and our TWAP is one of them.
Adaptive TWAP reduces slippage by 40% compared to market execution on volatile pairs — our experience confirms this.
Problems TWAP Solves
- Market impact: A single order of 100 BTC can move the market by 0.1–0.3%. TWAP stretches execution, reducing impact to noise.
- Slippage: On market orders above $100K, slippage can reach 0.05–0.2%. Using limit orders in TWAP reduces slippage but requires a conversion mechanism when orders don't fill.
- Anonymity: Large orders attract MEV bots. Breaking into small slices masks the true volume.
How Adaptive TWAP Works
Simple TWAP — equal slices at equal intervals. Adaptive TWAP adds market-responsive logic:
- Skip an interval if current price is significantly above the TWAP (don't buy expensive).
- Increase slice size if price is below current TWAP.
- Pause during abnormally high volatility (e.g., deviation > 2σ from average).
Why Adaptive TWAP is More Effective Than Simple TWAP
In historical tests, the adaptive approach reduces the average slippage over the market TWAP by 30–40% compared to the simple version, especially noticeable on volatile pairs like ETH/USDT.
Comparison of Slice Execution Methods
| Method | Fill Rate | Slippage | Non-Execution Risk |
|---|---|---|---|
| Market | 100% | 0.05–0.2% | None |
| Limit | ~70–90% | 0–0.05% | High |
| Hybrid | >95% | 0–0.1% | Low |
Hybrid approach: place a limit order at 0.05% above mid-price; if not filled after 80% of interval, convert to market order. We use this method by default.
TWAP vs VWAP
| Feature | TWAP | VWAP |
|---|---|---|
| Volume distribution | Uniform over time | Proportional to market volume |
| Complexity | Low | Medium |
| Ideal scenario | Calm market, predictability | High liquidity, mimicking trading |
| Risk | Non-execution in low liquidity | Complexity in setup |
How TWAP Helps Bypass MEV Bots
MEV bots scan the mempool for large orders. By splitting into small slices, each individual order becomes invisible. Additional randomization of intervals and volumes further prevents pattern detection.
Example Implementation in Python
import asyncio from datetime import datetime, timedelta class TWAPExecutor: def __init__(self, symbol, total_qty, duration_minutes, exchange): self.symbol = symbol self.total_qty = total_qty self.n_slices = duration_minutes // 5 # every 5 minutes self.slice_qty = total_qty / self.n_slices self.exchange = exchange self.executed_qty = 0 async def execute(self): interval = (5 * 60) # seconds for i in range(self.n_slices): await self.execute_slice() if i < self.n_slices - 1: await asyncio.sleep(interval) async def execute_slice(self): remaining = self.total_qty - self.executed_qty qty = min(self.slice_qty, remaining) # Use limit order close to mid-price to save on fees ticker = await self.exchange.fetch_ticker(self.symbol) mid_price = (ticker['bid'] + ticker['ask']) / 2 limit_price = mid_price * 1.0005 # 0.05% above mid order = await self.exchange.create_limit_buy_order( self.symbol, qty, limit_price ) self.executed_qty += qty return order We use the CCXT library to connect to exchanges, providing a unified interface for 100+ trading venues. CCXT GitHub is the de facto standard for this task.
When Should You Use TWAP?
TWAP is optimal when you need to execute a large order discreetly with predictable costs — for example, during portfolio rebalancing, entering/exiting a position, or moving funds between assets. If liquidity is high and you want to adapt to volume, VWAP might be better. While TWAP is often used as an oracle in DeFi, our focus is execution on centralized exchanges.
How We Measure Execution Quality
The key metric is execution quality: average fill price relative to the market TWAP over the period. If our algorithm fills below the market TWAP, we've saved the client money. The report includes:
- For each slice: time, bid/ask spread, quote price, fill price.
- Final slippage report broken down by exchange.
- Chart of cumulative volume and price.
Process
- Analysis: We study trading volume, liquidity, and typical spreads for the pair. Gather requirements: amount, time limit, risk parameters.
- Design: Choose scheme (simple/adaptive), configure volatility sensitivity.
- Implementation: Write code in Python + CCXT, cover with unit tests (core logic) and integration tests (using exchange sandbox).
- Testing: Backtest on historical data (minimum 3 months) and paper-trade in real-time for 2–5 days.
- Deployment: Run on your server or our VPS, set up notifications (Telegram, email).
- Support: Monitor execution during first large orders, adjust parameters if needed.
What's Included
- Documentation: algorithm description, settings, startup parameters.
- Full source code with comments.
- Access to monitoring dashboard (Grafana + PostgreSQL).
- Training for your engineer: 2–3 sessions of 1 hour each.
- Support for 2 weeks after deployment (included).
Additional TWAP Settings
Additional TWAP Settings
- Randomization of slice volumes to counter pattern detection.
- Dynamic interval calculation based on volatility.
- Partial fill handling for limit orders.
We will assess your project within one business day — contact us via messenger or email. Cost is calculated individually, timelines range from 5 to 30 days depending on complexity. Get a consultation now — your large order will no longer be a problem. Order an adaptive TWAP development and save on slippage.







