Smart Execution Engine
Institutional-grade order execution for prediction markets. Every fill optimized, every risk measured, every edge captured.
Five Stages, One Optimal Fill
Every order passes through a five-stage pipeline before it touches the book. Spread analysis, urgency routing, time slicing, fill verification, and post-trade drift detection -- all in under 50ms.
SPREAD
URGENCY
TWAP
VERIFY
AUDIT
Three Urgency Modes, One Spread Analyzer
The router reads the current spread, book depth, and time-to-expiry before selecting an urgency mode. Each mode trades off fill speed against price improvement differently -- because a 2c edge on a deep book is not the same as 2c on a thin one.
Passive
Post limit orders at the best bid/ask. Wait for the market to come to you. Maximum price improvement, slowest fill.
spread < 2c | depth > 500Moderate
Post inside the spread with a midpoint bias. If no fill within the time window, escalate to aggressive.
spread 2-5c | depth 100-500Aggressive
Cross the spread immediately. Take liquidity at the current offer. Fastest fill, no price improvement.
spread > 5c | expiry < 30m09:14:02 DEPTH bid_depth=812 ask_depth=644 ratio=1.26
09:14:03 ROUTE urgency=PASSIVE (spread<2c, depth>500)
09:14:03 ORDER LIMIT BUY 50x YES @ 41c (best bid)
09:14:18 FILL 50x YES @ 41c -- saved 2c vs cross
09:22:41 SPREAD BTC-50K-NO bid=28c ask=34c spread=6c
09:22:41 ROUTE urgency=AGGRESSIVE (spread>5c)
09:22:41 ORDER MARKET BUY 25x NO @ 34c (cross spread)
09:22:42 FILL 25x NO @ 34c -- time-priority fill
Four fill models for every research scenario
Backtesting is only as good as its fill assumptions. Choose the model that matches your risk tolerance, from optimistic instant fills to conservative market impact.
Time-Sliced Fills with Guard Rails
Large orders move markets. TWAP breaks your order into equal time slices and drips them into the book at regular intervals. Each slice checks the current spread before executing -- if the spread blows out past your guard, the slice is skipped.
If cumulative drift from your target price exceeds the abort threshold, the entire TWAP is cancelled and remaining quantity is returned to the strategy for re-evaluation.
- Configurable slice count (default: 5 slices)
- Spread guard threshold (default: 4c max spread)
- Drift abort at 3c cumulative slippage
- Inter-slice jitter to avoid pattern detection
Multi-Leg Simultaneous Fills
Prediction markets create arbitrage when YES + NO don't sum to $1.00, when correlated markets diverge, or when calendar spreads misprice. The engine fires all legs simultaneously -- because a one-legged arb is just a directional bet.
YES/NO Arbitrage
When YES + NO < $0.97, the executor can evaluate both sides together and route a paired order only when the configured spread and risk checks are satisfied.
yes + no < 0.97 | 2-leg atomicCross-Market
Correlated events on different markets diverge. Sell the rich side, buy the cheap side. Convergence captures the spread.
correlation > 0.85 | divergence > 4cCalendar Spread
Same event, different expiry dates. When the term structure inverts, trade the near vs. far leg. Time decay works for you.
term spread > 5c | same underlying11:04:12 ARB YES/NO gap detected: 3c theoretical
11:04:12 LEG-1 BUY 100x YES @ 41c (submitted)
11:04:12 LEG-2 BUY 100x NO @ 56c (submitted)
11:04:13 FILL LEG-1: 100x YES @ 41c OK
11:04:13 FILL LEG-2: 100x NO @ 56c OK
11:04:13 LOCK Cost=97c Payout=$1.00 Profit=+$3.00
11:04:13 RISK Net exposure: $0.00 (fully hedged)
Know When You're the Sucker
Informed traders pick you off when they know something you don't. The adverse selection engine monitors four real-time signals to detect toxic flow -- and pulls your orders before the damage compounds.
VPIN measures order flow toxicity. When it spikes, informed money is moving. Combined with queue position analysis and post-fill drift tracking, you see the danger before your PnL does.
- VPIN toxicity threshold: 0.70 (pull resting orders)
- Queue position decay: cancel if below 20%
- Post-fill drift window: 30 seconds after every fill
- Auto-widen spread after 3 consecutive adverse fills
VPIN Toxicity
Above 0.70 threshold -- informed flow
Queue Position
Above 20% minimum -- position safe
Post-Fill Drift
Adverse drift in 30s window (limit: 3c)
Consecutive Adverse
Below spread-widen trigger
Protect the Portfolio, Not Just the Trade
VaR monitoring runs continuously across your entire portfolio. When tail risk breaches your threshold, the engine scores hedge candidates by cost, correlation, and liquidity -- then executes the optimal hedge at a dynamically calculated ratio.
13:40:01 WARN VaR at 94.9% of limit -- scanning hedges
13:40:02 SCORE Candidate: FOMC-MAR-NO corr=-0.82 liq=HIGH
13:40:02 SCORE Candidate: CPI-APR-YES corr=-0.64 liq=MED
13:40:02 SCORE Candidate: RATE-JUN-NO corr=-0.71 liq=LOW
13:40:03 SELECT FOMC-MAR-NO (best score: 0.91)
13:40:03 RATIO Dynamic hedge ratio: 0.34 (34 contracts)
13:40:03 ORDER BUY 34x FOMC-MAR-NO @ 58c (cost=$4.20)
13:40:04 FILL 34x NO @ 58c -- VaR reduced to $118.40
13:40:04 HEDGE Portfolio VaR now 78.9% of limit (safe)
Test Execution Before You Trade
The fill simulator replays your execution strategy against historical order book snapshots with realistic imperfections. Latency jitter, depth partials, and spread-aware pricing model real market conditions.
Run thousands of simulated fills to measure expected slippage, fill rate, and adverse selection exposure before committing real capital.
- Latency jitter: 10-80ms uniform distribution
- Depth partials: fill ratio based on queue position model
- Spread-aware pricing: midpoint + half-spread impact
- Replay against 30 days of L2 book snapshots
"simulation_id": "sim_a8f2c1",
"strategy": "moderate_twap",
"replay_days": 30,
"total_orders": 2847,
"fill_rate": 0.923,
"avg_slippage_cents": 0.8,
"partial_fill_pct": 0.14,
"latency_model": {
"distribution": "uniform",
"min_ms": 10,
"max_ms": 80,
"p99_ms": 74
},
"spread_impact": {
"avg_spread_cents": 2.4,
"price_improvement_pct": 0.41,
"adverse_selection_rate": 0.08
},
"depth_model": {
"queue_position_algo": "pro_rata",
"partial_threshold": 0.3,
"cancel_replace_latency_ms": 25
}
}
Full Control Over Every Parameter
Every execution behavior is tunable per agent. Simulate first, deploy when ready.
"smart_routing_enabled": true,
"urgency_mode": "auto",
"passive_spread_max_cents": 2,
"aggressive_spread_min_cents": 5,
"twap_slices": 5,
"twap_spread_guard_cents": 4,
"twap_drift_abort_cents": 3,
"vpin_toxicity_threshold": 0.70,
"queue_position_min_pct": 0.20,
"post_fill_drift_window_secs": 30,
"var_limit_dollars": 150,
"hedge_auto_execute": true,
// Fill simulation runs against 30 days
// of L2 book snapshots. Latency jitter
// range: 10-80ms uniform distribution.
}
Stop Leaving Edge on the Table
Measure slippage, compare routing choices, and use execution rules that make trade-offs explicit before orders are sent.