Arbitrage Bot
The Arbitrage Bot works the current Polymarket BTC up/down market, accumulating hedged YES+NO inventory. It reads the live order book on Binance BTC/USDT to gauge short-term buy vs sell pressure (order-book imbalance, “OBI”) and uses that to time a cheap entry on each leg — buying Up (YES) while pressure is bullish and Down (NO) while bearish. One outcome resolves to $1, so every matched YES+NO pair pays out $1 and the edge is the spread between what the pair cost to assemble and that $1.
- Binance order-book-imbalance (OBI) entry timing
- Builds hedged YES+NO pairs that redeem at $1
- Dynamic per-trade sizing (inventory, price, PnL feedback)
- OBI-flip and profit-take rebalancing, held to resolution
- Auto-rolls to each new BTC up/down window
- Per-window spend cap
The strategy
In a binary market exactly one outcome resolves to $1, so a complete set — one YES and one NO — always pays $1. Assembling that set for less than $1 is locked-in profit. The trick is getting each leg cheaply. Each Binance depth update is reduced to a single OBI value from −100 (heavy selling) to +100 (heavy buying), weighted toward the top of the book; its rolling average gives a directional read:
avg OBI > up threshold ⇒ buy YES · avg OBI < down threshold ⇒ buy NO
The bot leans into the favoured leg first, then buys the opposite leg to hedge when pressure reverses (or to bank a move once price has run past your profit delta) — accumulating matched pairs as the window plays out. Because it only ever buys, both legs are held to the window's resolution, where the winning side redeems at $1. Trading pauses when price leaves the configured band (the market is effectively decided), and sizing is dynamic so the two legs stay roughly balanced.
Settings
| Setting | Default | What it does |
|---|---|---|
baseOrderSize | 5 | Base shares per leg, before dynamic multipliers. |
maxTotalExposureUsd | 250 | Halt new entries once this window's spend is reached. |
obiTrendUpThreshold | 80 | Avg OBI above this times a YES (Up) leg. |
obiTrendDownThreshold | -80 | Avg OBI below this times a NO (Down) leg. |
holdObiThreshold | 20 | Keep adding to a leg while OBI still favours it by this much. |
obiWindowSize | 1 | Rolling window (samples) the OBI average is taken over. |
profitDelta | 0.04 | Rebalance to the other leg once price moves this far past entry ($). |
tradingRangeMin | 0.15 | Below this, treat the market as decided (no entries). |
tradingRangeMax | 0.85 | Above this, treat the market as decided (no entries). |
takerPriceSlack | 0.1 | Added over the ask so taker buys cross and fill ($). |
intervalMinutes | 5 | BTC up/down window length in minutes. |
pollIntervalSeconds | 5 | Heartbeat / status persistence cadence. |