Polymarket runs fresh Bitcoin Up or Down markets every 5 minutes. These are among the most actively traded short-duration contracts on the platform. Top wallets appear to generate consistent profits not by predicting Bitcoin’s direction, but by ruthlessly exploiting stale liquidity in the CLOB while the underlying spot price moves.
This is a latency + probability arbitrage strategy. The bot doesn’t forecast the future — it simply reacts faster than the order book.
Core Idea
- Connect to Binance WebSocket for real-time BTC price.
- Subscribe to Polymarket’s CLOB WebSocket for the current 5-minute Up/Down pair.
- Calculate true probability based on distance from reference price + momentum + time left.
- Buy the mispriced side (usually at the ask) only when edge exceeds threshold and liquidity is sufficient.
Edge source: Human traders and slow bots leave limit orders that no longer reflect current reality seconds after BTC moves.
1. Market Mechanics
Each 5-minute window has:
- A fixed reference price (BTC price at window start)
- Two binary outcomes: Up (above reference at expiry) and Down
- Continuous trading on Polymarket CLOB during the window
The order book lags because most participants watch the slow UI.
2. Data Feeds
Binance (truth source):
# Raw trade
wss://stream.binance.com:9443/ws/btcusdt@trade
# Aggregated (recommended)
wss://stream.binance.com:9443/ws/btcusdt@aggTrade
Maintain last 60s rolling window + 15s momentum in basis points.
Polymarket CLOB WebSocket:
wss://ws-subscriptions-clob.polymarket.com/ws/market
- Subscribe with token IDs for current Up/Down contracts
- Handle
booksnapshot +price_change+best_bid_ask - Send PING every 10s (critical for keep-alive)
3. Probability Engine (The Math)
def calculate_prob(distance_bp, momentum_bp, seconds_left):
# Weighted score
score = (distance_weight * distance_bp) + \
(momentum_weight * momentum_bp) + \
(time_factor * log_scaling(seconds_left))
# Logistic function
prob = 1 / (1 + math.exp(-score))
return prob
- Distance from reference (heaviest weight)
- Short-term momentum
- Time remaining (logarithmic urgency near expiry)
Calibrate weights via backtesting.
4. Entry Rules (Strict)
Only trade when all are true:
- Edge ≥ 4–8¢ (prob - best_ask)
- Spread ≤ 4¢
- Liquidity sufficient for desired size
- 5–240 seconds remaining
- Daily loss limit not hit
Use Immediate-or-Cancel (IOC) limit orders at current best ask.
5. Order Placement & Auth
Reading order book = public.
Placing orders requires full CLOB auth:
- EIP-712 wallet signature → API key/secret/passphrase
- Every request: HMAC-SHA256 signature + timestamp + headers
Use Polymarket’s official clob-client or equivalent.
6. Infrastructure Requirements
- VPS close to Polymarket servers (London/EU ideal, <40ms RTT)
- NTP-synced clock
- Auto-reconnect logic for both WebSockets
- Local order book reconstruction (don’t trust only
best_bid_ask)
7. Risk Management (Non-Negotiable)
- Max position per market: $25–100
- Daily loss limit: e.g. $50 → hard shutdown
- Max slippage tolerance: 2¢
- Cooldown after losses
- Paper trade extensively before going live
Final Architecture Sketch
while True:
discover_active_market() # parse titles, token IDs, reference price
subscribe_websockets()
on_binance_trade():
update_price_and_momentum()
calc_prob()
if should_trade():
place_ioc_order()
This strategy scales with speed and discipline. Many details (market discovery, reference price capture, exact weights) require careful implementation and testing.
The bot wins by being faster at updating probabilities than the crowd updates their orders.
Warning: This is high-frequency, latency-sensitive trading. Small mistakes compound fast. Start in paper mode and expect to iterate for weeks.
If you have more questions, please feel free to contact me at any time: https://t.me/FatherSon97

Top comments (0)