OpenClaw + Polymarket: Build an AI Agent That Monitors Prediction Markets Automatically

Blog image

What's up, automation builders — if you've ever stared at a Polymarket market refreshing it manually while waiting for a probability to cross a threshold, this one's for you. I'm Hanks. I spend my time running AI agents through real workflows, not demos. This is the setup I actually built and tested.

Here's the question I was sitting with: can I get OpenClaw to watch a Polymarket market, detect when something interesting happens, and ping me on Telegram — without me touching it?

The answer is yes. But the path to "yes" has some sharp corners, and I want to show you exactly where they are.

Never built an OpenClaw skill before? Start with our Build Your First OpenClaw Skill guide, then come back here to implement this automated Polymarket monitoring workflow.


What Is Polymarket and Why Automate It?

Blog image

Polymarket API Overview (markets, prices, liquidity endpoints)

Polymarket is a prediction market platform running on the Polygon blockchain. You trade outcome tokens — each token represents a probability, priced between $0 and $1. If "Yes" trades at $0.73, the market implies a 73% chance of that outcome occurring.

Blog image

As of February 2026, the Polymarket API is organized into three distinct services:

API Service
Base URL
Purpose
Gamma API
Market metadata, search, discovery
CLOB API
Live prices, order books, trading
Data API
User positions, trade history

The API offers 23 REST endpoints and 2 WebSocket endpoints, enabling real-time market data access, automated trading bots, and AI integration — with real-time data streaming via WebSockets for up to 10 instruments simultaneously.

For our monitoring skill, we only need Gamma (to discover markets) and CLOB (to read live prices). No wallet, no private key, no trading — these are public read endpoints.

Real Use Cases: Price Alerts, Portfolio Tracking, News-Based Triggers

Here's what makes automating Polymarket genuinely useful (and what I've actually run):

  • Probability threshold alerts: Ping me when "Will X happen?" crosses above 0.75 or drops below 0.25 — that's usually when markets are reacting to real news
  • Portfolio snapshot: Every morning at 8am, summarize the current probabilities of 5 markets I care about
  • Volatility spike detection: Alert when a market moves more than 10 percentage points in 30 minutes
  • News-triggered check: When a relevant news event fires (via RSS or another skill), immediately query the related market

These aren't hypothetical. By the time I'd run this setup for a week, I'd caught two significant market moves I would have missed scrolling manually.


How OpenClaw Can Interact with Polymarket

Blog image

Reading Market Data via Polymarket API

The read-only CLOB endpoints require no authentication. Here's what the core data flow looks like:

Step 1 — Find a market's token ID via Gamma:

curl "https://gamma-api.polymarket.com/markets?active=true&limit=5" \
  -H "Accept: application/json"

Each market in the response has a conditionId and one or more clobTokenIds. The clobTokenId for the "Yes" outcome is what you hand to the CLOB API.

Step 2 — Get the live midpoint price:

# Replace TOKEN_ID with the clobTokenId for "Yes"
curl "https://clob.polymarket.com/midpoint?token_id=TOKEN_ID"

Response:

{ "mid": "0.73" }

That 0.73 = 73% implied probability. That's your core signal.

Step 3 — Get order book depth (for liquidity checks):

curl "https://clob.polymarket.com/book?token_id=TOKEN_ID"

Public endpoints allow up to 60 requests per minute; WebSocket connections for live data streaming have virtually no restrictions. For a polling-based monitor skill running every 5 minutes across 10 markets, you're nowhere near the limit.

Using an OpenClaw Skill to Parse and Act on Market Signals

Blog image

OpenClaw uses AgentSkills-compatible skill folders to teach the agent how to use tools. Each skill is a directory containing a SKILL.md with YAML frontmatter and instructions. OpenClaw loads bundled skills plus optional local overrides, and filters them at load time based on environment, config, and binary presence.

The mental model for our use case: the skill teaches the agent what Polymarket is and how to query it. The agent then uses its bash tool to run the actual fetch, evaluate the result, and fire a Telegram message if a threshold is crossed.

This is different from a plugin (which registers a new tool). A skill is pure instructions + context. No compilation, no TypeScript, no build step. Easier to iterate.


Building the OpenClaw Polymarket Monitor Skill

Skill Template Setup (folder structure, config, permissions)

