polymarket-monitor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Polymarket Monitor

Polymarket Monitor

Monitor live Polymarket prediction markets for price changes, volume spikes, and spread movements. Outputs structured JSON alerts when thresholds are crossed. All endpoints are read-only and require no API keys.
Prerequisite: This skill uses token IDs from the
polymarket-scanner
skill. Run
scan_markets.py
first to discover markets and obtain token IDs.
监控实时Polymarket预测市场的价格变动、交易量激增和价差波动,当阈值被触发时会输出结构化JSON警报。所有接口均为只读,无需API密钥。
前置依赖: 本skill使用来自
polymarket-scanner
skill的代币ID,请先运行
scan_markets.py
查找市场并获取代币ID。

Quick Start

快速开始

All scripts require the Python venv at
/home/verticalclaw/.venv
.
所有脚本需要使用路径为
/home/verticalclaw/.venv
的Python虚拟环境。

Monitor Multiple Markets for Price Alerts

监控多个市场的价格警报

bash
source /home/verticalclaw/.venv/bin/activate && python polymarket-monitor/scripts/monitor_prices.py \
  --token-id "<TOKEN_ID_1>" \
  --token-id "<TOKEN_ID_2>" \
  --interval 30 \
  --threshold 5.0
This polls every 30 seconds and prints a JSON alert whenever a token's midpoint moves more than 5% from its baseline.
bash
source /home/verticalclaw/.venv/bin/activate && python polymarket-monitor/scripts/monitor_prices.py \
  --token-id "<TOKEN_ID_1>" \
  --token-id "<TOKEN_ID_2>" \
  --interval 30 \
  --threshold 5.0
该命令每30秒轮询一次,当代币的中间价较基准值波动超过5%时会打印JSON警报。

Watch a Single Market Live

实时观察单个市场

bash
source /home/verticalclaw/.venv/bin/activate && python polymarket-monitor/scripts/watch_market.py \
  --token-id "<TOKEN_ID>" \
  --interval 15
Prints a JSON snapshot every 15 seconds with price, spread, and order book depth.
bash
source /home/verticalclaw/.venv/bin/activate && python polymarket-monitor/scripts/watch_market.py \
  --token-id "<TOKEN_ID>" \
  --interval 15
每15秒打印一次包含价格、价差和订单簿深度的JSON快照。

Scripts

脚本说明

monitor_prices.py

monitor_prices.py

Polls multiple tokens at a set interval and emits JSON alerts when price changes exceed a threshold.
Arguments:
  • --token-id ID
    — CLOB token ID to monitor (repeatable, at least one required)
  • --interval N
    — Polling interval in seconds (default: 30, minimum: 5)
  • --threshold N
    — Percentage change to trigger an alert (default: 5.0)
  • --max-polls N
    — Stop after N polls (default: unlimited, use for non-interactive runs)
  • --baseline-window N
    — Number of recent prices to average for baseline (default: 1, meaning compare to last poll)
Output: One JSON object per line for each alert:
json
{
  "type": "price_alert",
  "token_id": "...",
  "timestamp": "2026-02-26T12:00:00Z",
  "current_price": 0.65,
  "baseline_price": 0.60,
  "change_pct": 8.33,
  "direction": "up",
  "spread": 0.02,
  "poll_number": 5
}
Non-alert polls print a status line to stderr so the agent knows monitoring is active.
按照设定间隔轮询多个代币,当价格变动超过阈值时输出JSON警报。
参数:
  • --token-id ID
    — 要监控的CLOB代币ID(可重复传入,至少需要一个)
  • --interval N
    — 轮询间隔,单位为秒(默认:30,最小值:5)
  • --threshold N
    — 触发警报的价格变动百分比阈值(默认:5.0)
  • --max-polls N
    — 轮询N次后停止(默认:无限制,适用于非交互式运行)
  • --baseline-window N
    — 计算基准值所用的最近价格平均数量(默认:1,即与上一次轮询结果对比)
输出: 每次警报输出一行JSON对象:
json
{
  "type": "price_alert",
  "token_id": "...",
  "timestamp": "2026-02-26T12:00:00Z",
  "current_price": 0.65,
  "baseline_price": 0.60,
  "change_pct": 8.33,
  "direction": "up",
  "spread": 0.02,
  "poll_number": 5
}
未触发警报的轮询会向stderr打印状态行,便于agent确认监控正在运行。

watch_market.py

watch_market.py

Continuously monitors a single market, printing a JSON snapshot each interval with price, spread, volume, and order book summary.
Arguments:
  • --token-id ID
    — CLOB token ID to watch (required)
  • --interval N
    — Snapshot interval in seconds (default: 15, minimum: 5)
  • --max-polls N
    — Stop after N snapshots (default: unlimited)
Output: One JSON object per line per snapshot:
json
{
  "type": "market_snapshot",
  "token_id": "...",
  "timestamp": "2026-02-26T12:00:00Z",
  "midpoint": 0.55,
  "best_bid": 0.54,
  "best_ask": 0.56,
  "spread": 0.02,
  "bid_depth": 15000.0,
  "ask_depth": 12000.0,
  "last_trade_price": 0.55,
  "last_trade_side": "BUY",
  "poll_number": 1
}
持续监控单个市场,每个间隔打印一次包含价格、价差、交易量和订单簿摘要的JSON快照。
参数:
  • --token-id ID
    — 要观察的CLOB代币ID(必填)
  • --interval N
    — 快照生成间隔,单位为秒(默认:15,最小值:5)
  • --max-polls N
    — 生成N次快照后停止(默认:无限制)
输出: 每次快照输出一行JSON对象:
json
{
  "type": "market_snapshot",
  "token_id": "...",
  "timestamp": "2026-02-26T12:00:00Z",
  "midpoint": 0.55,
  "best_bid": 0.54,
  "best_ask": 0.56,
  "spread": 0.02,
  "bid_depth": 15000.0,
  "ask_depth": 12000.0,
  "last_trade_price": 0.55,
  "last_trade_side": "BUY",
  "poll_number": 1
}

Data Flow

数据流程

  1. Run
    polymarket-scanner/scripts/scan_markets.py
    to find markets and get token IDs
  2. Pass token IDs to
    monitor_prices.py
    for multi-market alerting
  3. Or pass a single token ID to
    watch_market.py
    for detailed single-market tracking
  1. 运行
    polymarket-scanner/scripts/scan_markets.py
    查找市场并获取代币ID
  2. 将代币ID传入
    monitor_prices.py
    实现多市场警报
  3. 或将单个代币ID传入
    watch_market.py
    实现详细的单市场跟踪

Monitoring Guide

监控指南

For recommended thresholds by market type and advanced monitoring strategies, see
references/monitoring-guide.md
.
如需了解按市场类型推荐的阈值以及高级监控策略,请查看
references/monitoring-guide.md