
Polymarket Toolkit
io.github.runesleo由 GitHub 帳號 runesleo 發布v0.7.1更新於 Oct 24, 2026
Read-only Polymarket data tools for AI agents: profiles, PnL, market scans. No keys, no orders.
概覽
給 AI 代理使用的唯讀 Polymarket 研究工具:錢包剖析、損益、執行品質與市場掃描,不需金鑰、不下單。
- 可以做什麼
- 依地址或使用者名稱產生交易者剖析:損益、勝率、持倉、活動明細、類別分布與策略辨識
- 以 Brier 分數與校準表評估預測準確度,並依現金流重建稽核級損益
- 評估執行品質:markout 與市場基準比較、造市/吃單比例、累計吃單手續費及費前到淨額換算
- 掃描市場與價格、排行榜快照、加密漲跌事件,以及唯讀的可贖回部位檢查
- 可透過命令列或 TypeScript 輔助函式庫,把相同查詢接進自己的資料流程
- 適用情境
- 適合讓助理研究 Polymarket 交易者、核對損益數字、判斷錢包獲利是否真實或受手續費影響,或掃描市場行情,且完全不需要交易或簽章能力。
- 執行需求
- 以本機 npm 套件透過 stdio 執行;命令列需 Node.js 22 以上版本。需能連線 Polymarket 公開 API(lb-api、data-api、gamma-api),部分地區可能需要代理。不需 API 金鑰或帳號。選用的 Python 稽核損益技能需安裝 httpx。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Polymarket Toolkit,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Polymarket Toolkit
For anyone who wants to research Polymarket on their own — run the CLI yourself, or install skills for Claude / Cursor / OpenClaw and let AI run the tools. Read-only public APIs. No API keys. No signing.
Nothing to install? probpocket.com/lookup answers the same first question in a browser: paste an address, see lifetime PnL, what the wallet actually makes its money on, and how its leaderboard days compare with its real settled total. Free, no signup. Same public APIs as this CLI.
Machine-readable product facts: ai-info.json · llms.txt. Both are generated from content/ai-identity.json; npm run check:ai-discovery fails on tool, package-version, or output drift.
Install as a plugin
- Claude Code (2.1.275 or later):
/plugin install polymarket-toolkit --marketplace runesleo/x-reader - Codex:
codex plugin marketplace add runesleo/x-reader, thencodex plugin add polymarket-toolkit@runesleo
The runesleo marketplace also lists Leo's other tools; see runesleo/x-reader.
Toolbox · pick a drawer
Full index: docs/toolbox.md
30-second try
What you get: LB PnL snapshot + first-page positions. For audit-grade PnL, use the polymarket-pnl skill.
V2 merge/split broken? → docs/v2-ctf-ops-faq.md + ./bin/pm v2-check 0x…
CLI (pm)
Node 22+ (uses --experimental-strip-types). From repo root:
Prefer ./bin/pm from repo root (no install step). Or: npm run pm -- profile … · optional npm link for global pm.
Audit-grade PnL (Python): python3 skills/polymarket-pnl/compute_precise_pnl.py --address …
pm fees — why your number never matches the profile
Polymarket's own PnL — profile,
lb-api, theuser-pnlcurve — is pre-fee. A cashflow replay is post-fee.gap ≈ lifetime taker fees − maker rebates.
The fee is already in /activity: usdcSize is not size × price, and the
residual is what you were charged. That means lifetime fees, per-fill taker
proof, and the pre-fee → net conversion come from one REST call — no RPC, no
receipt decoding, no credentials.
Verified by predicting the gap before comparing, on four wallets: a heavy-taker wallet landed at a $0.84 residual against a $1,308.87 prediction, and a pure maker matched the official number to $0.40.
⚠️ The taker test is one-directional. fee > 0 proves you were the taker —
makers are never charged. fee == 0 means maker or fee-exempt category, so
it is reported as an upper bound on passive share, never as a maker count.
⚠️ Fees are recent. The earliest on record here is late June 2026, rate stepping 0.03 → 0.05 → 0.07. Any reconciliation that passed before then proves nothing about today.
pm markout — is this address getting picked off?
Markout is where a fill stands some seconds later: (reference − fill) × direction, in
cents per share. Negative means the price walked away from you — adverse selection.
Three things this command does that a hand-rolled version usually gets wrong:
- Passive fills are included.
/trades?user=behaves liketakerOnly=trueby default, so a market maker's entire passive side is missing unless you ask for it. - The reference is a windowed VWAP, not the next print. Prints alternate between bid and ask, and that bounce alone makes every SELL look good and every BUY look bad.
- Everything is measured against a baseline — the same tokens over the same span, minus this wallet. Levels drift; the excess is the part that means something.
Read the excess column and the coverage column together. In short-dated markets a large
tau leaves most fills with nothing ahead of them to be priced against, and the mean
then describes the surviving handful rather than the trader.
Why these three defaults exist. I ran 15 strategies on Polymarket over half a year, and the ones that cost the most failed at measurement, not at strategy: the same logic made +77% on paper and lost −74% live; 18.3% of my own trade records were quietly wrong, two thirds of those being false wins; market-making went 0 for 10 while the platform shipped three fee formulas in a single night. Each flag above is one of those mistakes turned into a default, so it isn't paid for twice.
The full write-up — 15 strategies, 5 deep pits, 14,000 words — is at leolabs.me/pm-quant ($49). It comes with monthly supplement notes; the current one measures a ~300ms server-side floor on taker orders that no colo or private line removes, against 56ms for maker.
TypeScript library
Zero-dependency helpers in src/index.ts. Run demos with Node 22+:
- Examples:
examples/— one numbered script per API pattern - Cookbook:
docs/cookbook.md— bilingual recipes
Skills (AI agents)
Install: copy the chosen skill into the skills directory configured by your agent client.
polymarket-pnl also needs: pip install httpx
Skill details: skills/*/SKILL.md · long-form docs in sections below.
What's in this repo
The core (src/, CLI, skills) never holds keys or sends transactions. Order execution lives only in the opt-in executor/ sub-package, which signs with your env-provided key, defaults to dry-run, and is never imported by the core. For normal redemption, use the official Polymarket app.
New to Polymarket? Sign up via the link above (affiliate disclosure: the author may earn referral rewards; no extra cost to you).
Building your own order executor? Start from the opt-in executor/ sub-package (docs/executor.md) — CLOB V2 limit orders with dry-run default, notional cap, and default builder attribution via src/builder.ts (override / opt-out via env). See builder attribution for the disclosure and FAQ. Read-only CLI/skills still do not send orders.
Release notes
v0.7 — MCP server for AI agents
mcp/— Model Context Protocol server exposing 12 read-only tools (pm_profile,pm_activity,pm_brier,pm_mix,pm_markout,pm_pnl_check,pm_scan,pm_updown,pm_leaderboard,pm_redeem_watchdog,pm_v2_check,pm_rate_limits) — docs/mcp.md- The CLI is the contract: every tool shells out to
pm, so the server is exactly as read-only as the CLI; inputs are allowlist-validated before reaching argv - Order placement is deliberately not exposed over MCP — the executor stays a separate, human-wired opt-in
v0.6 — Opt-in executor sub-package
executor/— isolated CLOB V2 order execution module (docs/executor.md): own dependencies, never imported by the zero-dependency core- Safety ladder — dry-run by default (
EXECUTOR_LIVE=1to post), notional capEXECUTOR_MAX_USD(default $10), fail-closed credential validation - Builder attribution wired end-to-end — default / override / opt-out via core
src/builder.ts, full disclosure in docs - Core CLI/skills remain read-only and key-free — scope table updated above
v0.5 — Toolbox CLI + roadmap flagships
pmCLI — profile · activity · scan · updown · v2-check · brier · redeem · markets- Activity cap detection — duplicate-page warnings near ~4000 rows
- V2 CTF FAQ —
docs/v2-ctf-ops-faq.md(split/merge/convert · infra alignment) - Builder attribution helper —
src/builder.ts+docs/builder-attribution.mdfor future CLOB executors, with default / override / opt-out paths - Market scanner · crypto updown fields · handoff template — toolbox.md
v0.4 — Redeem watchdog
New public helper: redeem watchdog — inspect redeemable positions without private keys.
Polymarket's pUSD-era redemption flow handles normal user redemption inside the official app. This release does not replace or work around that flow. It adds a read-only status lane for agents and dashboards: which wallet still has rows surfaced as redeemable=true by the public Data API, what their currentValue is (winning rows pay out, losing rows pay $0), and whether a strategy account is below a configured cash watermark. v0.4 adds fetchRedeemablePositionsPage, summarizeRedeemablePositions, and resolveRedeemMode for that workflow. It never signs or sends transactions.
Also: pm CLI (toolbox drawers) — see docs/toolbox.md.
v0.3 — polymarket-pnl skill
New Skill: polymarket-pnl — Audit-grade PnL via Data API cashflow reconstruction.
Most profilers (including polymarket-profile) use position-level cashPnL which is an approximation. polymarket-pnl replays every BUY / SELL / REDEEM / MERGE / SPLIT / REBATE event and reconciles against current unrealized position value. Validated against Polymarket's official /profit endpoint on the public leaderboard: MAPE ~0.2%, all top accounts within 1% error. Use this when the number has to hold up to scrutiny.
Redeem Watchdog Helpers
Inspect redeemable positions for a public proxy wallet without touching keys, allowances, relayers, or transactions.
What you get
- Redeemable scan —
fetchRedeemablePositionsPage(user)calls Data API/positions?redeemable=true - Condition rollup —
summarizeRedeemablePositions(rows)groups rows byconditionIdand sumscurrentValue(losing rows contribute$0, which is the correct payable amount — not theirsize) - Policy label —
resolveRedeemMode({ lowWatermark })returns"watchdog"or"low_watermark". There is intentionally no"active"value: this toolkit never executes a redeem, so an active label belongs in your own wallet system, not here.
Example
Three rows surfaced as
redeemable=truebut everycurrentValueis0— they are losing tokens that redeem to$0. The Data API still surfaces them after resolution; the helper reports them honestly without inflating payable value.
Safety boundary
This toolkit only reads public APIs. It does not redeem tokens, sign Safe transactions, call relayers, move funds, or require private keys. The official Polymarket app remains the right place for normal user redemption. Treat this helper as a dashboard/agent primitive; execution stays in your own wallet system.
polymarket-profile
Turn any Polymarket address into a complete trading profile.
What you get
- PnL Overview — Total profit/loss, 7d/30d trends
- Win Rate — Accurate settlement-based calculation (not position-level approximation)
- Open Positions — Current holdings with unrealized PnL and expiry dates
- Activity Breakdown — TRADE / SPLIT / MERGE / REDEEM volume with full pagination
- Category Distribution — Where the money goes: Crypto, Politics, Sports, Weather, etc.
- Top Wins & Losses — Best and worst settled positions
- Strategy Pattern — Auto-detected: Market Maker, SPLIT Arbitrage, Diversified, Whale, etc.
How it works
The skill instructs your AI agent to call Polymarket's public APIs (lb-api, data-api, gamma-api), process the data, and output a structured profile. No API key needed, no local database, no setup.
Setup
Claude Code:
OpenClaw:
Any other AI agent:
Just paste the content of skills/polymarket-profile/SKILL.md into your conversation and ask your AI to follow the instructions.
Requirements
- An AI agent that can run
curlcommands - Internet access to Polymarket APIs (some endpoints may need a proxy in certain regions)
- That's it. No API keys, no database, no dependencies.
New to Polymarket? Create an account here.
Supported input
Username lookup works for all leaderboard-ranked users (auto-resolved via lb-api). Unranked accounts (zero trading history) require the 0x address directly.
Data sources
All public, no authentication required:
Known limitations
- Username → address auto-resolution works for leaderboard-ranked users only (unranked accounts need 0x address)
- Category mapping uses Gamma API tags + keyword fallback (not 100% accurate)
- Top Wins/Losses uses position-level cashPnl (approximate, not per-trade)
- Large accounts (10K+ trades) may take 30+ seconds to paginate
- lb-api 7d/30d PnL may return empty for inactive accounts
- Activity API ~4000 row cap: continuing pagination may return identical JSON — use
pm activity/fetchActivityPagesorpolymarket-pnlwithpagination_incomplete
polymarket-brier
Rate any trader's prediction accuracy with Brier Score — the standard metric used by Metaculus, Good Judgment Project, and forecasting research.
Why not just look at PnL?
Example
Setup
After installation: "What's the Brier Score for 0x63ce..." or "How accurate is Theo4's predictions?"
New to Polymarket? Create an account here.
polymarket-pnl
Audit-grade PnL for any Polymarket address via Data API cashflow reconstruction. Replays every BUY / SELL / REDEEM / MERGE / SPLIT / REBATE event and reconciles against current unrealized position value.
Why not just use position-level cashPnL?
Position-level cashPnL (what most profilers surface) is rounded at the position level and drops partial fills, making it approximate. polymarket-pnl walks the full activity log — every trade event, every REDEEM, every MERGE — and computes PnL from the cashflow identity:
Validated on Polymarket's own leaderboard: precise_pnl matches the official /profit endpoint within 0.2% MAPE on top traders.
Example
Setup
CLI usage
Output is JSONL with one record per address. See skills/polymarket-pnl/SKILL.md for the full output schema.
When to use polymarket-profile vs polymarket-pnl
polymarket-profile— curl-only, qualitative profile (win rate, positions, categories). Best for "who is this address?"polymarket-pnl— Python + audit-grade cashflow reconstruction. Best for "what is their real PnL?" — writing research, benchmarking a model, or building a dataset.
New to Polymarket? Create an account here.
Validation templates
Strategy validation docs from hypothesis → tiny-live (MIT templates):
Also: fee-inclusive-pnl.md · full index: toolbox.md
Templates are document skeletons; runnable paper/live execution code lives in your own repo.
Roadmap
Analysis Tools
- PnL Calculator — Cashflow-reconstructed PnL, ~0.2% MAPE vs. official leaderboard
- Brier Score Rating — Prediction quality scoring per address
-
pm profileCLI — Quick address snapshot - Trading Style Tags — Conservative / Aggressive / Event-driven / Market Maker labels
Market Intelligence
- Market Scanner Lite —
pm scan(24h volume + spread) - Crypto updown fields —
pm updown+ docs/crypto-updown-price-source.md - Market Liquidity Gauge — Depth / maker concentration (deeper)
- LP Reward Scanner — Incentive programs / APY estimate
Platform / V2
- V2 CTF split/merge FAQ +
pm v2-check(read-only) - Activity API cap warnings
Validation templates
- Strategy handoff — docs/templates/handoff-template.md
- Backtest report — docs/templates/backtest-report-template.md
- Paper checklist — docs/templates/paper-checklist.md
- Live gate 12 steps — docs/templates/live-gate-checklist.md
- Platform change runbook — docs/templates/platform-change-runbook.md
Tracking & Alerts
- Leaderboard Tracker Lite —
pm lb+ snapshot diff - fee-inclusive PnL guide — docs/fee-inclusive-pnl.md +
pm pnl-check - Whale Alert — Large position changes from top traders
- Redeem Watchdog — public redeemable-position status for agent dashboards
API (planned)
- REST API for all tools above — integrate Polymarket intelligence into your own apps
More from this workshop
Full map: runesleo — all open-source projects and working systems.
- x-reader — universal content reader MCP, 10+ platforms
- claude-code-workflow — QuietHarness: shared AI working system for Claude Code / Codex / Cursor
- ai-health-vault — AI + Obsidian health management system
- claude-video-kit — Agent Skill + Remotion video pipeline
About the author
Leo (@runes_leo) — AI × Crypto independent builder. Trading on Polymarket, building data and trading systems with Claude Code and Codex.
leolabs.me — writing · community · open-source tools · indie projects · all platforms.
X Subscription — paid content weekly, or just buy me a coffee 😁
Learn in public, Build in public.
Affiliate disclosure: Polymarket signup links in this repo may earn referral rewards; unrelated to MIT toolkit functionality.
來源:README.md,提交 bc7feb3
工具
0版本歷史
1- v0.7.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分