Automated prediction market bot that scans Polymarket for low-probability, high-payout opportunities and places small bets on them automatically.
- Continuously scans all active Polymarket prediction markets via the official Gamma API
- Filters outcomes priced at or below a configurable threshold (default: ≤ 5¢, i.e. ≤ 5% probability)
- Skips illiquid markets to ensure orders can actually fill
- Places fixed-size market orders (FOK) using the official
py-clob-client - Logs every bet to
trades.log - Dry-run mode by default — simulates bets without spending real money
A 5¢ outcome pays out $1 per share if it resolves YES — that's a 20× return. By spreading many small bets ($1 each) across dozens of low-probability markets, a single correct prediction can cover many losses. Think of it as diversified high-odds trading.
- Python 3.9+
- A Polymarket account with USDC on Polygon
- Your wallet's private key
# 1. Clone the repo
git clone https://github.com/Emil-Ka/polymarket-longshot-bot.git
cd polymarket-longshot-bot
# 2. Install dependencies
pip install -r requirements.txt
# 3. Configure environment
cp .env.example .env
# Edit .env with your private key and settings
# 4. Run in dry-run mode first (no real money spent)
python bot.py
# 5. When ready, set DRY_RUN=false in .env to go liveAll settings live in .env (copy from .env.example):
| Variable | Default | Description |
|---|---|---|
PRIVATE_KEY |
— | Your wallet private key (required) |
FUNDER |
— | Funder address (required for email/Magic wallets) |
SIGNATURE_TYPE |
0 |
0 = EOA, 1 = Magic/email, 2 = browser proxy |
MAX_PRICE |
0.05 |
Max outcome price to consider (0.05 = 5%) |
BET_SIZE |
1.0 |
USDC per bet |
MIN_LIQUIDITY |
500 |
Minimum market liquidity in USDC |
SCAN_INTERVAL |
300 |
Seconds between market scans |
DRY_RUN |
true |
true = log only, false = place real orders |
Set SIGNATURE_TYPE=0. Before trading, you must approve token allowances once:
USDC token: 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
Conditional tokens: 0x4D97DCd97eC945f40cF65F87097ACe5EA0476045
Approve all three exchange contracts:
0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E
0xC5d563A36AE78145C45a50134d48A1215220f80a
0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296
See the official allowance guide for details.
Set SIGNATURE_TYPE=1 and fill in FUNDER with your Polymarket address. Allowances are set automatically.
- Prediction markets are speculative. Most longshot bets will lose.
- Never bet more than you can afford to lose.
- This software is provided as-is with no guarantees of profit.
- Always start with
DRY_RUN=trueand smallBET_SIZEvalues.
1. Fetch all active markets ← Gamma API (gamma-api.polymarket.com)
2. Filter: price <= MAX_PRICE AND liquidity >= MIN_LIQUIDITY
3. Sort by highest implied payout (1 / price)
4. For each opportunity not yet bet this session:
→ Create FOK market order via py-clob-client
→ POST to CLOB API
→ Log result
5. Sleep SCAN_INTERVAL seconds → repeat
MIT — free to use, modify, and distribute.