Execution
Polymarket order placement, paper vs live mode, and safety guards for Catalysm bots.
Execution is the last step inside each pipeline run. When the judge returns UP or DOWN, the bot submits an order on Polymarket and logs the result.
Market discovery
Before each run the bot finds the active 15-minute BTC market on Polymarket:
- Query Polymarket for the current window market
- Read the order book: yes/no mids, best bid, best ask, spread
- Resolve YES and NO token IDs for the chosen side
The pipeline schedules runs between 5 minutes and 30 seconds before each 15-minute window boundary so the bot can enter before the interval opens.
Order placement
The judge passes side and notional to the execution layer, which places a fill-or-kill (FOK) order through Polymarket:
- UP: buy the YES token at the current ask
- DOWN: buy the NO token (priced from the YES side of the book)
Notional is capped at a configured maximum order size.
Paper vs live
| Mode | Behavior |
|---|---|
| Paper (default) | Logs intent only; no on-chain order |
| Live | Submits FOK order with wallet credentials |
Live bots on the Bots page run in live mode with dedicated wallets you can verify on Polygon.
Safety guards
Several guards prevent duplicate or runaway exposure:
- Unresolved slug check: skip if the bet log already has an open bet on the same market slug
- Duplicate order guard: skip if a resting order or recent fill exists for the same token
- Daily loss limit: halt trading for the UTC day when cumulative PnL crosses the configured floor
- Exchange rejection: if Polymarket rejects the order, the bot does not record it as a live trade (avoids inflating stats)
Bet logging
After execution (or a skipped window) the bot appends a bet log entry with the full context: signals, score breakdown, gate audit, entry price, and fill status when tracked.
Rejected close calls can optionally generate phantom audit rows at a sample rate so the historian can measure what the gates blocked.
Outcome updates
A separate outcome update step resolves past bets when markets close. It records win/loss, PnL, and exit price so stats and the weekly review have complete data.
Only trades that actually filled on-chain count in public performance stats.
Continuous operation
In continuous mode the bot loops forever: wait until between 5 minutes and 30 seconds before the next window, run the full pipeline, repeat.