Skills live in your workspace, usually ~/.openclaw/workspace/skills/. Create a new folder for your skill.

mkdir -p ~/.openclaw/workspace/skills/polymarket-monitor
touch ~/.openclaw/workspace/skills/polymarket-monitor/SKILL.md
touch ~/.openclaw/workspace/skills/polymarket-monitor/markets.json

Your folder structure:

~/.openclaw/workspace/skills/
└── polymarket-monitor/
    ├── SKILL.md          # Skill definition (instructions + metadata)
    └── markets.json      # Your watchlist of markets + thresholds

The markets.json watchlist:

{
  "markets": [
    {
      "label": "Fed rate cut by June 2026",
      "tokenId": "21742633143463906290569050155826241533067272736897614950488156847949938836455",
      "alertAbove": 0.75,
      "alertBelow": 0.25
    },
    {
      "label": "Bitcoin above $100k by end of 2026",
      "tokenId": "YOUR_TOKEN_ID_HERE",
      "alertAbove": 0.80,
      "alertBelow": null
    }
  ]
}

To find real token IDs: query https://gamma-api.polymarket.com/markets?active=true&limit=20 and look for clobTokenIds in the response.

Enable bash execution in your OpenClaw config if you haven't already:

// ~/.openclaw/openclaw.json
{
  "skills": {
    "entries": {
      "polymarket-monitor": {
        "enabled": true,
        "env": {
          "TELEGRAM_BOT_TOKEN": "your-bot-token",
          "TELEGRAM_CHAT_ID": "your-chat-id"
        }
      }
    }
  }
}

Changes to skills are picked up on the next agent turn when the watcher is enabled. The skills.load.watch option (default: true) watches skill folders and refreshes the skills snapshot automatically.

Fetching Market Prices (Code Walkthrough with API calls)

Here's the SKILL.md definition for the full monitor skill:

---
name: polymarket_monitor
description: Monitors Polymarket prediction market probabilities and sends Telegram alerts when thresholds are crossed.
---
# Polymarket Monitor Skill
When asked to "check Polymarket" or "run Polymarket monitor", do the following:
1. Read the watchlist from `{baseDir}/markets.json`
2. For each market in the list, fetch the current midpoint price using curl:

curl -s "https://clob.polymarket.com/midpoint?token_id=<tokenId>"

3. Parse the "mid" value as a float (this is the implied probability, 0.0–1.0)
4. Compare the probability to alertAbove and alertBelow thresholds
5. If a threshold is crossed, send a Telegram alert (see alert instructions below)
6. Log all results to {baseDir}/monitor_log.json with timestamps
## Telegram Alert Format
Send via curl to the Telegram Bot API:

curl -s -X POST

"https://api.telegram.org/bot$TELEGRAM\_BOT\_TOKEN/sendMessage"&#x20; -d "chat_id=$TELEGRAM_CHAT_ID"

-d "text=🚨 Polymarket Alert: <label> is now at <probability>% (threshold: <threshold>)"

