{
  "schemaVersion": "1.0",
  "item": {
    "slug": "polymarket-setup",
    "name": "Polymarket Trading Setup",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/emsin44/polymarket-setup",
    "canonicalUrl": "https://clawhub.ai/emsin44/polymarket-setup",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/polymarket-setup",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=polymarket-setup",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "GUIDE.md",
      "SKILL.md",
      "skill.json"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/polymarket-setup"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/polymarket-setup",
    "agentPageUrl": "https://openagent3.xyz/skills/polymarket-setup/agent",
    "manifestUrl": "https://openagent3.xyz/skills/polymarket-setup/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/polymarket-setup/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Skill: Polymarket Trading Setup",
        "body": "Use this skill when the user wants to:\n\nSet up automated trading on Polymarket\nBuild a Polymarket trading bot from scratch\nConfigure wallet, API credentials, or token approvals for Polymarket\nUnderstand how to connect to Polymarket's APIs\nDebug issues with an existing Polymarket bot setup\n\nThe full technical reference is in GUIDE.md (same directory as this file). Read it before starting."
      },
      {
        "title": "What You're Setting Up",
        "body": "Polymarket trading requires four things in order:\n\nA funded proxy wallet with USDC on Polygon\nToken approvals (USDC spend approved for exchange contracts)\nCLOB API credentials (derived from the wallet, stored in env)\nConnectivity verified across all four API surfaces"
      },
      {
        "title": "Step 1: Check What Already Exists",
        "body": "Before doing anything, check:\n\nIs there an .env file with POLYMARKET_PRIVATE_KEY and POLYMARKET_PROXY_ADDRESS?\nIs there a config.json with Polymarket settings?\nIs there an existing bot directory to work within?\n\nIf credentials already exist, load and validate them rather than starting from scratch."
      },
      {
        "title": "Step 2: Environment Setup",
        "body": "If starting fresh, create a .env file with:\n\nPOLYMARKET_PRIVATE_KEY=0x...\nPOLYMARKET_PUBLIC_ADDRESS=0x...     # proxy wallet address\nPOLYMARKET_PROXY_ADDRESS=0x...      # same as PUBLIC_ADDRESS for type 2\nPOLYMARKET_SIGNATURE_TYPE=2\nPOLYMARKET_WEBSOCKET_URL=wss://ws-subscriptions-clob.polymarket.com\nPOLYMARKET_DATA_API=https://data-api.polymarket.com\n\nThe proxy wallet address comes from the user's Polymarket account settings page."
      },
      {
        "title": "Step 3: Install Dependencies",
        "body": "pip install \"py-clob-client>=0.28.0\" httpx \"websocket-client>=1.9.0\" orjson pandas python-dotenv\n\nOr add to pyproject.toml and run uv sync."
      },
      {
        "title": "Step 4: Token Approvals",
        "body": "Via UI (recommended for new users): Deposit USDC through the Polymarket web app — approvals happen automatically.\n\nHeadless (server deployment): Use the programmatic approval flow from GUIDE.md Section 4. This requires Polymarket Builder API credentials (separate from CLOB creds).\n\nThe four contracts that need approval are listed in GUIDE.md Section 2."
      },
      {
        "title": "Step 5: Derive and Persist API Credentials",
        "body": "from py_clob_client.client import ClobClient\n\nclient = ClobClient(\n    \"https://clob.polymarket.com\",\n    key=os.getenv(\"POLYMARKET_PRIVATE_KEY\"),\n    chain_id=137,\n    signature_type=int(os.getenv(\"POLYMARKET_SIGNATURE_TYPE\", \"2\")),\n    funder=os.getenv(\"POLYMARKET_PROXY_ADDRESS\"),\n)\ncreds = client.derive_api_key()\n# Write credentials to .env — do not log or print them\n\nAdd to .env:\n\nPOLYMARKET_API_KEY=...\nPOLYMARKET_API_SECRET=...\nPOLYMARKET_API_PASSPHRASE=...\n\nOn subsequent startups, load from env instead of re-deriving (see GUIDE.md Section 3)."
      },
      {
        "title": "Step 6: Verify Connectivity",
        "body": "Test each surface in order. Stop and diagnose if any step fails.\n\nimport httpx, json\n\n# 1. Gamma API\nevent = httpx.get(\"https://gamma-api.polymarket.com/events/slug/bitcoin-price-on-february-11\").json()\nprint(f\"Gamma OK: {event.get('title')}\")\n\n# 2. CLOB REST - order book\nbook = httpx.get(\"https://clob.polymarket.com/book\", params={\"token_id\": \"<any_token_id>\"}).json()\nprint(f\"CLOB OK: {len(book.get('bids', []))} bids, {len(book.get('asks', []))} asks\")\n\n# 3. Data API - positions\npositions = httpx.get(\n    \"https://data-api.polymarket.com/positions\",\n    params={\"user\": os.getenv(\"POLYMARKET_PROXY_ADDRESS\")}\n).json()\nprint(f\"Data API OK: {len(positions)} open positions\")"
      },
      {
        "title": "Step 7: Place a Test Order",
        "body": "Place a 2-share order at a far-from-market price (very low probability on a real market) to verify the full signing and posting flow without risk of a fill:\n\nfrom py_clob_client.clob_types import OrderArgs, OrderType\nfrom py_clob_client.order_builder.constants import BUY\n\n# Use a real token ID from Step 6, price far from market\norder = OrderArgs(price=0.02, side=BUY, size=2, token_id=\"<token_id>\")\nsigned = client.create_order(order)\nresp = client.post_order(signed, OrderType.FAK)\nprint(resp)  # Should show success: true"
      },
      {
        "title": "Key Facts to Remember",
        "body": "Chain: Polygon mainnet (ID: 137)\nCurrency: USDC (0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359)\nSignature type 2 is standard for programmatic trading\nProxy address ≠ signing key address — positions live on proxy, orders signed by EOA\nclobTokenIds[0] = YES, clobTokenIds[1] = NO — never mix these up\nMinimum order value: $1.00 — size * price >= 1.0\nOrder size must be integer — always int()\nUpdate positions only on MINED, not MATCHED — MATCHED can fail"
      },
      {
        "title": "Common First-Time Failures",
        "body": "SymptomLikely Causeinsufficient balanceWrong address used (EOA instead of proxy), or USDC not depositedOrder silently rejectedPrice has too many decimal places — round to 2dp (or 3dp if price < 0.04 or > 0.96)Order value errorsize * price < 1.0WebSocket never sends dataWrong subscription message format, or using array instead of objectPositions always emptyQuerying EOA address instead of proxy wallet addressStale positions after tradeUpdating on MATCHED instead of MINED"
      },
      {
        "title": "Reference",
        "body": "Full API reference, all code patterns, and detailed explanations: GUIDE.md (same directory)."
      }
    ],
    "body": "Skill: Polymarket Trading Setup\n\nUse this skill when the user wants to:\n\nSet up automated trading on Polymarket\nBuild a Polymarket trading bot from scratch\nConfigure wallet, API credentials, or token approvals for Polymarket\nUnderstand how to connect to Polymarket's APIs\nDebug issues with an existing Polymarket bot setup\n\nThe full technical reference is in GUIDE.md (same directory as this file). Read it before starting.\n\nWhat You're Setting Up\n\nPolymarket trading requires four things in order:\n\nA funded proxy wallet with USDC on Polygon\nToken approvals (USDC spend approved for exchange contracts)\nCLOB API credentials (derived from the wallet, stored in env)\nConnectivity verified across all four API surfaces\nStep-by-Step Agent Instructions\nStep 1: Check What Already Exists\n\nBefore doing anything, check:\n\nIs there an .env file with POLYMARKET_PRIVATE_KEY and POLYMARKET_PROXY_ADDRESS?\nIs there a config.json with Polymarket settings?\nIs there an existing bot directory to work within?\n\nIf credentials already exist, load and validate them rather than starting from scratch.\n\nStep 2: Environment Setup\n\nIf starting fresh, create a .env file with:\n\nPOLYMARKET_PRIVATE_KEY=0x...\nPOLYMARKET_PUBLIC_ADDRESS=0x...     # proxy wallet address\nPOLYMARKET_PROXY_ADDRESS=0x...      # same as PUBLIC_ADDRESS for type 2\nPOLYMARKET_SIGNATURE_TYPE=2\nPOLYMARKET_WEBSOCKET_URL=wss://ws-subscriptions-clob.polymarket.com\nPOLYMARKET_DATA_API=https://data-api.polymarket.com\n\n\nThe proxy wallet address comes from the user's Polymarket account settings page.\n\nStep 3: Install Dependencies\npip install \"py-clob-client>=0.28.0\" httpx \"websocket-client>=1.9.0\" orjson pandas python-dotenv\n\n\nOr add to pyproject.toml and run uv sync.\n\nStep 4: Token Approvals\n\nVia UI (recommended for new users): Deposit USDC through the Polymarket web app — approvals happen automatically.\n\nHeadless (server deployment): Use the programmatic approval flow from GUIDE.md Section 4. This requires Polymarket Builder API credentials (separate from CLOB creds).\n\nThe four contracts that need approval are listed in GUIDE.md Section 2.\n\nStep 5: Derive and Persist API Credentials\nfrom py_clob_client.client import ClobClient\n\nclient = ClobClient(\n    \"https://clob.polymarket.com\",\n    key=os.getenv(\"POLYMARKET_PRIVATE_KEY\"),\n    chain_id=137,\n    signature_type=int(os.getenv(\"POLYMARKET_SIGNATURE_TYPE\", \"2\")),\n    funder=os.getenv(\"POLYMARKET_PROXY_ADDRESS\"),\n)\ncreds = client.derive_api_key()\n# Write credentials to .env — do not log or print them\n\n\nAdd to .env:\n\nPOLYMARKET_API_KEY=...\nPOLYMARKET_API_SECRET=...\nPOLYMARKET_API_PASSPHRASE=...\n\n\nOn subsequent startups, load from env instead of re-deriving (see GUIDE.md Section 3).\n\nStep 6: Verify Connectivity\n\nTest each surface in order. Stop and diagnose if any step fails.\n\nimport httpx, json\n\n# 1. Gamma API\nevent = httpx.get(\"https://gamma-api.polymarket.com/events/slug/bitcoin-price-on-february-11\").json()\nprint(f\"Gamma OK: {event.get('title')}\")\n\n# 2. CLOB REST - order book\nbook = httpx.get(\"https://clob.polymarket.com/book\", params={\"token_id\": \"<any_token_id>\"}).json()\nprint(f\"CLOB OK: {len(book.get('bids', []))} bids, {len(book.get('asks', []))} asks\")\n\n# 3. Data API - positions\npositions = httpx.get(\n    \"https://data-api.polymarket.com/positions\",\n    params={\"user\": os.getenv(\"POLYMARKET_PROXY_ADDRESS\")}\n).json()\nprint(f\"Data API OK: {len(positions)} open positions\")\n\nStep 7: Place a Test Order\n\nPlace a 2-share order at a far-from-market price (very low probability on a real market) to verify the full signing and posting flow without risk of a fill:\n\nfrom py_clob_client.clob_types import OrderArgs, OrderType\nfrom py_clob_client.order_builder.constants import BUY\n\n# Use a real token ID from Step 6, price far from market\norder = OrderArgs(price=0.02, side=BUY, size=2, token_id=\"<token_id>\")\nsigned = client.create_order(order)\nresp = client.post_order(signed, OrderType.FAK)\nprint(resp)  # Should show success: true\n\nKey Facts to Remember\nChain: Polygon mainnet (ID: 137)\nCurrency: USDC (0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359)\nSignature type 2 is standard for programmatic trading\nProxy address ≠ signing key address — positions live on proxy, orders signed by EOA\nclobTokenIds[0] = YES, clobTokenIds[1] = NO — never mix these up\nMinimum order value: $1.00 — size * price >= 1.0\nOrder size must be integer — always int()\nUpdate positions only on MINED, not MATCHED — MATCHED can fail\nCommon First-Time Failures\nSymptom\tLikely Cause\ninsufficient balance\tWrong address used (EOA instead of proxy), or USDC not deposited\nOrder silently rejected\tPrice has too many decimal places — round to 2dp (or 3dp if price < 0.04 or > 0.96)\nOrder value error\tsize * price < 1.0\nWebSocket never sends data\tWrong subscription message format, or using array instead of object\nPositions always empty\tQuerying EOA address instead of proxy wallet address\nStale positions after trade\tUpdating on MATCHED instead of MINED\nReference\n\nFull API reference, all code patterns, and detailed explanations: GUIDE.md (same directory)."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/emsin44/polymarket-setup",
    "publisherUrl": "https://clawhub.ai/emsin44/polymarket-setup",
    "owner": "emsin44",
    "version": "1.0.6",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/polymarket-setup",
    "downloadUrl": "https://openagent3.xyz/downloads/polymarket-setup",
    "agentUrl": "https://openagent3.xyz/skills/polymarket-setup/agent",
    "manifestUrl": "https://openagent3.xyz/skills/polymarket-setup/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/polymarket-setup/agent.md"
  }
}