⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

polyclaw

@chainstacklabs⭐ 358 stars

Trade on Polymarket via split + CLOB execution. Browse markets, track positions with P&L, discover hedges via LLM. Polygon/Web3.

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐⭐⭐ 358 on GitHubGitHub ↗

Popular

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

PolyClaw

Trading-enabled Polymarket skill for OpenClaw.

Browse prediction markets, execute trades on-chain, and discover hedging opportunities using LLM-powered analysis. Full trading capability via split + CLOB execution on Polygon.

Disclaimer: This software is provided as-is for educational and experimental purposes. It is not financial advice. Trading prediction markets involves risk of loss. This code has not been audited. Use at your own risk and only with funds you can afford to lose.

📺 Watch the video explainer

Features

Market browsing

  • polyclaw markets trending — Top markets by 24h volume
  • polyclaw markets search "query" — Search markets by keyword
  • polyclaw market <id> — Market details with prices

Trading

  • polyclaw buy <market_id> YES <amount> — Buy YES position
  • polyclaw buy <market_id> NO <amount> — Buy NO position
  • Split + CLOB execution (split pUSD → YES+NO, sell unwanted side)

Position tracking

  • polyclaw positions — List open positions with live P&L
  • polyclaw position <id> — Detailed position view
  • Positions tracked locally in ~/.openclaw/polyclaw/positions.json

Wallet management

  • polyclaw wallet status — Show address, POL / pUSD / USDC.e balances
  • polyclaw wallet approve — Set Polymarket contract approvals (one-time)

Hedge discovery

  • polyclaw hedge scan — Scan trending markets for hedging opportunities
  • polyclaw hedge scan --query "topic" — Scan markets matching a query
  • polyclaw hedge analyze <id1> <id2> — Analyze specific market pair

Uses LLM-powered contrapositive logic to find covering portfolios. Only logically necessary implications are accepted — correlations and "likely" relationships are rejected.

Coverage tiers: T1 (≥95%), T2 (90-95%), T3 (85-90%)

Quick start

1. Install skill

Option A: Install from ClawHub (recommended)

clawhub install polyclaw
cd ~/.openclaw/skills/polyclaw
uv sync

Option B: Manual install

cp -r polyclaw ~/.openclaw/skills/
cd ~/.openclaw/skills/polyclaw
uv sync

2. Configure environment variables

Add the following to your openclaw.json under skills.entries.polyclaw.env:

"polyclaw": {
  "enabled": true,
  "env": {
    "CHAINSTACK_NODE": "https://polygon-mainnet.core.chainstack.com/YOUR_KEY",
    "POLYCLAW_PRIVATE_KEY": "0x...",
    "OPENROUTER_API_KEY": "sk-or-v1-..."
  }
}

Where to get the keys:

Security warning: Keep only small amounts in this wallet. Withdraw regularly to a secure wallet.

Looking for standalone CLI usage? This skill is designed for OpenClaw. For standalone CLI usage without OpenClaw, see polymarket-alpha-bot.

3. First-time setup (required for trading)

Before your first trade, set Polymarket contract approvals (one-time, costs ~0.01 POL in gas):

uv run python scripts/polyclaw.py wallet approve

This submits 6 approval transactions to Polygon. You only need to do this once per wallet.

4. Run commands

# Browse markets
uv run python scripts/polyclaw.py markets trending
uv run python scripts/polyclaw.py markets search "election"

# Find hedging opportunities
uv run python scripts/polyclaw.py hedge scan --limit 10

# Check wallet and trade
uv run python scripts/polyclaw.py wallet status
uv run python scripts/polyclaw.py buy <market_id> YES 50

Example prompts

Natural language prompts you can use with OpenClaw:

1. Browse trending markets

What's trending on Polymarket?

Returns market IDs, questions, prices, and volume.

2. Get market details

Show me details for market <market_id>

Use the market ID from Polymarket URL or from the trending markets response above.

