Polymarket CLI Skill
This skill enables you to interact with Polymarket prediction markets using the official polymarket CLI tool. Unlike Polyclaw (which manages autonomous trading), this skill gives you direct, granular control over trading, research, and portfolio management.
Installation
Quick Install (macOS/Linux)
CODEBLOCK0
Shell Script (All Platforms)
CODEBLOCK1
Verify Installation
CODEBLOCK2
Wallet Setup
Three Ways to Provide Private Key
- 1. CLI flag: INLINECODE1
- Environment variable: INLINECODE2
- Config file: INLINECODE3
Create New Wallet
CODEBLOCK3
Approvals (Required Before Trading)
CODEBLOCK4
Output Formats
Every command supports -o json or -o table (default):
CODEBLOCK5
Market Research
Browse Markets
CODEBLOCK6
Events (Grouped Markets)
CODEBLOCK7
Tags & Series
CODEBLOCK8
Order Book Analysis (No Wallet Needed)
CODEBLOCK9
Price history intervals: 1m, 1h, 6h, 1d, 1w, max
Trading (CLOB)
Place Orders
CODEBLOCK10
Manage Orders
CODEBLOCK11
Check Balance & Trades
CODEBLOCK12
On-Chain Data
Portfolio & Positions
CODEBLOCK13
Market Data
CODEBLOCK14
CTF Operations
Conditional Token Framework operations for advanced users.
CODEBLOCK15
INLINECODE12 is in USDC (e.g., 10 = $10). Default --partition is binary (1,2).
Bridge (Deposit Funds)
CODEBLOCK16
Rewards & API
CODEBLOCK17
Interactive Shell
CODEBLOCK18
Supports command history - useful for exploratory analysis.
Common Workflows
Research → Trade Flow
CODEBLOCK19
Monitor Portfolio
CODEBLOCK20
Arbitrage Detection
CODEBLOCK21
Error Handling
| Situation | Action |
|---|
| API error | Check polymarket status for API health |
| Insufficient balance |
Check
polymarket clob balance --asset-type collateral |
| Approval needed | Run
polymarket approve set (needs MATIC) |
| Order rejected | Check order parameters, slippage |
| Wallet not configured | Run
polymarket wallet create or set private key |
Quick Reference
CODEBLOCK22
Advanced Tips
- 1. Use JSON output for automation:
-o json enables scripting with INLINECODE21 - Batch operations: Use comma-separated lists for efficiency
- Price history for analysis: Use
--interval 1d --fidelity 30 for daily candles - Track maker rewards: Check
clob order-scoring for your orders - CTF for larger trades: Split/merge can be more capital efficient than CLOB for large sizes
Differences from Polyclaw
| Feature | Polyclaw | Polymarket CLI |
|---|
| Trading mode | Autonomous agent | Manual/direct |
| Token creation |
Yes (via Clanker) | No |
| Market discovery | AI-powered | Manual search |
| Social posting | Auto | Manual |
| Order book access | Limited | Full |
| CTF operations | No | Yes |
| Rewards tracking | Dashboard | Full API |
| Control level | High-level | Low-level |
Use Polyclaw when you want autonomous trading with a performance token.
Use Polymarket CLI when you want direct control, arbitrage, or custom strategies.
Polymarket CLI 技能
此技能使您能够使用官方 polymarket CLI 工具与 Polymarket 预测市场进行交互。与 Polyclaw(管理自主交易)不同,此技能为您提供对交易、研究和投资组合管理的直接、精细控制。
安装
快速安装(macOS/Linux)
bash
brew tap Polymarket/polymarket-cli https://github.com/Polymarket/polymarket-cli
brew install polymarket
Shell 脚本(所有平台)
bash
curl -sSL https://raw.githubusercontent.com/Polymarket/polymarket-cli/main/install.sh | sh
验证安装
bash
polymarket --version
polymarket --help
钱包设置
提供私钥的三种方式
- 1. CLI 标志:--private-key 0xabc...
- 环境变量:export POLYMARKETPRIVATEKEY=0xabc...
- 配置文件:~/.config/polymarket/config.json
创建新钱包
bash
生成新钱包(保存到配置)
polymarket wallet create
或强制覆盖现有钱包
polymarket wallet create --force
导入现有私钥
polymarket wallet import 0xabc123...
查看钱包地址
polymarket wallet address
完整钱包信息
polymarket wallet show
授权(交易前必需)
bash
检查当前授权状态
polymarket approve check
polymarket approve check 0xYOUR_ADDRESS
设置授权(发送 6 笔链上交易,需要 MATIC 作为 gas 费)
polymarket approve set
输出格式
每个命令都支持 -o json 或 -o table(默认):
bash
人类可读的表格
polymarket markets list --limit 3
用于脚本/代理的 JSON
polymarket -o json markets list --limit 3
通过管道传递给 jq 获取特定字段
polymarket -o json markets search bitcoin | jq .[].question
市场研究
浏览市场
bash
使用筛选条件列出市场
polymarket markets list --limit 10
polymarket markets list --active true --order volume_num
polymarket markets list --closed false --limit 50 --offset 25
通过 ID 或 slug 获取特定市场
polymarket markets get 12345
polymarket markets get will-trump-win-the-2024-election
搜索市场
polymarket markets search bitcoin --limit 5
polymarket markets search election --limit 10
事件(分组市场)
bash
列出事件
polymarket events list --limit 10
polymarket events list --tag politics --active true
获取特定事件
polymarket events get 500
获取事件标签
polymarket events tags 500
标签与系列
bash
浏览标签
polymarket tags list
polymarket tags get politics
polymarket tags related politics
系列(重复事件)
polymarket series list --limit 10
polymarket series get 42
订单簿分析(无需钱包)
bash
检查价格
polymarket clob price TOKEN_ID --side buy
polymarket clob midpoint TOKEN_ID
polymarket clob spread TOKEN_ID
批量价格
polymarket clob batch-prices TOKEN1,TOKEN2 --side buy
polymarket clob midpoints TOKEN1,TOKEN2
订单簿
polymarket clob book TOKEN_ID
最后一笔交易
polymarket clob last-trade TOKEN_ID
价格历史
polymarket clob price-history TOKEN_ID --interval 1d --fidelity 30
市场元数据
polymarket clob tick-size TOKEN_ID
polymarket clob fee-rate TOKEN_ID
polymarket clob neg-risk TOKEN_ID
价格历史时间间隔:1m、1h、6h、1d、1w、max
交易(CLOB)
下订单
bash
限价单(以 $0.50 买入 10 股)
polymarket clob create-order \
--token TOKEN_ID \
--side buy --price 0.50 --size 10
市价单(买入价值 $5)
polymarket clob market-order \
--token TOKEN_ID \
--side buy --amount 5
同时下多个订单
polymarket clob post-orders \
--tokens TOKEN1,TOKEN2 \
--side buy \
--prices 0.40,0.60 \
--sizes 10,10
订单类型:GTC(默认)、FOK、GTD、FAK
限价单添加 --post-only
管理订单
bash
查看您的订单
polymarket clob orders
polymarket clob orders --market 0xCONDITION...
获取特定订单
polymarket clob order ORDER_ID
取消订单
polymarket clob cancel ORDER_ID
polymarket clob cancel-orders ORDER1,ORDER2
polymarket clob cancel-market --market 0xCONDITION...
polymarket clob cancel-all
检查余额与交易
bash
抵押品余额(USDC)
polymarket clob balance --asset-type collateral
条件代币余额
polymarket clob balance --asset-type conditional --token TOKEN_ID
更新余额缓存
polymarket clob update-balance --asset-type collateral
您的交易
polymarket clob trades
带评分的订单详情
polymarket clob order-scoring ORDER_ID
链上数据
投资组合与持仓
bash
当前持仓
polymarket data positions 0xWALLET_ADDRESS
polymarket data closed-positions 0xWALLET_ADDRESS
投资组合价值
polymarket data value 0xWALLET_ADDRESS
交易历史
polymarket data trades 0xWALLET_ADDRESS --limit 50
活动摘要
polymarket data activity 0xWALLET_ADDRESS
市场数据
bash
代币持有者
polymarket data holders 0xCONDITION_ID
未平仓合约
polymarket data open-interest 0xCONDITION_ID
事件交易量
polymarket data volume EVENT_ID
排行榜
polymarket data leaderboard --period month --order-by pnl --limit 10
polymarket data builder-leaderboard --period week
polymarket data builder-volume --period month
CTF 操作
面向高级用户的条件代币框架操作。
bash
将 USDC 拆分为 YES/NO 代币
polymarket ctf split --condition 0xCONDITION... --amount 10
将代币合并回 USDC
polymarket ctf merge --condition 0xCONDITION... --amount 10
结算后赎回获胜代币
polymarket ctf redeem --condition 0xCONDITION...
赎回负风险持仓
polymarket ctf redeem-neg-risk --condition 0xCONDITION... --amounts 10,5
计算条件 ID(只读)
polymarket ctf condition-id --oracle 0xORACLE... --question 0xQUESTION... --outcomes 2
polymarket ctf collection-id --condition 0xCONDITION... --index-set 1
polymarket ctf position-id --collection 0xCOLLECTION...
--amount 以 USDC 为单位(例如 10 = $10)。默认 --partition 为二进制(1,2)。
桥接(存入资金)
bash
获取存款地址(EVM、Solana、Bitcoin)
polymarket bridge deposit 0xWALLET_ADDRESS
支持的资产
polymarket bridge supported-assets
检查存款状态
polymarket bridge status 0xDEPOSIT_ADDRESS
奖励与 API
bash
检查奖励
polymarket clob rewards --date 2024-06-15
polymarket clob earnings --date 2024-06-15
polymarket clob reward-percentages
polymarket clob current-rewards
polymarket clob market-reward 0xCOND