polymarket-pnl

polymarket-pnl is a skill for Claude Code from runesleo/polymarket-toolkit. It costs 77 tokens per session (1,675 once invoked), scanned A, original, MIT.

A Polymarket profit-and-loss calculator. It reconstructs realized and unrealized trading results from the market's public transaction data.

In plain words
What is it for?
Use it to calculate or audit PnL for Polymarket wallets, compare results with official values, or process multiple addresses.
Why use it?
It accounts for buys, sells, redemptions, and other cash-flow events, giving a more detailed calculation than a simple position estimate.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions Claude Code; built for openclaw.

Good fit Use it to calculate or audit PnL for Polymarket wallets, compare results with official values, or process multiple addresses.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/runesleo/polymarket-toolkit/polymarket-pnl
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add runesleo/polymarket-toolkit --skill polymarket-pnl
Clone the repo
git clone --depth 1 https://github.com/runesleo/polymarket-toolkit

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for polymarket-pnl

README.md
[![agentmods](https://agentmods.dev/badge/skills/runesleo/polymarket-toolkit/polymarket-pnl/github.svg)](https://agentmods.dev/skills/runesleo/polymarket-toolkit/polymarket-pnl)
Your own site
<a href="https://agentmods.dev/skills/runesleo/polymarket-toolkit/polymarket-pnl"><img src="https://agentmods.dev/badge/skills/runesleo/polymarket-toolkit/polymarket-pnl/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for polymarket-pnl

Your own site · 80×15
<a href="https://agentmods.dev/skills/runesleo/polymarket-toolkit/polymarket-pnl"><img src="https://agentmods.dev/badge/skills/runesleo/polymarket-toolkit/polymarket-pnl.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,675 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Supply Chain · line 91
    Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
    Fix: Avoid downloading and executing remote scripts. Use trusted packages from PyPI/npm. If remote fetch is required, verify checksums and use HTTPS.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00077 $0.01675
Opus 5 $0.00039 $0.00838
Sonnet 5 $0.00015 $0.00335
Haiku 4.5 $0.00008 $0.00168

Measured 9d ago against content hash 772d3d790386, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

polymarket-pnl scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (compute_precise_pnl.py, lib/__init__.py, lib/checkpoint.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

If the user just wants a quick profile (win rate, positions, category breakdown), use the `polymarket-profile` skill instead — it's lighter and runs on curl alone.
skills/polymarket-pnl/SKILL.md · 128 lines

How it starts

The opening of the file, as written. The whole thing — 128 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Polymarket Precise PnL

Compute precise, audit-grade PnL for any Polymarket address via the Data API cashflow method. Unlike position-level approximations used by most profilers, this reconstructs 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.

Trigger

Invoke this skill when the user wants:

  • Audit-grade PnL for one or more Polymarket addresses
  • Bulk PnL over a leaderboard or an address list
  • Benchmark mode: compare a local PnL dataset vs. the official /profit values

If the user just wants a quick profile (win rate, positions, category breakdown), use the polymarket-profile skill instead — it's lighter and runs on curl alone.

Requirements

  • python3 (3.9+)
  • One Python package: httpx

Install once:

pip install -r ${SKILL_DIR}/requirements.txt
# or
pip install httpx

${SKILL_DIR} is the path where this skill lives (for example, /path/to/your/agent/skills/polymarket-pnl/).

Core CLI

All invocations run from the skill directory (or with python3 <skill_dir>/compute_precise_pnl.py):

# Single address
python3 compute_precise_pnl.py --address 0x63ce342161250d705dc0b16df89036c8e5f9ba9a

# Bulk: top N on the leaderboard (auto-fetched)
python3 compute_precise_pnl.py --leaderboard 50

# Address list from a text file (one 0x per line, `#` for comments)
python3 compute_precise_pnl.py --addresses-file targets.txt

# Benchmark: compare your local PnL JSONL against the recomputed precise PnL
python3 compute_precise_pnl.py --leaderboard 100 \
  --benchmark local_pnl.jsonl \
  -o precise_vs_local.jsonl

Output is JSONL streamed to --output (default: ./precise_pnl.jsonl).

Output schema

Each line is one address record:

Field Type Meaning
address str The lowercase 0x proxy wallet
pnl float Trading cashflow PnL (BUY/SELL/REDEEM/MERGE/SPLIT/REBATE + unrealized). Primary metric.
pnl_inclusive float pnl + REWARD + REFERRAL_REWARD + CONVERSION (platform credits)
total_buy, total_sell, total_redeem, total_merge, total_split, total_rebate, total_reward, total_referral, total_conversion float Sum of each activity type
unrealized float Current mark-to-market value of open positions
open_positions int Number of open positions
trade_count int Total BUY + SELL events
computed_at int Unix seconds when record was produced
complete bool True if every paginated activity call returned fully
pagination_incomplete bool True if the Data API's ~10k offset ceiling was hit for at least one activity type
pagination_incomplete_types list[str] | None Which activity types hit the ceiling ("BUY", "SELL", ...)

Read the full file on GitHub · 128 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 128 lines · 77 tokens per session scan A 772d3d790386

Subscribe to this mod's changes

polymarket-pnl is a skill published in the GitHub repository runesleo/polymarket-toolkit (193 stars, last pushed 20d ago), licensed MIT. It adds 77 tokens to every session and 1,675 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.