Returns full market info with link to Polymarket.

3. Check wallet status

What's my PolyClaw wallet balance?

Shows address, POL balance (for gas), pUSD balance (collateral), and USDC.e balance (wrap into pUSD via the Collateral Onramp if you need it).

4. Direct trading

If you have your own conviction on a market:

Buy $50 YES on market <market_id>

Executes split + CLOB flow and records position.

5. Hedge discovery flow

Find LLM-analyzed arbitrage opportunities:

Find me some hedging opportunities on Polymarket

or more specifically:

Run hedge scan limit 10

Note: This takes a few minutes. The skill fetches open markets and sends pairs to the LLM for logical implication analysis.

Review the results — you'll see coverage tiers (T1 = 95%+, T2 = 90-95%, T3 = 85-90%) and the market pairs where you can take hedged positions.

6. Check positions

Show my PolyClaw positions

Lists open positions with entry price, current price, and P&L.

7. Sell early

To exit a position before the market resolves:

Sell my YES position on market <market_id>

Sells your tokens on the CLOB order book at current market price.

Full flow example

  1. "What's trending on Polymarket?" → Get market IDs
  2. "Run hedge scan limit 10" → Wait for LLM analysis
  3. Review hedge opportunities with coverage tiers
  4. "Buy $25 YES on market abc123" → Take position on target market
  5. "Buy $25 NO on market xyz789" → Take position on covering market
  6. "Show my PolyClaw positions" → Verify entries and track P&L

Environment variables

VariableRequiredDescription
CHAINSTACK_NODEYes (trading)Polygon RPC URL
OPENROUTER_API_KEYYes (hedge)OpenRouter API key for LLM
POLYCLAW_PRIVATE_KEYYes (trading)EVM private key (hex)
HTTPS_PROXYNoOnly needed if CLOB orders fail (see troubleshooting)
CLOB_MAX_RETRIESNoMax retries for CLOB orders (default: 5)

Directory structure

polyclaw/
├── SKILL.md                     # OpenClaw skill manifest
├── README.md                    # This file
├── pyproject.toml               # Python dependencies (uv)
│
├── scripts/
│   ├── polyclaw.py              # CLI dispatcher
│   ├── markets.py               # Market browsing (Gamma API)
│   ├── wallet.py                # Wallet management
│   ├── trade.py                 # Split + CLOB execution
│   ├── positions.py             # Position tracking + P&L
│   └── hedge.py                 # LLM hedge discovery
│
└── lib/
    ├── __init__.py              # Package marker
    ├── clob_client.py           # py-clob-client wrapper
    ├── contracts.py             # CTF ABI + addresses
    ├── coverage.py              # Coverage calculation + tiers
    ├── gamma_client.py          # Polymarket Gamma API client
    ├── llm_client.py            # OpenRouter LLM client
    ├── position_storage.py      # Position JSON storage
    └── wallet_manager.py        # Wallet lifecycle

Trading flow

  1. Set approvals (one-time): polyclaw wallet approve
  2. Execute trade: polyclaw buy <market_id> YES 50
    • Split $50 pUSD → 50 YES + 50 NO tokens
    • Sell 50 NO tokens via CLOB → recover ~$15 (at 30¢)
    • Result: 50 YES tokens, net cost ~$35
  3. Track position: polyclaw positions

Understanding the split mechanism

Polymarket uses a Conditional Token Framework (CTF). You can't directly "buy YES tokens" — instead:

  1. Split: Deposit pUSD into the CTF contract, which mints equal amounts of YES + NO tokens
  2. Sell unwanted: Sell the side you don't want via the CLOB order book
  3. Result: You hold your desired position, having recovered partial cost from selling the other side

Example (buying YES at $0.65):

Split:  $2 pUSD → 2 YES + 2 NO tokens
Sell:   2 NO tokens @ $

// HOW IT'S BUILT

KEY FILES

SKILL.mdREADME.md

// REPO STATS

358 stars