[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82060":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":11,"contributorsCount":11,"subscribersCount":11,"size":11,"stars1d":11,"stars7d":11,"stars30d":11,"stars90d":11,"forks30d":11,"starsTrendScore":11,"compositeScore":13,"rankGlobal":8,"rankLanguage":8,"license":8,"archived":14,"fork":14,"defaultBranch":15,"hasWiki":16,"hasPages":14,"topics":17,"createdAt":8,"pushedAt":8,"updatedAt":18,"readmeContent":19,"aiSummary":20,"trendingCount":11,"starSnapshotCount":11,"syncStatus":21,"lastSyncTime":22,"discoverSource":23},82060,"polymarket-devrel","Polymarket-DevRel\u002Fpolymarket-devrel","Polymarket-DevRel",null,"Rust",145,0,1,34,false,"main",true,[],"2026-06-11 04:07:44","# Polymarket CLI\n\nRust CLI for Polymarket. Browse markets, place orders, manage positions, and interact with onchain contracts — from a terminal or as a JSON API for scripts and agents.\n\n> **Warning:** This is early, experimental software. Use at your own risk and do not use with large amounts of funds. APIs, commands, and behavior may change without notice. Always verify transactions before confirming.\n\n## Install\n\n### Homebrew (macOS \u002F Linux)\n\n```bash\nbrew tap Polymarket\u002Fpolymarket-cli https:\u002F\u002Fgithub.com\u002FPolymarket\u002Fpolymarket-cli\nbrew install polymarket\n```\n\n### Shell script\n\n```bash\ncurl -sSL https:\u002F\u002Fraw.githubusercontent.com\u002FPolymarket\u002Fpolymarket-cli\u002Fmain\u002Finstall.sh | sh\n```\n\n### Build from source\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FPolymarket\u002Fpolymarket-cli\ncd polymarket-cli\ncargo install --path .\n```\n\n## Quick Start\n\n```bash\n# No wallet needed — browse markets immediately\npolymarket markets list --limit 5\npolymarket markets search \"election\"\npolymarket events list --tag politics\n\n# Check a specific market\npolymarket markets get will-trump-win-the-2024-election\n\n# JSON output for scripts\npolymarket -o json markets list --limit 3\n```\n\nTo trade, set up a wallet:\n\n```bash\npolymarket setup\n# Or manually:\npolymarket wallet create\npolymarket approve set\n```\n\n## Configuration\n\n### Wallet Setup\n\nThe CLI needs a private key to sign orders and on-chain transactions. Three ways to provide it (checked in this order):\n\n1. **CLI flag**: `--private-key 0xabc...`\n2. **Environment variable**: `POLYMARKET_PRIVATE_KEY=0xabc...`\n3. **Config file**: `~\u002F.config\u002Fpolymarket\u002Fconfig.json`\n\n```bash\n# Create a new wallet (generates random key, saves to config)\npolymarket wallet create\n\n# Import an existing key\npolymarket wallet import 0xabc123...\n\n# Check what's configured\npolymarket wallet show\n```\n\nThe config file (`~\u002F.config\u002Fpolymarket\u002Fconfig.json`):\n\n```json\n{\n  \"private_key\": \"0x...\",\n  \"chain_id\": 137,\n  \"signature_type\": \"proxy\"\n}\n```\n\n### Signature Types\n\n- `proxy` (default) — uses Polymarket's proxy wallet system\n- `eoa` — signs directly with your key\n- `gnosis-safe` — for multisig wallets\n\nOverride per-command with `--signature-type eoa` or via `POLYMARKET_SIGNATURE_TYPE`.\n\n### What Needs a Wallet\n\nMost commands work without a wallet — browsing markets, viewing order books, checking prices. You only need a wallet for:\n\n- Placing and canceling orders (`clob create-order`, `clob market-order`, `clob cancel-*`)\n- Checking your balances and trades (`clob balance`, `clob trades`, `clob orders`)\n- On-chain operations (`approve set`, `ctf split\u002Fmerge\u002Fredeem`)\n- Reward and API key management (`clob rewards`, `clob create-api-key`)\n\n## Output Formats\n\nEvery command supports `--output table` (default) and `--output json`.\n\n```bash\n# Human-readable table (default)\npolymarket markets list --limit 2\n```\n\n```\n Question                            Price (Yes)  Volume   Liquidity  Status\n Will Trump win the 2024 election?   52.00¢       $145.2M  $1.2M      Active\n Will BTC hit $100k by Dec 2024?     67.30¢       $89.4M   $430.5K    Active\n```\n\n```bash\n# Machine-readable JSON\npolymarket -o json markets list --limit 2\n```\n\n```json\n[\n  { \"id\": \"12345\", \"question\": \"Will Trump win the 2024 election?\", \"outcomePrices\": [\"0.52\", \"0.48\"], ... },\n  { \"id\": \"67890\", \"question\": \"Will BTC hit $100k by Dec 2024?\", ... }\n]\n```\n\nShort form: `-o json` or `-o table`.\n\nErrors follow the same pattern — table mode prints `Error: ...` to stderr, JSON mode prints `{\"error\": \"...\"}` to stdout. Non-zero exit code either way.\n\n## Commands\n\n### Markets\n\n```bash\n# List markets with filters\npolymarket markets list --limit 10\npolymarket markets list --active true --order volume_num\npolymarket markets list --closed false --limit 50 --offset 25\n\n# Get a single market by ID or slug\npolymarket markets get 12345\npolymarket markets get will-trump-win\n\n# Search\npolymarket markets search \"bitcoin\" --limit 5\n\n# Get tags for a market\npolymarket markets tags 12345\n```\n\n**Flags for `markets list`**: `--limit`, `--offset`, `--order`, `--ascending`, `--active`, `--closed`\n\n### Events\n\nEvents group related markets (e.g. \"2024 Election\" contains multiple yes\u002Fno markets).\n\n```bash\npolymarket events list --limit 10\npolymarket events list --tag politics --active true\npolymarket events get 500\npolymarket events tags 500\n```\n\n**Flags for `events list`**: `--limit`, `--offset`, `--order`, `--ascending`, `--active`, `--closed`, `--tag`\n\n### Tags, Series, Comments, Profiles, Sports\n\n```bash\n# Tags\npolymarket tags list\npolymarket tags get politics\npolymarket tags related politics\npolymarket tags related-tags politics\n\n# Series (recurring events)\npolymarket series list --limit 10\npolymarket series get 42\n\n# Comments on an entity\npolymarket comments list --entity-type event --entity-id 500\npolymarket comments get abc123\npolymarket comments by-user 0xf5E6...\n\n# Public profiles\npolymarket profiles get 0xf5E6...\n\n# Sports metadata\npolymarket sports list\npolymarket sports market-types\npolymarket sports teams --league NFL --limit 32\n```\n\n### Order Book & Prices (CLOB)\n\nAll read-only — no wallet needed.\n\n```bash\n# Check API health\npolymarket clob ok\n\n# Prices\npolymarket clob price 48331043336612883... --side buy\npolymarket clob midpoint 48331043336612883...\npolymarket clob spread 48331043336612883...\n\n# Batch queries (comma-separated token IDs)\npolymarket clob batch-prices \"TOKEN1,TOKEN2\" --side buy\npolymarket clob midpoints \"TOKEN1,TOKEN2\"\npolymarket clob spreads \"TOKEN1,TOKEN2\"\n\n# Order book\npolymarket clob book 48331043336612883...\npolymarket clob books \"TOKEN1,TOKEN2\"\n\n# Last trade\npolymarket clob last-trade 48331043336612883...\n\n# Market info\npolymarket clob market 0xABC123...  # by condition ID\npolymarket clob markets             # list all\n\n# Price history\npolymarket clob price-history 48331043336612883... --interval 1d --fidelity 30\n\n# Metadata\npolymarket clob tick-size 48331043336612883...\npolymarket clob fee-rate 48331043336612883...\npolymarket clob neg-risk 48331043336612883...\npolymarket clob time\npolymarket clob geoblock\n```\n\n**Interval options for `price-history`**: `1m`, `1h`, `6h`, `1d`, `1w`, `max`\n\n### Trading (CLOB, authenticated)\n\nRequires a configured wallet.\n\n```bash\n# Place a limit order (buy 10 shares at $0.50)\npolymarket clob create-order \\\n  --token 48331043336612883... \\\n  --side buy --price 0.50 --size 10\n\n# Place a market order (buy $5 worth)\npolymarket clob market-order \\\n  --token 48331043336612883... \\\n  --side buy --amount 5\n\n# Post multiple orders at once\npolymarket clob post-orders \\\n  --tokens \"TOKEN1,TOKEN2\" \\\n  --side buy \\\n  --prices \"0.40,0.60\" \\\n  --sizes \"10,10\"\n\n# Cancel\npolymarket clob cancel ORDER_ID\npolymarket clob cancel-orders \"ORDER1,ORDER2\"\npolymarket clob cancel-market --market 0xCONDITION...\npolymarket clob cancel-all\n\n# View your orders and trades\npolymarket clob orders\npolymarket clob orders --market 0xCONDITION...\npolymarket clob order ORDER_ID\npolymarket clob trades\n\n# Check balances\npolymarket clob balance --asset-type collateral\npolymarket clob balance --asset-type conditional --token 48331043336612883...\npolymarket clob update-balance --asset-type collateral\n```\n\n**Order types**: `GTC` (default), `FOK`, `GTD`, `FAK`. Add `--post-only` for limit orders.\n\n### Rewards & API Keys (CLOB, authenticated)\n\n```bash\npolymarket clob rewards --date 2024-06-15\npolymarket clob earnings --date 2024-06-15\npolymarket clob earnings-markets --date 2024-06-15\npolymarket clob reward-percentages\npolymarket clob current-rewards\npolymarket clob market-reward 0xCONDITION...\n\n# Check if orders are scoring rewards\npolymarket clob order-scoring ORDER_ID\npolymarket clob orders-scoring \"ORDER1,ORDER2\"\n\n# API key management\npolymarket clob api-keys\npolymarket clob create-api-key\npolymarket clob delete-api-key\n\n# Account status\npolymarket clob account-status\npolymarket clob notifications\npolymarket clob delete-notifications \"NOTIF1,NOTIF2\"\n```\n\n### On-Chain Data\n\nPublic data — no wallet needed.\n\n```bash\n# Portfolio\npolymarket data positions 0xWALLET_ADDRESS\npolymarket data closed-positions 0xWALLET_ADDRESS\npolymarket data value 0xWALLET_ADDRESS\npolymarket data traded 0xWALLET_ADDRESS\n\n# Trade history\npolymarket data trades 0xWALLET_ADDRESS --limit 50\n\n# Activity\npolymarket data activity 0xWALLET_ADDRESS\n\n# Market data\npolymarket data holders 0xCONDITION_ID\npolymarket data open-interest 0xCONDITION_ID\npolymarket data volume 12345  # event ID\n\n# Leaderboards\npolymarket data leaderboard --period month --order-by pnl --limit 10\npolymarket data builder-leaderboard --period week\npolymarket data builder-volume --period month\n```\n\n### Contract Approvals\n\nBefore trading, Polymarket contracts need ERC-20 (pUSD) and ERC-1155 (CTF token) approvals.\n\n```bash\n# Check current approvals (read-only)\npolymarket approve check\npolymarket approve check 0xSOME_ADDRESS\n\n# Approve all contracts (sends on-chain transactions, needs MATIC for gas)\npolymarket approve set\n```\n\n### CTF Operations\n\nSplit, merge, and redeem conditional tokens directly on-chain.\n\n```bash\n# Split $10 pUSD into YES\u002FNO tokens\npolymarket ctf split --condition 0xCONDITION... --amount 10\n\n# Merge tokens back to pUSD\npolymarket ctf merge --condition 0xCONDITION... --amount 10\n\n# Redeem winning tokens after resolution\npolymarket ctf redeem --condition 0xCONDITION...\n\n# Redeem neg-risk positions\npolymarket ctf redeem-neg-risk --condition 0xCONDITION... --amounts \"10,5\"\n\n# Calculate IDs (read-only, no wallet needed)\npolymarket ctf condition-id --oracle 0xORACLE... --question 0xQUESTION... --outcomes 2\npolymarket ctf collection-id --condition 0xCONDITION... --index-set 1\npolymarket ctf position-id --collection 0xCOLLECTION...\n```\n\n`--amount` is in pUSD (e.g., `10` = $10). The `--partition` flag defaults to binary (`1,2`). On-chain operations require MATIC for gas on Polygon.\n\n### Bridge\n\nDeposit assets from other chains into Polymarket.\n\n```bash\n# Get deposit addresses (EVM, Solana, Bitcoin)\npolymarket bridge deposit 0xWALLET_ADDRESS\n\n# List supported chains and tokens\npolymarket bridge supported-assets\n\n# Check deposit status\npolymarket bridge status 0xDEPOSIT_ADDRESS\n```\n\n### Wallet Management\n\n```bash\npolymarket wallet create               # Generate new random wallet\npolymarket wallet create --force       # Overwrite existing\npolymarket wallet import 0xKEY...      # Import existing key\npolymarket wallet address              # Print wallet address\npolymarket wallet show                 # Full wallet info (address, source, config path)\npolymarket wallet reset                # Delete config (prompts for confirmation)\npolymarket wallet reset --force        # Delete without confirmation\n```\n\n### Interactive Shell\n\n```bash\npolymarket shell\n# polymarket> markets list --limit 3\n# polymarket> clob book 48331043336612883...\n# polymarket> exit\n```\n\nSupports command history. All commands work the same as the CLI, just without the `polymarket` prefix.\n\n### Other\n\n```bash\npolymarket status     # API health check\npolymarket setup      # Guided first-time setup wizard\npolymarket upgrade    # Update to the latest version\npolymarket --version\npolymarket --help\n```\n\n## Common Workflows\n\n### Browse and research markets\n\n```bash\npolymarket markets search \"bitcoin\" --limit 5\npolymarket markets get bitcoin-above-100k\npolymarket clob book 48331043336612883...\npolymarket clob price-history 48331043336612883... --interval 1d\n```\n\n### Set up a new wallet and start trading\n\n```bash\npolymarket wallet create\npolymarket approve set                    # needs MATIC for gas\npolymarket clob balance --asset-type collateral\npolymarket clob market-order --token TOKEN_ID --side buy --amount 5\n```\n\n### Monitor your portfolio\n\n```bash\npolymarket data positions 0xYOUR_ADDRESS\npolymarket data value 0xYOUR_ADDRESS\npolymarket clob orders\npolymarket clob trades\n```\n\n### Place and manage limit orders\n\n```bash\n# Place order\npolymarket clob create-order --token TOKEN_ID --side buy --price 0.45 --size 20\n\n# Check it\npolymarket clob orders\n\n# Cancel if needed\npolymarket clob cancel ORDER_ID\n\n# Or cancel everything\npolymarket clob cancel-all\n```\n\n### Script with JSON output\n\n```bash\n# Pipe market data to jq\npolymarket -o json markets list --limit 100 | jq '.[].question'\n\n# Check prices programmatically\npolymarket -o json clob midpoint TOKEN_ID | jq '.mid'\n\n# Error handling in scripts\nif ! result=$(polymarket -o json clob balance --asset-type collateral 2>\u002Fdev\u002Fnull); then\n  echo \"Failed to fetch balance\"\nfi\n```\n\n## Architecture\n\n```\nsrc\u002F\n  main.rs        -- CLI entry point, clap parsing, error handling\n  auth.rs        -- Wallet resolution, RPC provider, CLOB authentication\n  config.rs      -- Config file (~\u002F.config\u002Fpolymarket\u002Fconfig.json)\n  shell.rs       -- Interactive REPL\n  commands\u002F      -- One module per command group\n  output\u002F        -- Table and JSON rendering per command group\n```\n\n## License\n\nMIT\n","Polymarket CLI 是一个用 Rust 编写的命令行工具，用于浏览市场、下单交易、管理仓位以及与链上合约交互。它支持从终端直接操作或通过 JSON API 供脚本和代理使用。项目提供了多种安装方式，包括 Homebrew、Shell 脚本和源码编译，并且能够以表格或 JSON 格式输出数据。用户可以无需钱包立即开始浏览市场信息，但进行交易等操作时需要设置钱包并提供私钥。此工具适用于希望在 Polymarket 平台上快速便捷地执行交易活动的开发者或交易者，尤其是在需要自动化脚本处理的情况下。请注意，这是一个早期实验性软件，在使用时需谨慎对待。",2,"2026-06-01 03:57:09","CREATED_QUERY"]