360 Secure SkillHub
360 安全技能中心

vike-polymarket-resolutions

通过 MCP 工具、vike-data 命令或 REST 接口查询 Polymarket 的链上结算:给定 condition_id 返回获胜结果、赔付与结算区块时间;也可按结算时间窗口或 slug 前缀批量分页拉取已结算市场,便于回测统计。

分类:搜索
vikeio
vikeio
热度 38.28
最近更新 2026-12-02 09:58:16

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add vikeio/vike-polymarket-resolutions
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
vike-polymarket-resolutions
description
Has a Polymarket market resolved, to which outcome and when - the on-chain resolution of one market (winning outcome and its token, payouts, block and time), or every market the chain resolved in a time window or in one family of slugs (all BTC 5-minute markets of a day, every market of a series), paged in resolution order, ready for a backtest. Use when the user asks "did this Polymarket market resolve" / "who won this market" / "when was it settled on chain" / "which Polymarket markets resolved yesterday" / "results of every BTC 5-minute market last week" / "a list of resolved markets with their winners".
allowed-tools
Bash(vike-data:*)

vike-polymarket-resolutions

Both commands read the on-chain resolution, keyed by the market's condition_id (0x + 64 hex), never an outcome token id. Find ids with vike-polymarket-find-market.

Call it

Use the first of these that is available:

  1. MCP: polymarket_settlement (condition_id); polymarket_settlements_bulk (optional from_ms, to_ms, slug_prefix, cursor, limit).
  2. CLI:
    vike-data polymarket settlement 0xa5ca27858ef5676943b3961ab3e14d9cd7c614fe33591c14e0f6023c7a9391c8 --json
    vike-data polymarket settlements --from-ms 1796083200000 --to-ms 1796169600000 --limit 5000 --json          # every market resolved on 2026-12-01
    vike-data polymarket settlements --slug-prefix btc-updown-5m- --from-ms 1796083200000 --to-ms 1796169600000 --limit 5000 --json
    vike-data pm settlements --slug-prefix btc-updown-5m- --cursor "<next_cursor>" --limit 5000 --json
    
  3. curl: the credential is VIKE_API_KEY, else api_key or anon_token from ~/.vike/config.json (Windows %USERPROFILE%\.vike\config.json); with none, get a free anonymous token with curl -s -X POST https://data.vike.io/v1/anon -H 'Content-Type: application/json' -d '{"source":"skill-curl"}' and save its token there as "anon_token" (see vike-core).
    curl -s "https://data.vike.io/v1/polymarket/settlements/0xa5ca27858ef5676943b3961ab3e14d9cd7c614fe33591c14e0f6023c7a9391c8" -H "X-API-KEY: $TOKEN"
    curl -s "https://data.vike.io/v1/polymarket/settlements/bulk?slug_prefix=eth-updown-15m-&from_ms=1796151600000&to_ms=1796155200000" -H "X-API-KEY: $TOKEN"
    

settlements: --from-ms inclusive, --to-ms exclusive, both on the RESOLUTION time (epoch ms); --slug-prefix lowercase letters, digits and -, up to 100 characters; --limit default 100 on the CLI and MCP and 5000 on REST, at most 5000. Page while has_more is true with --cursor <next_cursor>; each page is one request, so ask for full pages.

Output

settlement: [], or one row. settlements: {settlements, has_more, next_cursor}, oldest resolution first, the same rows:

condition_id, slug, question, outcomes (labels), token_ids (same order), winning_index, winning_outcome, winning_token_id, payouts (per outcome, e.g. [0, 1]), resolved_block, resolved_ts_ms (epoch ms), market_known.

Reading

  • [] means the chain has not resolved it, not that the market is open. A market can sit past its end date unresolved for days or weeks, and a cancelled or voided market may never get an on-chain resolution. Read the market's own status with vike-polymarket-market-detail.
  • When: resolved_ts_ms is the on-chain time. The up/down markets resolve seconds after their window ends (2026-12-01: a BTC 5-minute market ending 19:00:00 UTC resolved at 19:00:16).
  • winning_index -1 (a void or a tie) leaves winning_outcome and winning_token_id empty; payouts then shows the split. market_known: false = a resolution with no market row: slug, question, outcomes and token ids are empty while the on-chain fields are exact, and such a market never matches --slug-prefix.
  • A series: --slug-prefix with the series' stem. Up/down markets are <asset>-updown-<5m|15m|1h|4h|1d>-<window start, epoch seconds> (hourly and daily ones since 2026-11-18; before that they were bitcoin-up-or-down-<month>-<day>-<year>-<hour>-et and bitcoin-up-or-down-on-<month>-<day>-<year>). Count winning_outcome over the rows for "how often did Up win"; one day of a 5-minute series is 288 markets.
  • settlement is live; settlements pages are rebuilt every 5 minutes, so a market resolved in the last 5 minutes may be missing there.
  • To join to trades or the archive, use token_ids and winning_token_id.

Errors

  • condition_id is the market's 0x... hex id; an outcome token id matches nothing here (exit 1).
  • settlements/bulk requires to_ms > from_ms; invalid slug_prefix: lowercase letters, digits and '-', up to 100 characters; invalid cursor: pass back a previous page's next_cursor verbatim.
  • REST: errors are 400 {"error": "..."}, and an unknown parameter is refused. Bulk filters sent to /settlements/{condition_id} are refused with a pointer to /settlements/bulk; a bare /v1/polymarket/settlements is a 404 on purpose.
  • Exit code 3: the anonymous token's daily limit; tell the user to run vike-data login, do not retry.

Anti-patterns

  • Don't report a market as "still open" from [], or as "resolved" from an end date in the past.
  • Don't fetch markets one by one for a backtest: one settlements page holds 5,000.
  • Don't take the resolution time from the market's end_date.

Pairs well with

  • vike-polymarket-updown - the Chainlink price an up/down market resolved on
  • vike-pm-l2-archive - the order books and trades to join these outcomes to
  • vike-polymarket-trader - a wallet's realized P&L, which counts only resolved markets