jpskill.com
🛠️ 開発・MCP コミュニティ

polyclaw

Polymarketで、注文分割やCLOB執行を通じて取引を行い、市場の閲覧や損益を伴うポジション追跡、LLMによるヘッジ発見などを支援する、Polygon/Web3を活用した取引を効率化するSkill。

📜 元の英語説明(参考)

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

🇯🇵 日本人クリエイター向け解説

一言でいうと

Polymarketで、注文分割やCLOB執行を通じて取引を行い、市場の閲覧や損益を伴うポジション追跡、LLMによるヘッジ発見などを支援する、Polygon/Web3を活用した取引を効率化するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o polyclaw.zip https://jpskill.com/download/8215.zip && unzip -o polyclaw.zip && rm polyclaw.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/8215.zip -OutFile "$d\polyclaw.zip"; Expand-Archive "$d\polyclaw.zip" -DestinationPath $d -Force; ri "$d\polyclaw.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して polyclaw.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → polyclaw フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

PolyClaw

OpenClaw向けの、取引が可能なPolymarketスキルです。マーケットの閲覧、ウォレットの管理、取引の実行、ポジションの追跡が可能です。

特徴

  • マーケット閲覧 - Polymarketの予測市場を検索および閲覧します
  • ウォレット管理 - 環境変数に基づいたウォレット設定
  • 取引 - スプリット + CLOB実行によるYES/NOポジションの購入
  • ポジション追跡 - エントリー価格、現在価格、損益を追跡します
  • ヘッジ発見 - 論理的含意による、LLMを活用したカバリングポートフォリオの発見

クイックスタート

まず、依存関係をインストールします(スキルディレクトリから)。

cd {baseDir}
uv sync

初回設定(取引に必須)

最初の取引を行う前に、Polymarketコントラクトの承認を設定します(初回のみ、ガス代として約0.01 POLが必要です)。

uv run python scripts/polyclaw.py wallet approve

これにより、6つの承認トランザクションがPolygonに送信されます。これはウォレットごとに一度だけ行う必要があります。

マーケット閲覧

# ボリュームによるトレンドのマーケット
uv run python scripts/polyclaw.py markets trending

# マーケットの検索
uv run python scripts/polyclaw.py markets search "election"

# マーケットの詳細(すべてのフィールドを含む完全なJSONを返します)
uv run python scripts/polyclaw.py market <market_id>

出力オプション:

  • デフォルトの出力は、フォーマットされたテーブルです(表示に適しています)
  • 切り捨てなしで完全な質問テキストを表示するには、--fullフラグを使用します
  • 構造化されたJSON出力には、scripts/markets.py --json trending経由で--jsonフラグを使用します

ウォレット管理

# ウォレットのステータスを確認します(アドレス、残高)
uv run python scripts/polyclaw.py wallet status

# コントラクトの承認を設定します(初回のみ)
uv run python scripts/polyclaw.py wallet approve

ウォレットは、POLYCLAW_PRIVATE_KEY環境変数を介して設定されます。

取引

# YESポジションを50ドルで購入します
uv run python scripts/polyclaw.py buy <market_id> YES 50

# NOポジションを25ドルで購入します
uv run python scripts/polyclaw.py buy <market_id> NO 25

ポジション

# 損益を含むすべてのポジションをリストします
uv run python scripts/polyclaw.py positions

ヘッジ発見

カバリングポートフォリオ、つまり対偶論理によって互いにヘッジするマーケットポジションのペアを見つけます。

# トレンドのマーケットでヘッジをスキャンします
uv run python scripts/polyclaw.py hedge scan

# クエリに一致するマーケットをスキャンします
uv run python scripts/polyclaw.py hedge scan --query "election"

# 特定のマーケットのヘッジ関係を分析します
uv run python scripts/polyclaw.py hedge analyze <market_id_1> <market_id_2>

出力オプション:

  • デフォルトの出力は、Tier、Coverage、Cost、Target、Coverを示すフォーマットされたテーブルです
  • 構造化されたJSON出力には、--jsonフラグを使用します
  • 最小カバレッジでフィルタリングするには--min-coverage 0.90を使用します(デフォルトは0.85)
  • ティアでフィルタリングするには--tier 1を使用します(1=最高、デフォルトは2)

カバレッジティア:

  • Tier 1 (HIGH): >=95%のカバレッジ - ニアアービトラージの機会
  • Tier 2 (GOOD): 90-95% - 強力なヘッジ
  • Tier 3 (MODERATE): 85-90% - まともだが顕著なリスク
  • Tier 4 (LOW): <85% - 投機的(デフォルトでフィルタリング)

LLMモデル: OpenRouter経由でnvidia/nemotron-nano-9b-v2:freeを使用します。モデルの選択は重要です。一部のモデルは偽の相関関係を見つけますが、DeepSeek R1などの他のモデルには出力形式の問題があります。必要に応じて--model <model_id>でオーバーライドします。

