Documentation Index
Fetch the complete documentation index at: https://mathematicalcompany.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Latency Arbitrage
Use a fast external feed (e.g., Binance WebSocket) to detect price moves before the prediction market book reprices. When the book is stale and a significant move has occurred, trade ahead of the expected repricing.How It Works
- Monitor a fast reference feed (e.g., BTC price on Binance)
- Monitor the prediction market book feed (e.g., “Will BTC hit $100k?”)
- When the reference feed shows a move but the book hasn’t updated (stale):
- Expected price = mid + (ref_change * sensitivity)
- If expected > ask + fees: BUY (market will reprice up)
- If expected < bid - fees: SELL (market will reprice down)
Rust Type: LatencyArbOpportunity
| Field | Type | Description |
|---|---|---|
direction | str | "buy" or "sell" |
expected_price | float | Expected repriced level |
market_price | float | Current market price (ask for buy, bid for sell) |
edge | float | Edge after fees |
staleness_ms | float | Book staleness in milliseconds |
ref_price_change | float | Reference price change |
Engine Method: scan_latency_arb
Pipeline: latency_arb
| Parameter | Type | Default | Description |
|---|---|---|---|
market_id | str | required | Market to trade |
ref_feed | str | required | Fast reference feed |
market_feed | str | required | Prediction market feed |
sensitivity | float | 1.0 | Ref move multiplier |
min_staleness_ms | float | 500.0 | Min book staleness (ms) |
min_edge | float | 0.02 | Min edge after fees |
max_size | float | 20.0 | Max trade size |
fee_rate | float | 0.002 | Fee rate |
auto_execute | bool | False | Auto-execute |
cooldown | float | 2.0 | Seconds between trades |
max_daily_trades | int | 50 | Hard cap on daily trades |
LatencyArbOpportunity in ctx.params["last_latency_arb"].
Safety Controls
- max_daily_trades: Hard cap that resets at midnight. Prevents runaway execution.
- min_staleness_ms: Only trades when the book is genuinely stale, not just slow.
- cooldown: Minimum time between executions.
- Ultra tier gate: Only available to Ultra subscribers.