Polymarket Late-Entry Trading Bot
General Polymarket bot guides cover CLOB wiring and risk limits. This post is about a specific strategy I shipped as open source: polymarket-trading-bot.
The edge is not predicting BTC direction. It is capturing mispriced uncertainty in the final 30-60 seconds before a 5 or 15-minute market resolves.
Install guide and dashboard demo: casatrick.github.io/polymarket-trading-bot
The core idea
When a BTC 15-minute market has 45 seconds left and YES sits at 0.88, the market still prices 12% reversal risk. The bot asks: is that 12% warranted, or is the order book too thin to reflect reality?
Entry: Buy YES at 0.88
Payout: 1.00 on resolution
Gross return: (1.00 - 0.88) / 0.88 = +13.6%
Net after ~2% fee: ~+11.6%
Time to resolution: <60 seconds
The edge exists because liquidity providers often pull quotes near resolution, creating temporary mispricings on otherwise near-certain outcomes.
Entry conditions (all required)
| Condition | Threshold | Why |
|---|---|---|
| YES probability | > 0.85 | Below this, risk/reward breaks down |
| Time remaining | 5-60 seconds | Outside window, edge disappears |
| Order book spread | < 2% of implied | Wide spread destroys fill quality |
| Asset | BTC only | Deepest Polymarket liquidity |
| Timeframe | 5m and 15m | More orderly final candle vs 1h |
When edge disappears
Break-even win rate ≈ entry price (0.88 → need 88%+ wins)
After 2% fee: need win rate > entry + 0.02
After 3% slippage: edge is gone
The dashboard tracks an Edge Score in real time:
Edge Score = (actual win rate - implied probability) × 100
+5.0 = healthy (beating market expectations)
0.0 = break-even before fees
-3.0 = stop trading
Three trading modes
Paper (default) - real market data, simulated fills with realistic slippage (0.3-3%). Run 50-100 paper trades before live.
Live - Polygon wallet + CLOB execution. Locked behind an explicit confirmation dialog - the bot will not trade real capital by accident.
Backtest - replays historical data with slippage models (None, Low,
Realistic, Severe). Always backtest with Realistic - the None model
overstates edge.
Risk manager: three hard rules
1. Spread guard (abort)
Max spread = implied_probability × 0.02
If actual spread exceeds threshold → ABORT
2. Slippage halt
Rolling 10-trade average slippage above 3% → halt session. At 3% slippage, a 0.88 entry edge is fully consumed.
3. Drawdown protection
- 8% drawdown from peak → pause
- 15% drawdown → full stop
Dashboard panels
The Next.js dashboard includes eight monitoring views:
- Market scanner with countdown timers and entry signals
- Win rate, slippage, fee drag, edge score metrics
- Spread monitor with 2% abort threshold
- Cumulative P&L (gross vs net)
- Full trade log with fill prices and outcomes
- Backtest config with equity curve output
Fee drag is the metric most traders ignore. At ~2% per trade and high frequency, fees can consume a large share of gross returns - the dashboard tracks this explicitly.
Production server placement
For 60-second entry windows, latency matters:
| Location | Latency to CLOB | Verdict |
|---|---|---|
| Dublin (AWS eu-west-1) | <5ms | Best |
| Amsterdam | ~10ms | Good |
| US East Coast | ~130ms | Too slow |
Polymarket geoblocks many regions. A Dublin VPS gives low latency and a non-blocked IP simultaneously.
Quick start
git clone https://github.com/casatrick/polymarket-trading-bot.git
cd polymarket-trading-bot
npm install
cp .env.example .env.local
npm run dev # paper mode defaultRequired keys for live: Polymarket API credentials + wallet private key. Paper and backtest work without a funded wallet.
How this differs from my other bots
| Project | Strategy focus |
|---|---|
| polymarket-trading-bot | Late-entry probability capture, BTC 5/15m |
| polymarket-arbitrage-bot | Multi-strategy arbitrage (TypeScript) |
| polymarket-arbitrage-bot-python | 5-strategy Python scanner + ranking |
For production architecture patterns (reconciliation, kill-switch, PnL attribution), see the general Polymarket trading bot guide.
Disclaimer
This software is for educational and research purposes. Prediction market trading carries substantial risk. Past backtest performance does not guarantee live results. Always start with paper trading.
Need a custom Polymarket bot or dashboard? Contact me.