Complete guide to placing orders on Polymarket with clawearn. Fully functional with automatic USDC approval, dynamic gas pricing, market discovery, price data, automated order execution, deposits, withdrawals, token redemption, and comprehensive troubleshooting.
Trade prediction markets directly from your OpenClaw bot using Clawearn.
| File | Description |
|---|---|
| SKILL.md (this file) | Main skill documentation and API reference |
Install locally:
mkdir -p ~/.clawearn/skills/polymarket-trading
curl -s https://clawearn.xyz/skills/polymarket/SKILL.md > ~/.clawearn/skills/polymarket/SKILL.md
curl -s https://clawearn.xyz/skills/polymarket/HEAERBEAT.md > ~/.clawearn/skills/polymarket/HEARTBETA.md
Or read them directly from the URLs above!
๐ CRITICAL SECURITY WARNING:
clawearn polymarket --help
Create a new account:
clawearn polymarket account create --email [email protected] --password yourpassword
Export private key:
clawearn polymarket account export-key --email [email protected] --password yourpassword
โ ๏ธ Save your private key immediately! Store it securely in:
~/.config/clawearn/credentials.jsonPOLYMARKET_PRIVATE_KEYRecommended credential storage:
{
"private_key": "0x...",
"email": "[email protected]",
"signature_type": 0,
"wallet_address": "0x..."
}
Request pocket money (for testing/dev):
clawearn polymarket balance pocket-money --amount 100
Check balance:
clawearn polymarket balance check --private-key $YOUR_PRIVATE_KEY
Deposit via CLI:
clawearn polymarket deposit --amount 100
The tool will automatically fetch your unique deposit address from Polymarket and send funds from your Arbitrum wallet.
Options:
--usdce: Use this flag if you are sending bridged USDC.e instead of native USDC.Withdraw USDC.e directly (automatic):
clawearn polymarket withdraw --amount 0.1
This automatically creates a deposit address and sends your USDC.e to it. No manual transfer needed!
Withdraw to a different address:
clawearn polymarket withdraw --amount 0.1 --recipient-address 0x...
Manual withdrawal (just get the address):
clawearn polymarket withdraw
Creates a deposit address for manual transfer if you prefer to send funds yourself.
How it works (with --amount):
Options:
--amount <amount>: Amount of USDC.e to withdraw (optional, triggers automatic send)--recipient-address <addr>: Destination wallet on Arbitrum (defaults to your clawearn wallet)--address <addr>: Override the source Polymarket wallet address (defaults to stored wallet)Estimate refuel cost:
clawearn polymarket refuel estimate --amount 0.5
Execute refuel:
clawearn polymarket refuel refuel --amount 0.5
Refuel to a specific recipient:
clawearn polymarket refuel refuel --amount 1 --recipient 0x...
What is refuel?
0x222228060e7efbb1d78bb5d454581910e3922222Options:
--amount <amount>: Amount of POL to refuel (required)--recipient <address>: Recipient address on Polygon (defaults to your wallet address)--private-key <key>: Private key (optional, uses stored wallet if not provided)After a market resolves, you can redeem winning conditional tokens for USDC collateral.
Redeem winning tokens:
clawearn polymarket redeem \
--condition-id 0x1234567890abcdef... \
--index-sets 1
Redeem multiple outcomes:
clawearn polymarket redeem \
--condition-id 0x1234567890abcdef... \
--index-sets 1,2
What is redemption?
redeem command burns your tokens and releases the collateral to your walletParameters:
--condition-id <id>: The condition ID (bytes32 format, starts with 0x and is 66 characters)--index-sets <sets>: Index sets representing winning outcomes (comma-separated integers)
1 (YES), 2 (NO), or 3 (both, for partial fills)How to find condition ID:
Minimum withdrawal: 2 USDC (enforced for deposits/withdrawals)
Search markets by keyword:
clawearn polymarket market search --query "bitcoin price 2025"
Get active markets by category:
clawearn polymarket market list --tag politics --limit 10
Get market details:
clawearn polymarket market info --market-id MARKET_ID
Get current market price:
clawearn polymarket price get --token-id TOKEN_ID --side buy
View order book depth:
clawearn polymarket price book --token-id TOKEN_ID
Place a buy order:
clawearn polymarket order buy \
--token-id TOKEN_ID \
--price 0.50 \
--size 10
Place a sell order:
clawearn polymarket order sell \
--token-id TOKEN_ID \
--price 0.75 \
--size 5
View open orders:
clawearn polymarket order list-open
Cancel an order:
clawearn polymarket order cancel \
--order-id ORDER_ID
The clawearn CLI automatically uses your stored wallet for all orders. No need to pass --private-key or --signature-type โ they're handled internally.
How it works:
~/.config/clawearn/wallet.jsonOrder Requirements:
--token-id: The numeric token ID (from market info output)--price: Price per share (0.00 to 1.00, usually 0.001 minimum)--size: Number of shares to buy/sellCreating Orders Workflow:
# 1. Search for a market
clawearn polymarket market search --query "bitcoin"
# 2. Get market details (shows token IDs)
clawearn polymarket market info --market-id 194107
# 3. Check current price
clawearn polymarket price get --token-id NUMERIC_TOKEN_ID --side buy
# 4. Place order (uses your stored wallet automatically)
clawearn polymarket order buy \
--token-id NUMERIC_TOKEN_ID \
--price 0.40 \
--size 1
# 5. Verify it was placed
clawearn polymarket order list-open
Automatic USDC Approval:
When you place your first order, clawearn automatically:
This approval is a one-time transaction. Subsequent orders won't need approval since the contract has unlimited permission.
Gas Fees for Approval:
Troubleshooting Order Placement:
clawearn wallet create firstThe tool supports three signature types:
| Type | Use Case | Funder |
|---|---|---|
0 (EOA) | Standalone wallet. You pay gas fees. | Your wallet address |
1 (POLY_PROXY) | Polymarket.com account (email/Google). | Your proxy wallet address |
2 (GNOSIS_SAFE) | Polymarket.com account (wallet connection). | Your proxy wallet address |
Determine your signature type and funder address before placing orders.
The tool uses these Polymarket APIs:
https://gamma-api.polymarket.com) - Market discovery, metadatahttps://clob.polymarket.com) - Prices, order books, tradinghttps://data-api.polymarket.com) - User positions, trade historyAll requests are handled via the internal client โ you just use CLI commands.
Error: "No wallet found!"
Solution: Create a wallet first
$ clawearn wallet create
Error: "Could not derive API credentials"
Your wallet isn't registered on Polymarket yet.
Solution:
1. Visit https://polymarket.com
2. Connect your wallet address (0x...)
3. Complete registration
4. Try placing order again
Error: "Cloudflare protection detected" (403 Forbidden)
Your IP address is being rate-limited by Polymarket's security.
Solutions (in order):
1. Wait 30 seconds and retry
2. Try from a different network
3. Use a VPN to change your IP
4. Use the web interface: https://polymarket.com
Error: "Insufficient balance"
Your wallet doesn't have enough USDC on Polygon.
Solution:
1. Check balance: clawearn polymarket balance check
2. If low, transfer USDC to Polygon
3. Or deposit via Arbitrum: clawearn polymarket deposit --amount 100
Error: "Invalid token ID"
The token ID you provided doesn't exist or market expired.
Solution:
1. Get fresh market info: clawearn polymarket market info --market-id <id>
2. Copy the exact token ID from the output
3. Try order again
Error: "Order failed (negRisk)"
Multi-outcome events require special negRisk handling.
Current workaround: Use polymarket.com web interface for these markets
Error: Geographic restrictions apply
โ Polymarket is not available in your jurisdiction
Error: Insufficient balance
โ Request pocket money or deposit funds
Error: Invalid token ID
โ Market may have expired or token ID was incorrect
Error: Order failed (negRisk)
โ Multi-outcome event requires negRisk flag handling
What is Polymarket?
Example:
Market: "Will Bitcoin hit $100k by end of 2025?"
Current Price: $0.65 (65% chance)
You buy 10 YES shares at $0.65 = cost $6.50
Event resolves YES โ You get $10.00
Profit: $3.50 (54% return)
# Search for events you understand
clawearn polymarket market search --query "bitcoin price"
# Results show:
# - Bitcoin above ___ on February 3? (ID: 190531)
# - What price will Bitcoin hit in February? (ID: 194107)
What to look for:
# Get full market info (need market ID from search)
clawearn polymarket market info --market-id 190531
# You'll see:
# - Market description
# - Current outcome details
# - Token IDs for YES/NO
# - Resolution criteria
Key info to check:
# Get the current price (buying/selling)
clawearn polymarket price get --token-id 0x... --side buy
# Check order book
clawearn polymarket price book --token-id 0x...
Price interpretation:
Price: 0.45 = Market says 45% chance
Price: 0.70 = Market says 70% chance
Price: 0.95 = Market says 95% chance (very confident)
Spread matters:
BUY: 0.50, SELL: 0.48 = Normal (2ยข spread = liquid)
BUY: 0.50, SELL: 0.40 = Bad (10ยข spread = avoid)
Before you buy, ask yourself:
Example: Small test trade
# Buy 10 shares at current market price
clawearn polymarket order buy \
--token-id 0x3f2431d0471e2ecbb8833b4ef34c25f9ba1701e6 \
--price 0.50 \
--size 10
Result:
Check your open orders:
clawearn polymarket order list-open
If you want to exit early:
# Sell your shares to lock in gains/losses
clawearn polymarket order sell \
--token-id 0x3f2431d0471e2ecbb8833b4ef34c25f9ba1701e6 \
--price 0.55 \
--size 10
If you think you were wrong:
# Exit and take small loss rather than bigger loss
clawearn polymarket order sell \
--token-id 0x3f2431d0471e2ecbb8833b4ef34c25f9ba1701e6 \
--price 0.45 \
--size 10
You're very sure about outcome
- Price: 0.35 (market disagrees)
- Position: 50-100 shares
- Timeline: Long hold until resolution
Same event on different markets
- Polymarket: 0.50 (YES)
- Kalshi: 0.55 (YES)
- Spread: 5%
- Strategy: Buy low, sell high
Major news changes probability
- Before: 0.30 (low chance)
- After announcement: 0.70
- Speed matters for news trades!
Trade the bounces
- Buy when sentiment drops
- Sell when sentiment rises
- Timeline: Days to weeks
Scenario: You think Bitcoin will hit $50k
# Step 1: Find market
clawearn polymarket market search --query "Bitcoin 50k"
# Step 2: Get details
clawearn polymarket market info --market-id 190531
# Step 3: Check price
clawearn polymarket price get --token-id 0x...
# Step 4: Your decision
# Market says 55% chance (price 0.55)
# You think 75% chance
# Price is too low โ BUY
# Step 5: Place order (small test: $50)
clawearn polymarket order buy \
--token-id 0x... \
--price 0.55 \
--size 91 # About 91 shares for ~$50
# Step 6: Monitor
clawearn polymarket order list-open
# Step 7: Outcome
# If Bitcoin hits $50k:
# - Your 91 shares worth $91.00
# - Profit: $41 (82% return!)
#
# If Bitcoin doesn't:
# - Your 91 shares worth $0
# - Loss: $50 (be prepared!)
Emotions to manage:
โ FOMO - "Everyone's buying, I should too!"
โ Loss Aversion - "I'll hold and hope it recovers"
โ Overconfidence - "I'm 100% sure this will happen"
โ Good habits:
Complete step-by-step order placement:
# 1. Search for a market by keyword
clawearn polymarket market search --query "Biden approval rating"
# 2. Get market details (this shows token IDs for each outcome)
clawearn polymarket market info --market-id 194107
# Output will show:
# Market 1: "Will Biden approval hit 50%?"
# YES Token ID: 1234567890...
# NO Token ID: 9876543210...
# 3. Check current price for the YES outcome
clawearn polymarket price get \
--token-id 1234567890... \
--side buy
# Output: {"price": "0.42"}
# 4. Optional: Check order book depth to see liquidity
clawearn polymarket price book --token-id 1234567890...
# 5. Place a BUY order (start small!)
clawearn polymarket order buy \
--token-id 1234567890... \
--price 0.42 \
--size 20
# Output: โ Order placed successfully! Order ID: xyz123
# 6. Monitor your position
clawearn polymarket order list-open
# 7. Exit if needed (sell to realize P&L)
clawearn polymarket order sell \
--token-id 1234567890... \
--price 0.55 \
--size 20
Real Example: Bitcoin Market
# 1. Find bitcoin markets
$ clawearn polymarket market search --query "bitcoin 150000"
# Search results for "bitcoin 150000":
# Events:
# - Will Bitcoin reach $150,000 in February? (ID: 194107)
# 2. Get all prediction markets in this event
$ clawearn polymarket market info --market-id 194107
# Output shows 23 different price targets:
# 1. Will Bitcoin reach $150,000 in February?
# YES Token ID: 37297213992198847758335843642137412014662841314020423585709724457305615671955
# NO Token ID: 85285091029101061598102453878417748165438482105623263900746828987387745601127
#
# 2. Will Bitcoin reach $120,000 in February?
# YES Token ID: 101634930257850341602969673615351678146180846411766214423237977523476147979287
# NO Token ID: 54686656666443885986573295372690758310199066081424255164816980635327619857547
# 3. Check current price of Bitcoin hitting $150k
$ clawearn polymarket price get \
--token-id 37297213992198847758335843642137412014662841314020423585709724457305615671955 \
--side buy
# Output: {"price": "0.003"}
# This means market thinks ~0.3% chance of Bitcoin hitting $150k in Feb
# 4. You think it's higher probability, so you BUY at 0.35
$ clawearn polymarket order buy \
--token-id 37297213992198847758335843642137412014662841314020423585709724457305615671955 \
--price 0.35 \
--size 5
# Output:
# โน Using default tick size 0.001 (will be validated by API)
# Placing BUY order: 5 shares @ $0.35
# Creating initial client...
# Deriving API credentials...
# โ API credentials obtained
# Initializing authenticated client...
# โ Order placed successfully!
# Order ID: abc123xyz
# Status: 0
# 5. Verify your order was placed
$ clawearn polymarket order list-open
# Output:
# Found 1 open orders:
# [{
# "orderID": "abc123xyz",
# "tokenID": "37297213992...",
# "price": 0.35,
# "size": 5,
# "side": "BUY",
# "status": "OPEN"
# }]
# 6. If Bitcoin hits $150k, your 5 shares worth $5
# If it doesn't, you lose $1.75 (5 ร 0.35)
# Risk/Reward: -$1.75 to +$3.25
# 1. Create wallet
clawearn wallet create
# 2. Fund wallet with USDC on Arbitrum
clawearn wallet send --to YOUR_ADDRESS --amount 100
# 3. Check balance
clawearn polymarket balance check
# 4. Start with test trades (5-10% of capital)
# See "How to Play" section above for step-by-step
Quick withdrawal (automatic):
# 1. Withdraw 0.1 USDC.e automatically
clawearn polymarket withdraw --amount 0.1
# Output:
# Creating withdrawal address for Arbitrum...
# โ
Withdrawal address created successfully!
# ๐ค Sending USDC to withdrawal address...
# โ
Transfer successful!
# โณ Funds will be bridged to Arbitrum within 10-30 minutes
# 2. Wait for bridge confirmation (~10-30 minutes)
# 3. Check your Arbitrum wallet balance
# USDC.e should arrive automatically
Manual withdrawal (if you prefer):
# 1. Create withdrawal address
clawearn polymarket withdraw
# 2. From Polymarket UI, send USDC.e to the generated address
# 3. Wait for bridge confirmation (~10-30 minutes)
# 4. Check your Arbitrum wallet
# 1. Check how much refuel will cost
clawearn polymarket refuel estimate --amount 0.5
# 2. Review the ETH fee in the output
# Example: Native Fee: 0.01 ETH, Total Cost: 0.01 ETH
# 3. Execute refuel (send 0.5 POL to Polygon)
clawearn polymarket refuel refuel --amount 0.5
# 4. Wait for confirmation and check your Polygon wallet balance
# The POL will arrive within minutes via L2Pass
# 5. Optional: Refuel to a different address
clawearn polymarket refuel refuel --amount 1 --recipient 0x...
# 1. Wait for your market to resolve on Polymarket
# You can check the status on: https://polymarket.com
# 2. Once resolved, you need the condition ID
# Find it from the Polymarket dashboard or from your order history
# Example condition ID: 0x1234567890abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef
# 3. Determine the winning outcome index sets
# For binary markets (YES/NO):
# - Index set 1 = YES outcome
# - Index set 2 = NO outcome
# - Index set 3 = Both (for partial fills)
# 4. Redeem your winning tokens
clawearn polymarket redeem \
--condition-id 0x1234567890abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef \
--index-sets 1
# 5. Confirm the transaction
# Output shows:
# โ Transaction sent!
# Hash: 0xabc123...
# Waiting for confirmation...
# โ
Redemption successful!
# Your USDC collateral has been released
# 6. Check your balance - your USDC is now claimable
clawearn polymarket balance check
# Install clawearn CLI globally
cd /path/to/clawearn
bun link
# Now you can use:
clawearn polymarket --help
Official Polymarket Documentation:
Check for updates: Re-fetch this skill file anytime to see new features!
Be mindful of API rate limits:
If you hit rate limits, implement exponential backoff in your agent's logic.
refuel estimate before executing refuel transactionsEach outcome in a market has a unique numeric token ID:
Market: "Will Bitcoin hit $50k in February?"
โโ YES outcome โ Token ID: 123456789...
โโ NO outcome โ Token ID: 987654321...
Get token IDs:
clawearn polymarket market info --market-id EVENT_ID
The output shows all markets in an event with their token IDs.
Example:
Current price: 0.42
You buy 10 shares: 10 ร $0.42 = $4.20 spent
If it resolves YES: 10 ร $1.00 = $10.00 received
Profit: $5.80 (138% return)
If it resolves NO: $0.00
Loss: $4.20
1. CREATE โ Order constructed locally with your wallet
2. SIGN โ Order signed with your private key
3. SUBMIT โ Sent to Polymarket CLOB API
4. ACCEPT โ Placed in order book
5. FILL โ Matched with counterparty
6. SETTLE โ Funds transferred after market resolves
The CLI handles steps 1-5. Step 6 happens automatically.
Position Sizing:
Price Limits:
# Conservative: Buy at 0.30 (not 0.50 ask)
clawearn polymarket order buy --token-id ... --price 0.30 --size 10
# Moderate: Buy at market (0.50)
clawearn polymarket order buy --token-id ... --price 0.50 --size 10
# Aggressive: Buy immediately (0.60 ask)
# Usually fills quickly but higher slippage
Exit Strategy:
# Take profits: Sell when doubling
clawearn polymarket order sell --token-id ... --price 0.80 --size 5
# Cut losses: Sell at 50% loss
clawearn polymarket order sell --token-id ... --price 0.25 --size 10
For issues or questions: