Iceberg Large Order Execution Algorithm Development
Iceberg order is a technique for hiding the true size of a large order. Only the "tip of the iceberg" is visible in order book — small visible volume. When filled, the next slice automatically posts. Counterparties don't know there's large volume behind this order.
Problem of Large Orders
If you place limit buy 500 BTC in order book — it's instantly visible to everyone. Market makers raise price (front running). HFT algorithms detect large demand and buy higher, then sell to you. Market starts moving against you before execution.
Iceberg Order Mechanics
Visible part: small "display qty" (e.g., 1 BTC from 100 BTC). Hidden part: remaining volume stored locally, invisible in order book. Automatic replenishment: when visible part fills, next slice automatically posts.
Slice size variation: random size each slice (1–3 BTC instead of fixed 1 BTC) — harder for algorithms to recognize pattern.
Price variation: each new slice posts with small random offset from target price.
Market Condition Adaptation
import random
class IcebergExecutor:
def __init__(self, symbol, total_qty, target_price, exchange):
self.total_qty = total_qty
self.remaining = total_qty
self.target_price = target_price
self.exchange = exchange
def get_slice_size(self):
# Random slice size: ±30% from base
base_slice = self.total_qty * 0.02 # 2% of total
variance = base_slice * 0.3
return base_slice + random.uniform(-variance, variance)
def get_slice_price(self, side):
# Random deviation to reduce predictability
variance = self.target_price * 0.0001 # 0.01%
offset = random.uniform(-variance, variance)
return self.target_price + offset
async def execute(self, side='buy'):
while self.remaining > 0:
slice_qty = min(self.get_slice_size(), self.remaining)
price = self.get_slice_price(side)
order = await self.exchange.create_limit_order(
self.symbol, side, slice_qty, price
)
# Wait for fill or timeout
filled = await self.wait_for_fill(order['id'], timeout=30)
self.remaining -= filled
# Pause between slices (random)
await asyncio.sleep(random.uniform(1, 5))
Detection and Detection Evasion
HFT systems can recognize iceberg orders by fill pattern. Evasion methods:
- Random intervals between slice placements
- Multiple accounts on different sub-accounts
- Combining with TWAP/VWAP logic — slices placed based on market volume
- Dark pool usage: Binance Block Trade, OTC desk for very large orders
Execution Monitoring
Real-time tracking: fill percentage, average fill price vs target, market price movement during execution (proxy for market impact).
Stack: Python asyncio + CCXT, PostgreSQL for execution logs. Simple web interface for launching iceberg orders, monitoring progress, canceling if needed.







