System Overview
The Polymarket Trading Platform is a hybrid automated trading system built with Node.js and Go. It specializes in identifying market inefficiencies (EV+) across Football, Tennis, Baseball, and Crypto markets.
Main Components
Football/Tennis Scanner
Fetches odds from api-football & HKJC, removes vig, and identifies EV+ opportunities.
live/football/odds_scanner.mjs
Trading Bot
Executes orders, manages trailing stops (+25%), and monitors open positions.
live/football/bot.js
Polymarket Hub
Web dashboard (Port 8421) for portfolio monitoring and manual order management.
polymarket-hub/
Sports Redeemer
Automated service (PM2 cron) that redeems winnings and converts to pUSD.
src/redeemer-sports.js
Running the System
Core Commands
# Start the Football Bot
bash start-football.sh
# Build & Run Polymarket Hub
cd polymarket-hub
go build -o polymarket-hub ./cmd/hub/
./polymarket-hub -config config.yaml
# View Logs
pm2 logs football
pm2 logs polymarket-hub
Configuration
| Key | Recommended | Description |
|---|---|---|
DRY_RUN |
true | Global safety switch |
bet_size |
$2 - $5 | Default stake per trade |
MAX_AUTOBOOK_PRICE |
0.65 | Max share price for auto-buys |
Hub UI Controls
The web dashboard provides controls for each active football trade:
| Button | Action | Description |
|---|---|---|
| Exit | force_tp |
Immediately sells the position at the best available bid price. This is a manual override to exit a trade. |
| TP Lock | block_tp |
Prevents the automated bot from exiting a position. This is used to hold the position until the market resolves, ignoring trailing stop-loss or take-profit signals. |
| Unlock | unblock_tp |
Re-enables the bot's automated exit logic, allowing it to manage the trade based on its pre-defined strategy. |
Quantitative Model
The system uses professional betting mathematics to maintain a statistical edge.
1. Vig Removal (True Probability)
The scanner calculates the "Fair Price" by normalizing bookmaker odds across all outcomes (Home, Draw, Away).
2. Expected Value (EV)
We only trade when the Expected Value is positive:
EV = (True_Probability / Polymarket_Price) - 1
3. Kelly Criterion
Position sizing is determined by Quarter-Kelly (0.25) to maximize growth while minimizing the risk of ruin.
Safety Rules
stop-football.sh or pm2 stop to avoid corrupting the trades.json file.
- Atomic Locking: The system uses a directory-based locking mechanism (
.lock) to prevent multiple scanners from corrupting shared data. - Capital Preservation: A
reserveamount (e.g., $10) is always kept in the wallet and excluded from Kelly calculations. - Price Limits: To ensure the +25% Take-Profit is reachable, the bot avoids buying shares priced above 75 cents.
Architecture
The platform follows a "Scanner-to-Approved" pipeline:
- Scanner identifies EV+ opportunities.
- Successful picks are written to
approved_bets.jsonunder an atomic lock. - Trading Bot reads the JSON and executes Limit Orders.
- Redeemer cleans up winning positions every 30 minutes.