Polymarket Monitor
Set up ongoing monitoring for any Polymarket prediction market with threshold-based alerts.
Workflow
1. Find the market(s)
Search the Gamma API for active markets matching the user's topic:
CODEBLOCK0
Parse the response to find relevant markets. For each, note:
- -
conditionId — needed to fetch prices - INLINECODE1 — market title
- INLINECODE2 — current Yes/No probabilities (JSON string)
See references/api.md for full API details.
2. Check current odds
Use the bundled script to fetch current prices for one or more markets:
CODEBLOCK1
Output: JSON with question, yes_prob (0–1 float), and url per market.
3. Report current state
Show the user the markets found and their current probabilities before setting up monitoring.
4. Set up the cron alert
Create a cron job that runs every N minutes (default: 30) with sessionTarget: "isolated" and payload.kind: "agentTurn". The agent task should:
- 1. Fetch each market via
web_fetch using the Gamma API (conditionId endpoint) - Parse
outcomePrices[0] as the Yes probability - If any market exceeds the threshold: send a Slack DM alert via the
message tool (channel=slack, target=) - If none exceed threshold: do nothing (no output)
Use delivery.mode: "none" to suppress default cron delivery — the agent handles its own alerting.
Template cron task message:
CODEBLOCK2
5. Confirm setup
Tell the user:
- - Which markets are being monitored
- Current odds for each
- Alert threshold and check frequency
- How to cancel (cron job ID +
cron remove <id>)
Notes
- - Polymarket has no "today" daily markets — use the nearest deadline market for short-term signals
- INLINECODE14 is always
["yes", "no"] — first value is Yes - Closed markets return prices of 0 or 1; skip them
- No API key needed
Polymarket Monitor
为任何Polymarket预测市场设置持续监控,并支持基于阈值的警报。
工作流程
1. 查找市场
通过Gamma API搜索与用户主题匹配的活跃市场:
bash
curl https://gamma-api.polymarket.com/events?search=<主题>&limit=10&active=true
解析响应以查找相关市场。对于每个市场,记录:
- - conditionId — 获取价格所需
- question — 市场标题
- outcomePrices — 当前的是/否概率(JSON字符串)
完整API详情请参见 references/api.md。
2. 查看当前赔率
使用捆绑脚本获取一个或多个市场的当前价格:
bash
python3 scripts/check_markets.py [conditionId2 ...]
输出:包含每个市场的 question、yes_prob(0–1浮点数)和 url 的JSON数据。
3. 报告当前状态
在设置监控前,向用户展示已找到的市场及其当前概率。
4. 设置定时警报
创建一个每N分钟(默认:30)运行一次的cron任务,设置 sessionTarget: isolated 和 payload.kind: agentTurn。代理任务应:
- 1. 通过Gamma API(conditionId端点)使用 web_fetch 获取每个市场
- 解析 outcomePrices[0] 作为是的概率
- 如果任何市场超过阈值:通过 message 工具发送Slack私信警报(channel=slack, target=<用户ID>)
- 如果没有市场超过阈值:不执行任何操作(无输出)
使用 delivery.mode: none 禁用默认的cron投递——代理自行处理警报。
模板cron任务消息:
检查这些Polymarket市场。对于每个市场,获取:
https://clob.polymarket.com/markets/
解析tokens数组:找到outcome==Yes并使用其price作为概率(0–1)。
如果任何市场超过<阈值>(例如0.70):
向<用户SlackID>发送Slack私信,内容包括:市场问题、当前百分比和Polymarket URL。
如果没有市场超过阈值,则不执行任何操作。
市场:
- - <问题>: https://clob.polymarket.com/markets/ | https://polymarket.com/event/
5. 确认设置
告知用户:
- - 正在监控哪些市场
- 每个市场的当前赔率
- 警报阈值和检查频率
- 如何取消(cron任务ID + cron remove )
备注
- - Polymarket没有今日日度市场——使用截止日期最近的市场获取短期信号
- outcomePrices 始终为 [yes, no] — 第一个值为是
- 已关闭市场的价格返回0或1;请跳过
- 无需API密钥