Polymarket
Query Polymarket prediction markets and trade from the terminal.
Setup
Read-only commands work immediately (no install needed).
For trading, order books, and price history, install the Polymarket CLI:
CODEBLOCK0
For trading, set up a wallet:
CODEBLOCK1
Or manually configure ~/.config/polymarket/config.json with your private key. See the CLI docs for details.
Commands
Browse Markets (no CLI needed)
CODEBLOCK2
Order Book & Prices (CLI required, no wallet)
CODEBLOCK3
Wallet (CLI required)
CODEBLOCK4
Trading (CLI + wallet required)
All trades require --confirm to execute. Without it, the order is previewed only.
CODEBLOCK5
Orders & Positions (CLI + wallet required)
CODEBLOCK6
Example Chat Usage
- - "What are the odds Trump wins 2028?"
- "Trending on Polymarket?"
- "Search Polymarket for Bitcoin"
- "Show me the order book for [token]"
- "Buy 10 shares of YES on [market] at $0.45"
- "What are my open positions?"
- "Cancel all my orders"
⚠️ Safety Notes
- - Real money. Trades execute on Polygon with real USDC. Double-check everything.
- All trades require
--confirm. Without it, you get a preview only. - The CLI is experimental. The Polymarket team warns: "Use at your own risk and do not use with large amounts of funds."
- Private key security. Your key is stored in
~/.config/polymarket/config.json. Keep it safe. - Gas fees. On-chain operations (approvals, splits, redeems) require MATIC for gas.
API
Read-only commands use the public Gamma API (no auth):
Trading commands wrap the official Polymarket CLI (Rust binary).
Polymarket
从终端查询Polymarket预测市场并进行交易。
设置
只读命令可立即使用(无需安装)。
如需交易、查看订单簿和价格历史,请安装Polymarket CLI:
bash
curl -sSL https://raw.githubusercontent.com/Polymarket/polymarket-cli/main/install.sh | sh
如需交易,请设置钱包:
bash
python3 {baseDir}/scripts/polymarket.py wallet-setup
或手动配置~/.config/polymarket/config.json,填入您的私钥。详情请参阅CLI文档。
命令
浏览市场(无需CLI)
bash
热门/活跃市场
python3 {baseDir}/scripts/polymarket.py trending
搜索市场
python3 {baseDir}/scripts/polymarket.py search trump
通过slug获取特定事件
python3 {baseDir}/scripts/polymarket.py event fed-decision-in-october
按类别获取市场
python3 {baseDir}/scripts/polymarket.py category politics
python3 {baseDir}/scripts/polymarket.py category crypto
订单簿与价格(需要CLI,无需钱包)
bash
某个代币的订单簿
python3 {baseDir}/scripts/polymarket.py book TOKEN_ID
价格历史
python3 {baseDir}/scripts/polymarket.py price-history TOKEN_ID --interval 1d
钱包(需要CLI)
bash
python3 {baseDir}/scripts/polymarket.py wallet-setup
python3 {baseDir}/scripts/polymarket.py wallet-show
python3 {baseDir}/scripts/polymarket.py wallet-balance
python3 {baseDir}/scripts/polymarket.py wallet-balance --token TOKEN_ID
交易(需要CLI + 钱包)
所有交易都需要--confirm才能执行。没有该参数时,仅预览订单。
bash
买入限价单:以0.50美元买入10股
python3 {baseDir}/scripts/polymarket.py --confirm trade buy --token TOKEN_ID --price 0.50 --size 10
卖出限价单
python3 {baseDir}/scripts/polymarket.py --confirm trade sell --token TOKEN_ID --price 0.70 --size 10
市价单:买入价值5美元
python3 {baseDir}/scripts/polymarket.py --confirm trade buy --token TOKEN_ID --market-order --amount 5
订单与持仓(需要CLI + 钱包)
bash
列出未成交订单
python3 {baseDir}/scripts/polymarket.py orders
取消特定订单
python3 {baseDir}/scripts/polymarket.py --confirm orders --cancel ORDER_ID
取消所有订单
python3 {baseDir}/scripts/polymarket.py --confirm orders --cancel all
查看持仓
python3 {baseDir}/scripts/polymarket.py positions
python3 {baseDir}/scripts/polymarket.py positions --address 0xYOUR_WALLET
聊天使用示例
- - 特朗普赢得2028年大选的赔率是多少?
- Polymarket上有什么热门?
- 在Polymarket上搜索Bitcoin
- 显示[代币]的订单簿
- 以0.45美元买入[市场]的10股YES
- 我有哪些未平仓头寸?
- 取消我所有的订单
⚠️ 安全提示
- - 真实资金。 交易在Polygon上使用真实USDC执行。请仔细核对所有信息。
- 所有交易都需要--confirm。 没有该参数时,仅显示预览。
- CLI为实验性功能。 Polymarket团队警告:请自行承担使用风险,请勿使用大额资金。
- 私钥安全。 您的密钥存储在~/.config/polymarket/config.json中。请妥善保管。
- Gas费用。 链上操作(批准、拆分、赎回)需要MATIC作为Gas。
API
只读命令使用公共Gamma API(无需认证):
- - 基础URL:https://gamma-api.polymarket.com
交易命令封装了官方Polymarket CLI(Rust二进制文件)。