Resolved Markets logoResolved Markets logo
Abstract blue gradient background with a soft light streakAbstract blue gradient background with a soft light streak
Tutorial

A Discord bot that watches the order book

Wire prediction-market data into a Discord bot that posts spread, depth, and price-move alerts to your channel, a monitoring and notification bot, built on read-only order-book data.

8 min read · Updated Jun 22, 2026

  • Monitor + alertBot type
  • REST + WebSocketData source
  • ~2s live feedCadence
  • Read-only dataTrades

A Discord bot is one of the most satisfying first projects on market data: it turns a quiet API into a channel that pings you when something moves. This one watches the current order book on active markets, a convenience layer over the historical snapshot archive that is the platform’s core, and posts alerts on spread, depth, and price shifts. A notifier, not a trader.

To be clear up front: this is a monitoring bot. Resolved Markets is a read-only data platform, it does not place orders on Polymarket. What the bot does is watch the data and tell your channel when a condition you care about is met.

What the bot watches

Spread alerts

Ping the channel when the bid-ask spread widens past a threshold, often a sign of an event or thinning liquidity.

  • Threshold on spread
  • Per-market or per-category
  • Catch the widening early

Price moves

Post when the implied probability jumps by more than X over a short window, the market changing its mind.

  • Mid-price deltas
  • Configurable window
  • Direction in the message

Depth shifts

Flag when resting depth on one side drops sharply, hinting that support or resistance is being pulled.

  • Bid/ask depth totals
  • Imbalance flips
  • Liquidity warnings

How it stays current

For most channels, polling the live orderbook endpoint on a short timer is plenty. For a steadier feed without a polling loop, subscribe to the WebSocket instead, it pushes the current book roughly every two seconds. Either way the bot only posts when a rule fires, so your channel stays signal, not noise. Note that the live feeds cover active markets; anything historical comes from the snapshot archive.

Monitor, don’t execute

Alerts, not order placement

The bot reads data and notifies, it never trades. That is by design: the platform is read-only. If you want to act on an alert, you do it yourself on Polymarket. Keeping the bot to monitoring also keeps it simple, safe, and easy to reason about.

A sensible rule pipeline

The difference between a useful alert bot and a noisy one is the rule layer between the data and the channel. Each broadcast or poll gives you a fresh snapshot; the bot compares it to recent state, decides whether anything crossed a threshold, and only then formats a message. Keep state small, a short rolling window per market is enough for spread, depth, and trend comparisons.

  1. 1Resolve the markets you care about, pass ids directly, or look them up from friendly slugs like btc-updown-1h.
  2. 2Fetch the current book on each tick, from the live orderbook endpoint or the WebSocket push.
  3. 3Compare against a short rolling window: spread change, mid-price delta, depth drop, imbalance flip.
  4. 4Debounce, suppress repeat fires within a cooldown so one event does not spam the channel.
  5. 5Format a compact embed and post it via your bot or a channel webhook.

Tuning so the channel stays signal

Pick honest thresholds

Set spread and move thresholds relative to each market’s normal range, a 1-cent move means different things on a tight book and a wide one.

  • Per-market baselines
  • Relative, not absolute
  • Fewer false pings

Add a cooldown

A short per-rule cooldown stops a single volatile moment from firing the same alert ten times in a row.

  • Debounce per market
  • One event, one ping
  • Quieter channel

Match cadence to need

Poll on a timer for casual channels; subscribe to the WebSocket when you want the steadier ~2-second push without a loop.

  • Polling for one-offs
  • WebSocket for steady feeds
  • Paid tiers for WS
Beyond hard rules

Let an agent watch the book

The same data is exposed over MCP, every tier includes it, so an AI agent in Claude or your own tooling can read the live orderbook and snapshot history and post a written read, not just a threshold trip. It is still read-only: the agent observes and reports.

A good alert bot earns its place by staying quiet. The rules, not the data, are what you spend your time on.

Build the alert feed

The docs cover the live orderbook endpoint and the WebSocket stream that power the alerts.

Frequently asked questions