セキュリティ

MVPでは、簡素化とClaude Codeとの互換性のために、プライベートキーは環境変数に保存されます。

セキュリティ警告: このウォレットには少額のみを保管してください。定期的に安全なウォレットに引き出してください。

環境変数

変数 必須 説明
CHAINSTACK_NODE Yes (trading) Polygon RPC URL
OPENROUTER_API_KEY Yes (hedge) LLMヘッジ発見のためのOpenRouter APIキー
POLYCLAW_PRIVATE_KEY Yes (trading) EVMプライベートキー(16進数、0xプレフィックスの有無は問いません)
HTTPS_PROXY Recommended CLOB用のローテーションレジデンシャルプロキシ(例:IPRoyal)
CLOB_MAX_RETRIES No IPローテーションによるCLOB最大リトライ回数(デフォルト:5)

セキュリティ警告: このウォレットには少額のみを保管してください。定期的に安全なウォレットに引き出してください。環境変数内のプライベートキーは自動化には便利ですが、暗号化されたストレージよりも安全ではありません。

取引フロー

  1. ポジションのスプリット - USDC.eはCTFコントラクトを介してYES + NOトークンに分割されます
  2. 不要な側の売却 - 不要な側はCLOBオーダーブックを介して売却されます
  3. 結果 - 必要なポジションを保持し、不要な側を売却して一部のコストを回収します

例:YESを0.70ドルで購入

  • 100ドルのUSDC.eをスプリット → 100 YES + 100 NOトークン
  • 100 NOトークンを約0.30ドルで売却 → 約27ドルのUSDC.eを回収
  • 純コスト:100 YESトークンに対して約73ドル(エントリー:0.73ドル)

Polymarketコントラクト(Polygonメインネット)

  • USDC.e: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
  • CTF (Conditional Tokens): 0x4D97DCd97eC945f40cF65F87097ACe5EA0476045
  • CTF Exchange: 0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E

依存関係

uvでインストールします(スキルディレクトリから)。

cd {baseDir}
uv sync

制限事項

  • 取引にはウォレット承認の設定が必要です(初回のみ)
  • 流動性が不十分な場合、CLOBでの売却が失敗する可能性があります

CLOB Cloudflareによるブロック

PolymarketのCLOB APIは、データセンターIPや一部のレジデンシャルISPを含む多くのIPからのPOSTリクエストをブロックするCloudflare保護を使用しています。これは「不要なトークンの売却」ステップに影響します。

解決策:リトライロジックを備えたレジデンシャルプロキシ

推奨されるセットアップは、ローテーションレジデンシャルプロキシ(例:IPRoyal、BrightData)を使用することです。CLOBクライアントは、動作するIPが見つかるまで、新しいIPで自動的にリトライします。

export HTTPS_PROXY="http://user:pass@geo.iproyal.com:12321"
export CLOB_MAX_RETRIES=10  # デフォルトは5

この設定では、プロキシがブロックされていないIPが見つかるまでIPをローテーションするため、通常、CLOB注文は5〜10回のリトライで成功します。

代替の回避策:

  1. --skip-sellを使用する — YESトークンとNOトークンの両方を保持し、polymarket.comで手動で売却します
  2. プロキシなし — スプリットは引き続き機能します。CLOBでの売却のみが影響を受けます

すべてのリトライ後にCLOBが失敗した場合でも、スプリットは成功しています。出力には、トークンの数が表示されます

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

PolyClaw

Trading-enabled Polymarket skill for OpenClaw. Browse markets, manage wallets, execute trades, and track positions.

Features

  • Market Browsing - Search and browse Polymarket prediction markets
  • Wallet Management - Env-var based wallet configuration
  • Trading - Buy YES/NO positions via split + CLOB execution
  • Position Tracking - Track entry prices, current prices, and P&L
  • Hedge Discovery - LLM-powered covering portfolio discovery via logical implications

Quick Start

First, install dependencies (from skill directory):

cd {baseDir}
uv sync

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.

Browse Markets

# Trending markets by volume
uv run python scripts/polyclaw.py markets trending

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

# Market details (returns full JSON with all fields)
uv run python scripts/polyclaw.py market <market_id>

Output options:

  • Default output is a formatted table (good for display)
  • Use --full flag for full question text without truncation
  • Use --json flag via scripts/markets.py --json trending for structured JSON output

Wallet Management

# Check wallet status (address, balances)
uv run python scripts/polyclaw.py wallet status

# Set contract approvals (one-time)
uv run python scripts/polyclaw.py wallet approve

The wallet is configured via the POLYCLAW_PRIVATE_KEY environment variable.

Trading

