Set Up Your First Polymarket Trading Agent
A complete walkthrough — from zero to an autonomous bot placing real trades on Polymarket. No coding experience required. Average setup time: 45 minutes.
What This Agent Does
PM-01 is an autonomous scanner that monitors Polymarket 24/7, finds markets where the price implies a probability significantly different from what a scoring model calculates, and places limit orders automatically when it finds edge of 15% or more.
Here's what happens after you set it up:
-
1
Every 5 minutes
The scanner fetches all active Polymarket markets and scores each one using 5 signals: liquidity, volume, time to close, price range, and market type.
-
2
When edge ≥ 15%
A limit order is placed at the current best price. Take-profit is set at 88¢. Stop-loss is set at 4¢. No manual action required.
-
3
Telegram alert
Your phone gets a notification within 60 seconds of any trade entry, exit, or notable event. You can watch without touching anything.
-
4
CLV tracking
Every closed trade logs your entry price vs. the closing line. Over time, this tells you whether your edge is real or luck.
What You Need Before Starting
Hardware
A Mac running macOS 12 or later. This guide uses macOS LaunchAgents for 24/7 background operation — the cleanest way to run persistent processes on a Mac.
A Mac Mini ($599 new) is the ideal setup — runs silently, uses ~6W of power, never needs to sleep. A MacBook works if you keep it plugged in.
Software
- Python 3.10 or later — check with python3 --version in Terminal
- pip3 — comes with Python, check with pip3 --version
- Terminal access — built into macOS (Applications → Utilities → Terminal)
Accounts You Need
- Polymarket account — polymarket.com (takes 5 min, need a crypto wallet)
- MetaMask or any Polygon-compatible wallet — to fund USDC
- Telegram account — for alerts (free)
Setting Up Your Polymarket Account
Step 1 — Create your account
Go to polymarket.com and connect a wallet. MetaMask is easiest. If you don't have MetaMask, install it from metamask.io and create a new wallet — takes 2 minutes.
Step 2 — Fund with USDC
Polymarket runs on Polygon network. You need USDC on Polygon (not Ethereum mainnet — gas fees would be too high).
Easiest path: Buy USDC on Coinbase → send to your wallet address on Polygon network. Or use Polymarket's built-in on-ramp (credit card → USDC, slightly higher fees).
Step 3 — Generate your CLOB API keys
The agent needs API keys to place orders programmatically. Here's how to get them:
-
1
Go to app.polymarket.com
Log in with the same wallet you funded.
-
2
Click your profile → Settings → API
Or navigate directly to app.polymarket.com/profile/settings
-
3
Create new API key
You'll get three values: API Key, Secret, and Passphrase. Copy all three somewhere safe — you can't retrieve the secret again after closing the window.
-
4
Copy your wallet private key
In MetaMask: three dots → Account Details → Export Private Key. This is needed for the CLOB signature. Keep it safe — never share it.
Install & Configure
Unzip and open Terminal
After downloading PM-01 from your purchase email, unzip it to wherever you want it to live (Desktop is fine). Then open Terminal and navigate there:
cd ~/Desktop/pm-01-beat-the-closing-line
Run the setup wizard
This does everything — installs packages, walks you through all the config, writes your .env file, and runs a connection test.
python3 setup.py
The wizard will ask for:
- Your Polymarket API Key, Secret, and Passphrase (from Chapter 03)
- Your wallet private key (starts with 0x)
- Your wallet address (starts with 0x)
- Your Telegram bot token and chat ID (see below)
- Your trading preferences (edge threshold, max position size)
Setting up Telegram alerts
You'll need a Telegram bot to receive alerts on your phone.
-
1
Message @BotFather on Telegram
Send /newbot and follow the prompts. You'll get a token like 1234567890:ABCdef...
-
2
Get your chat ID
Message @userinfobot on Telegram. It replies with your user ID (a number like 1559282754). That's your chat ID.
-
3
Message your new bot once
Find your bot by its username, send it any message. This activates the chat so it can message you.
Test Your Connection
The setup wizard runs this automatically, but you can run it manually anytime to check everything is still working:
python3 src/test_connection.py
You should see:
✓ Polymarket public API reachable
✓ CLOB API key valid
✓ Telegram message sent — check your phone!
✓ POLYMARKET_API_KEY is set
✓ POLYMARKET_PRIVATE_KEY is set
All checks passed. Ready to scan for edges.
Dry Run — Watch It Work First
Before going live, run in dry-run mode. The agent scans exactly the same as live mode but doesn't place any orders. You see every edge it finds, every market it evaluates.
python3 src/pm_monitor.py --dry-run
In the terminal you'll see logs like:
[CYCLE 1] 09:14:03
Fetching active markets...
Fetched 187 markets
Scoring markets...
[DRY RUN] EDGE FOUND
Market: Will the Fed cut rates in March 2026?
Price: 0.38 | Model: 0.57 | Edge: 19%
Size: $35 | Side: YES
→ Order would be placed (dry run — skipped)
No more edges this cycle. Next scan in 5 min.
Go Live
Once you've watched a dry run cycle or two and you're comfortable, drop the --dry-run flag:
python3 src/pm_monitor.py
The first time it finds an edge that meets the threshold, it places a real order and sends you a Telegram alert:
⚡ EDGE FOUND [LIVE]
Market: Will X happen?
Entry: 0.36 | Model: 0.54 | Edge: 18%
Size: $35 | Side: YES
Order ID: 0x3b2c1d...
Take-profit: 0.88 | Stop-loss: 0.04
CLV target: +12¢
Monitoring your positions
You don't need to watch the terminal. Telegram handles all the important updates:
- Trade entered — price, size, edge %
- Take-profit triggered — exit at 88¢
- Stop-loss triggered — exit at 4¢
- Market resolved — outcome + CLV
- Scanner errors — if something breaks
Install the 24/7 Daemon
Running python3 src/pm_monitor.py in a Terminal window works, but stops if the window closes or the Mac restarts. To run 24/7 automatically, install the LaunchAgent:
./scripts/setup_launchd.sh
This installs a macOS LaunchAgent that:
- Starts automatically when your Mac boots
- Restarts automatically if it crashes
- Logs everything to /tmp/pm_monitor.log
- Runs with zero UI — silent background process
Useful commands
# Watch live logs
tail -f /tmp/pm_monitor.log
# Stop the agent
launchctl unload ~/Library/LaunchAgents/com.agentcheat.pm_monitor.plist
# Restart the agent
launchctl unload ~/Library/LaunchAgents/com.agentcheat.pm_monitor.plist
launchctl load ~/Library/LaunchAgents/com.agentcheat.pm_monitor.plist
PM-02 runs alongside PM-01 and finds guaranteed profit opportunities between Polymarket and Kalshi. Different edge, zero correlation.