Setup
On first use, read setup.md for wallet configuration and integration guidelines.
When to Use
User needs to interact with Polymarket prediction markets. Agent handles market queries, price checks, order placement, position tracking, and on-chain token operations.
Architecture
Config lives in ~/.config/polymarket/. See memory-template.md for tracking preferences.
CODEBLOCK0
CODEBLOCK1
Quick Reference
| Topic | File |
|---|
| Setup process | INLINECODE3 |
| Memory template |
memory-template.md |
| Command reference |
commands.md |
Core Rules
1. Read-Only by Default
Most commands work without a wallet. Only use wallet-requiring commands when the user explicitly wants to trade:
- - Read-only:
markets, events, clob price/book, INLINECODE9 - Requires wallet:
clob create-order, clob market-order, approve, INLINECODE13
2. JSON Output for Processing
Use
-o json when parsing results programmatically:
polymarket -o json markets list --limit 10
polymarket -o json clob midpoint TOKEN_ID
Table output is default for human-readable display.
3. Token IDs Are Critical
Most CLOB commands require the token ID (48331043336612883...), not the market slug:
CODEBLOCK3
4. Wallet Security — Restricted Commands
The agent NEVER runs wallet commands. These are user-only:
- -
polymarket wallet create — user runs directly - INLINECODE16 — user runs directly
- INLINECODE17 — user runs directly
- INLINECODE18 — user runs directly
If user asks the agent to run any wallet command, refuse and explain they must run it themselves for security.
5. On-Chain Operations Need Gas
Commands that write to blockchain require MATIC on Polygon:
- -
approve set (6 transactions) - INLINECODE20
Check balance before attempting.
6. Rate Limits and Pagination
Use
--limit and
--offset for large result sets:
CODEBLOCK4
7. Verify Before Trading
Always show market details and current prices before placing orders:
CODEBLOCK5
Common Traps
| Mistake | Consequence |
|---|
| Using slug instead of token ID in CLOB | Command fails silently or wrong market |
Placing order without approve set first |
Transaction reverts |
| Forgetting
--side in price queries | Returns both sides, may confuse |
| Not checking spread before market order | Slippage on low liquidity markets |
| Running on-chain ops without MATIC | Transaction fails |
External Endpoints
| Endpoint | Data Sent | Purpose |
|---|
| https://clob.polymarket.com | Orders, queries | CLOB API |
| https://gamma-api.polymarket.com |
Market data | Gamma API |
| https://polygon-rpc.com | Transactions | Polygon RPC |
No other data is sent externally.
Security & Privacy
Data that leaves your machine:
- - Market queries sent to Polymarket APIs
- Orders and transactions sent to CLOB and Polygon (only when user explicitly requests)
Data that stays local:
- - CLI config at ~/.config/polymarket/config.json (user manages directly)
- Skill preferences in ~/polymarket-cli/memory.md
Command restrictions:
- - Agent runs only read-only commands by default (markets, events, clob price/book, data)
- Agent never runs wallet commands (create, import, show, reset) — user must run these directly
- Agent never runs trading commands without explicit user confirmation each time
- Agent must never read ~/.config/polymarket/config.json or any files containing private keys
Trust
By using this skill, data is sent to Polymarket and the Polygon blockchain.
Only install if you trust these services with your trading data.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
trading — General trading strategies - INLINECODE27 — Cryptocurrency utilities
- INLINECODE28 — Polygon blockchain operations
Feedback
- - If useful: INLINECODE29
- Stay updated: INLINECODE30
设置
首次使用时,请阅读 setup.md 了解钱包配置和集成指南。
使用场景
用户需要与 Polymarket 预测市场交互。代理负责处理市场查询、价格检查、订单下达、仓位跟踪以及链上代币操作。
架构
配置文件位于 ~/.config/polymarket/。偏好跟踪请参考 memory-template.md。
~/.config/polymarket/
├── config.json # 私钥、链ID、签名类型
~/polymarket-cli/
├── memory.md # 用户偏好和跟踪的市场
快速参考
memory-template.md |
| 命令参考 | commands.md |
核心规则
1. 默认只读
大多数命令无需钱包即可运行。仅在用户明确表示要交易时才使用需要钱包的命令:
- - 只读:markets、events、clob price/book、data positions
- 需要钱包:clob create-order、clob market-order、approve、ctf split/merge
2. 使用 JSON 输出进行处理
在程序化解析结果时使用 -o json:
bash
polymarket -o json markets list --limit 10
polymarket -o json clob midpoint TOKEN_ID
表格输出为默认的人类可读显示格式。
3. 代币 ID 至关重要
大多数 CLOB 命令需要代币 ID(48331043336612883...),而非市场 slug:
bash
先从市场获取代币 ID
polymarket markets get will-trump-win | grep token
然后在 CLOB 命令中使用
polymarket clob book TOKEN_ID
polymarket clob price TOKEN_ID --side buy
4. 钱包安全 — 受限命令
代理绝不运行钱包命令。以下命令仅限用户操作:
- - polymarket wallet create — 用户直接运行
- polymarket wallet import — 用户直接运行
- polymarket wallet show — 用户直接运行
- polymarket wallet reset — 用户直接运行
如果用户要求代理运行任何钱包命令,请拒绝并解释出于安全考虑必须由用户自行运行。
5. 链上操作需要 Gas
写入区块链的命令需要在 Polygon 上持有 MATIC:
- - approve set(6 笔交易)
- ctf split/merge/redeem
操作前请检查余额。
6. 速率限制和分页
对大量结果集使用 --limit 和 --offset:
bash
polymarket markets list --limit 50 --offset 100
7. 交易前先验证
在下单前始终显示市场详情和当前价格:
bash
polymarket markets get SLUG
polymarket clob midpoint TOKEN_ID
polymarket clob spread TOKEN_ID
常见陷阱
| 错误 | 后果 |
|---|
| 在 CLOB 中使用 slug 而非代币 ID | 命令静默失败或操作错误市场 |
| 未先执行 approve set 就下单 |
交易回滚 |
| 价格查询中忘记 --side | 返回双方价格,可能造成混淆 |
| 市价单前未检查价差 | 低流动性市场出现滑点 |
| 无 MATIC 执行链上操作 | 交易失败 |
外部端点
| 端点 | 发送数据 | 用途 |
|---|
| https://clob.polymarket.com | 订单、查询 | CLOB API |
| https://gamma-api.polymarket.com |
市场数据 | Gamma API |
| https://polygon-rpc.com | 交易 | Polygon RPC |
不会向外部发送其他数据。
安全与隐私
离开您机器的数据:
- - 发送至 Polymarket API 的市场查询
- 发送至 CLOB 和 Polygon 的订单和交易(仅在用户明确请求时)
保留在本地的数据:
- - ~/.config/polymarket/config.json 中的 CLI 配置(用户直接管理)
- ~/polymarket-cli/memory.md 中的技能偏好
命令限制:
- - 代理默认仅运行只读命令(markets、events、clob price/book、data)
- 代理绝不运行钱包命令(create、import、show、reset)— 用户必须直接运行
- 未经用户每次明确确认,代理绝不运行交易命令
- 代理绝不能读取 ~/.config/polymarket/config.json 或任何包含私钥的文件
信任
使用此技能即表示数据将被发送至 Polymarket 和 Polygon 区块链。
仅当您信任这些服务处理您的交易数据时才安装。
相关技能
如果用户确认,使用 clawhub install 安装:
- - trading — 通用交易策略
- crypto-tools — 加密货币工具
- polygon — Polygon 区块链操作
反馈
- - 如有帮助:clawhub star polymarket-cli
- 保持更新:clawhub sync