## Safety Rules
- Never attempt to place trades or interact with any trading endpoint
- Only use GET requests to the CLOB and Gamma APIs
- If a fetch fails, log the error and continue to the next market (don't halt)
- Rate limit: wait 1 second between market fetches

Setting Threshold Triggers (e.g., probability > 0.7 or < 0.3)

The threshold logic is handled inside the skill instructions — the agent evaluates the condition and decides whether to fire an alert. But here's a more robust pattern: a small Node.js helper script the agent can call, which handles the comparison and formats the alert cleanly.

// ~/.openclaw/workspace/skills/polymarket-monitor/check.mjs
import { readFileSync } from 'node:fs';
import { appendFileSync } from 'node:fs';
const WATCHLIST_PATH = new URL('./markets.json', import.meta.url).pathname;
const LOG_PATH = new URL('./monitor_log.json', import.meta.url).pathname;
async function checkMarkets() {
  const { markets } = JSON.parse(readFileSync(WATCHLIST_PATH, 'utf-8'));
  const results = [];
  const alerts = [];
  for (const market of markets) {
    try {
      const res = await fetch(
        `https://clob.polymarket.com/midpoint?token_id=${market.tokenId}`
      );
      const { mid } = await res.json();
      const prob = parseFloat(mid);
      const triggered =
        (market.alertAbove !== null && prob >= market.alertAbove) ||
        (market.alertBelow !== null && prob <= market.alertBelow);
      results.push({ label: market.label, prob, triggered, ts: new Date().toISOString() });
      if (triggered) {
        alerts.push({ label: market.label, prob });
        console.log(`ALERT: ${market.label} = ${(prob * 100).toFixed(1)}%`);
      } else {
        console.log(`OK: ${market.label} = ${(prob * 100).toFixed(1)}%`);
      }
      // Respect rate limits
      await new Promise(r => setTimeout(r, 1000));
    } catch (err) {
      console.error(`ERROR fetching ${market.label}: ${err.message}`);
    }
  }
  // Append to log
  appendFileSync(LOG_PATH, JSON.stringify({ checkedAt: new Date().toISOString(), results }) + '\n');
  
  // Output alerts for agent to process
  if (alerts.length > 0) {
    console.log('ALERTS_JSON:' + JSON.stringify(alerts));
  }
}
checkMarkets();

Update your SKILL.md to call this script:

When running the monitor, execute:
```bash
node {baseDir}/check.mjs

Then parse any lines starting with "ALERT:" and send those as Telegram messages.

### Sending Alerts to Telegram or Slack (webhooks & bot tokens)
**Telegram setup (5 minutes):**
1. Message [@BotFather](https://t.me/BotFather) → `/newbot` → get your `BOT_TOKEN`
2. Start a chat with your bot, then get your chat ID:
   ```bash
   curl "https://api.telegram.org/bot<BOT_TOKEN>/getUpdates"

Look for "id" inside "chat" in the response.

  1. Test it:
curl -s -X POST \  "https://api.telegram.org/bot<BOT_TOKEN>/sendMessage" \  -d "chat_id=<CHAT_ID>&text=Polymarket+monitor+is+live"

Slack setup (alternative):

Create an Incoming Webhook in your Slack workspace and use it like this:

curl -s -X POST \
  -H 'Content-type: application/json' \
  --data '{"text":"🚨 Polymarket Alert: Fed rate cut market is at 78%"}' \
  "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"

Add the webhook URL to openclaw.json under env.SLACK_WEBHOOK_URL and reference it in the skill instructions.


Scheduling the Skill to Run Automatically

You have three options, ordered by reliability:

Option 1 — OpenClaw's built-in scheduler (simplest):

Tell your agent via Telegram or Slack:

"Every 15 minutes, run the Polymarket monitor skill and send me any alerts."

The agent will use its cron scheduling capability to register this as a repeating task. Survives gateway restarts.

Option 2 — System cron (most reliable for production):

# Add to crontab: crontab -e
*/15 * * * * openclaw agent --message "Run the Polymarket monitor skill" >> ~/.openclaw/workspace/logs/polymarket-cron.log 2>&1

Option 3 — Node.js interval script (best for VPS or always-on setups):

// poller.mjs — run with: node poller.mjs
import { execSync } from 'node:child_process';
const INTERVAL_MS = 15 * 60 * 1000; // 15 minutes
function runMonitor() {
  try {
    console.log(`[${new Date().toISOString()}] Running Polymarket monitor...`);
    execSync('node ~/.openclaw/workspace/skills/polymarket-monitor/check.mjs', {
      stdio: 'inherit'
    });
  } catch (err) {
    console.error('Monitor run failed:', err.message);
  }
}
runMonitor(); // Run immediately on start
setInterval(runMonitor, INTERVAL_MS);

For VPS deployments, run this with pm2 (pm2 start poller.mjs --name polymarket-monitor) for auto-restart on crash.

Scheduling Method
Reliability
Setup Time
Works Offline?
OpenClaw built-in scheduler
Good
30 seconds
No (needs gateway)
System cron
Excellent
2 minutes
Yes
Node.js + pm2
Excellent
5 minutes
Yes

Extending the Skill: Advanced Monitoring Ideas

Blog image

Once the basic monitor is running, here's where it gets interesting. I've tested or partially built each of these.

Multi-market dashboards: Schedule a daily digest that queries all markets in your watchlist and formats a summary table. Tell the agent: "Every morning at 7am, send me a Polymarket digest with current probabilities for all markets in my watchlist." The agent will format it cleanly in the Telegram message.

Volatility spike detection: Add a second field to markets.jsonlastProb — and update it each run. If |currentProb - lastProb| > 0.10 in a single poll cycle (15 minutes), that's a spike worth alerting. Markets rarely move 10 points without a real reason.

News + market correlation workflows: Combine with an RSS skill (or a news API skill from ClawHub) to trigger an immediate market check when a relevant keyword appears in headlines. The agent can join these two skills without you writing glue code — just describe the workflow in AGENTS.md.

Auto-logging to Notion or Sheets: Add a Notion or Google Sheets skill and instruct the agent to append each monitor run's results to a tracking spreadsheet. After a month, you'll have a dataset of market movements with timestamps — useful for backtesting your own intuitions.


Important Disclaimers (Not Financial Advice)

Let me be direct about what this setup is and isn't.

This is a monitoring tool, not a trading bot. The skill as built only reads data and sends notifications. It does not place orders, manage positions, or interact with any wallet. Keep it that way unless you've done serious diligence on the CLOB trading API and understand the risks of automated trading on prediction markets.

API latency is real. The CLOB API serves live prices, but there's still latency between an on-chain event resolving and the API reflecting it. For fast-moving markets (sports outcomes, breaking news events), the midpoint price can lag by 30–120 seconds. Don't build anything where that lag is consequential.

Market liquidity varies wildly. A market with $50k in liquidity and one with $5M will behave completely differently. Check the order book depth before treating a price as a reliable signal. Low-liquidity markets can move 20 points on a $500 trade.

The Polymarket API has no SLA. This is not a financial data provider with a guaranteed uptime. Plan for 503s, timeouts, and occasional data gaps. Your skill's error handling matters.

Prediction markets are not available everywhere. The Polymarket API is now accessible to U.S. developers without restrictions, thanks to the launch of Polymarket US, regulated by the CFTC. Check your jurisdiction before building on this infrastructure.

Nothing in this article is financial advice. This is a technical walkthrough of an automation pattern.


At Macaron, the workflows that actually stick are the ones where a single sentence triggers a full loop — fetch, evaluate, act, log — without you babysitting it. If you want to see how that kind of task stays structured and doesn't lose context across steps, try running a real monitoring workflow in Macaron. One sentence is enough to start.


Frequently Asked Questions

Q: What are the Polymarket API rate limits?

Public endpoints allow up to 60 requests per minute. WebSocket connections for live data streaming have virtually no restrictions. For a polling skill checking 10 markets every 15 minutes, you're using roughly 0.01% of your rate limit budget. You'd have to be doing something seriously aggressive to hit the cap.

Q: Should I host this locally or on a VPS?

Local is fine for development and personal use — your OpenClaw gateway already runs as a daemon. For production reliability (especially if you want alerts at 3am when your laptop's asleep), a VPS with pm2 or systemd is worth it. A $5/month DigitalOcean or Hetzner instance is more than enough for this workload.

Q: Is Telegram or Slack more reliable for alerts?

Telegram wins on simplicity and reliability. The Bot API is free, has no workspace restrictions, and works globally. Slack's Incoming Webhooks work well too, but webhook URLs can expire if the Slack app isn't actively maintained, and free Slack workspaces have message history limits. If you're building this for personal use, Telegram. If you're sharing alerts with a team, Slack.

Q: Can I monitor more than 10 markets?

Yes — the 10-instrument limit applies to WebSocket streaming. The REST polling approach has no such limit, just the 60 req/min rate cap. With a 1-second delay between fetches, you could poll 60 markets per minute comfortably.

Q: What happens if the Polymarket API goes down?

Your skill will log errors and continue to the next market. Make sure your error handler in check.mjs catches network failures gracefully (the try/catch in the example above does this). You can also add a "health check" alert: if 3 consecutive polls fail completely, send a "monitor is down" message so you know to investigate.

Q: Do I need a Polymarket account or wallet to use this?

No. The Gamma API and CLOB read endpoints are fully public and require no authentication. You only need credentials if you want to place trades, which this skill intentionally does not do.

Q: Can OpenClaw run multiple monitoring skills simultaneously?

Yes. In multi-agent setups, each agent has its own workspace, meaning per-agent skills live in <workspace>/skills for that agent only, and shared skills live in ~/.openclaw/skills and are visible to all agents on the same machine. You can run a Polymarket monitor skill, an RSS news skill, and a portfolio tracker skill all in the same agent session without conflicts.

Apply to become Macaron's first friends