# Buy YES position for $50
uv run python scripts/polyclaw.py buy <market_id> YES 50

# Buy NO position for $25
uv run python scripts/polyclaw.py buy <market_id> NO 25

Positions

# List all positions with P&L
uv run python scripts/polyclaw.py positions

Hedge Discovery

Find covering portfolios - pairs of market positions that hedge each other via contrapositive logic.

# Scan trending markets for hedges
uv run python scripts/polyclaw.py hedge scan

# Scan markets matching a query
uv run python scripts/polyclaw.py hedge scan --query "election"

# Analyze specific markets for hedging relationship
uv run python scripts/polyclaw.py hedge analyze <market_id_1> <market_id_2>

Output options:

  • Default output is a formatted table showing Tier, Coverage, Cost, Target, and Cover
  • Use --json flag for structured JSON output
  • Use --min-coverage 0.90 to filter by minimum coverage (default 0.85)
  • Use --tier 1 to filter by tier (1=best, default 2)

Coverage tiers:

  • Tier 1 (HIGH): >=95% coverage - near-arbitrage opportunities
  • Tier 2 (GOOD): 90-95% - strong hedges
  • Tier 3 (MODERATE): 85-90% - decent but noticeable risk
  • Tier 4 (LOW): <85% - speculative (filtered by default)

LLM model: Uses nvidia/nemotron-nano-9b-v2:free via OpenRouter. Model selection matters — some models find spurious correlations while others (like DeepSeek R1) have output format issues. Override with --model <model_id> if needed.

Security

For the MVP, the private key is stored in an environment variable for simplicity and Claude Code compatibility.

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

Environment Variables

Variable Required Description
CHAINSTACK_NODE Yes (trading) Polygon RPC URL
OPENROUTER_API_KEY Yes (hedge) OpenRouter API key for LLM hedge discovery
POLYCLAW_PRIVATE_KEY Yes (trading) EVM private key (hex, with or without 0x prefix)
HTTPS_PROXY Recommended Rotating residential proxy for CLOB (e.g., IPRoyal)
CLOB_MAX_RETRIES No Max CLOB retries with IP rotation (default: 5)

Security Warning: Keep only small amounts in this wallet. Withdraw regularly to a secure wallet. The private key in an env var is convenient for automation but less secure than encrypted storage.

Trading Flow

  1. Split Position - USDC.e is split into YES + NO tokens via CTF contract
  2. Sell Unwanted - The unwanted side is sold via CLOB order book
  3. Result - You hold the wanted position, recovered partial cost from selling unwanted

Example: Buy YES at $0.70

  • Split $100 USDC.e → 100 YES + 100 NO tokens
  • Sell 100 NO tokens at ~$0.30 → recover ~$27 USDC.e
  • Net cost: ~$73 for 100 YES tokens (entry: $0.73)

Polymarket Contracts (Polygon Mainnet)

  • USDC.e: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
  • CTF (Conditional Tokens): 0x4D97DCd97eC945f40cF65F87097ACe5EA0476045
  • CTF Exchange: 0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E

Dependencies

Install with uv (from skill directory):

cd {baseDir}
uv sync

Limitations

  • Trading requires wallet approval setup (one-time)
  • CLOB sells may fail if liquidity is insufficient

CLOB Cloudflare Blocking

Polymarket's CLOB API uses Cloudflare protection that blocks POST requests from many IPs, including datacenter IPs and some residential ISPs. This affects the "sell unwanted tokens" step.

Solution: Residential proxy with retry logic

The recommended setup uses a rotating residential proxy (e.g., IPRoyal, BrightData). The CLOB client automatically retries with new IPs until one works:

export HTTPS_PROXY="http://user:pass@geo.iproyal.com:12321"
export CLOB_MAX_RETRIES=10  # Default is 5

With this setup, CLOB orders typically succeed within 5-10 retries as the proxy rotates through IPs until finding an unblocked one.

Alternative workarounds:

  1. Use --skip-sell — Keep both YES and NO tokens, sell manually on polymarket.com
  2. No proxy — Split still works; only CLOB sell is affected

If CLOB fails after all retries, your split still succeeded. The output tells you how many tokens to sell manually.

Troubleshooting

"No wallet available"

Set the POLYCLAW_PRIVATE_KEY environment variable:

export POLYCLAW_PRIVATE_KEY="0x..."

"Insufficient USDC.e"

Check balance with uv run python scripts/polyclaw.py wallet status. You need USDC.e (bridged USDC) on Polygon.

"CLOB order failed"

The CLOB sell may fail due to:

  • Insufficient liquidity at the sell price
  • IP blocked by Cloudflare (try proxy)

Your split still succeeded - you have the tokens, just couldn't sell unwanted side.

"Approvals not set"

First trade requires contract approvals. Run:

uv run python scripts/polyclaw.py wallet approve

License

MIT