Skip to content

Emil-Ka/polymarket-longshot-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polymarket Longshot Bot 🎯

Automated prediction market bot that scans Polymarket for low-probability, high-payout opportunities and places small bets on them automatically.

⚠️ This is a legitimate open-source trading bot. It is NOT a scam, does NOT ask for your seed phrase or wallet connect, and does NOT drain your wallet. All trades go through the official Polymarket CLOB API.


What It Does

  • 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

Strategy rationale

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.


Requirements

  • Python 3.9+
  • A Polymarket account with USDC on Polygon
  • Your wallet's private key

Quick Start

# 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 live

Configuration

All 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

Wallet Setup

Using MetaMask / Hardware wallet (EOA)

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.

Using email / Magic wallet

Set SIGNATURE_TYPE=1 and fill in FUNDER with your Polymarket address. Allowances are set automatically.


Risk Warning

  • 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=true and small BET_SIZE values.

How It Works

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

License

MIT — free to use, modify, and distribute.

About

Automated Polymarket bot that bets on low-probability, high-payout outcomes. Longshot trading strategy using the official py-clob-client. Python, Polygon, USDC.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages