Polymarket Bot | Polymarket Trading Bot | Polymarket Trading Bot - 5 min market | Polymarket Arbitrage Bot
Polymarket Bot, Polymarket Trading Bot, Polymarket 5min market Trading Bot, Polymarket Automatic Trading Bot
A high-performance, automated trading system for Polymarket prediction markets. Built in Python with real-time WebSocket streaming, gasless L2 execution, and a risk-management framework suited to short-term and high-frequency environments.
| Channel | Link |
|---|---|
| benjamin.bigdev@gmail.com | |
| Telegram | @BenjaminCup |
| X (Twitter) | @benjaminccup |
Polymarket Endcycle Sniper Bot is an automated trading system designed to monitor short-duration prediction markets and execute high-probability trades near the end of each 5-minute epoch. It connects to the orderbook in real time, triggers buys when prices exceed a configured threshold (e.g., 0.95), manages risk with optional exits or hedging, and redeems winning positions automatically after market resolution. ππ

Benjamin-Cup-Polymarket-Trading-Bot-github.mp4
You can also test the bot directly on Telegram.
polymarket-trading-bot-Telegram.mp4
https://t.me/benjamin_polymarket_trading_bot
An open-source bot that automatically copies trades from top Polymarket traders to your walletβso you can follow proven strategies 24/7 without watching the market yourself.
Whether you're new to prediction markets or you want to scale your copy-trading across multiple wallets, this bot is built to be simple to run, transparent, and under your control.
polymarket-copy-trading-bot.mp4
This Polymarket trading bot explores an automated volatility and probability arbitrage bot designed to identify pricing inefficiencies in prediction markets. Instead of predicting outcomes, the system exploits mispriced probabilities, market imbalances, and short-term volatility using quantitative models and automation. By combining high-frequency execution with strong risk management and hedging, the bot aims to capture small statistical edges and compound them over large trade volumes. π
This bot does not speculate on market direction.
Instead, it captures spread by selling both YES and NO outcome tokens at prices whose combined value exceeds $1.
The strategy focuses on market making, not directional trading.

Polymarket-ladder-trading-bot-video.mp4
- Signal + Execution Pipeline: Combines real-time orderbook + spot prices vs strike β generates UP/DOWN signals β executes optionally.
- Buy-Above Strategy: Enter momentum trades when an outcome is expensive (
YES > threshold) with risk exit and optional hedge. - Buy-Opposite Strategy: Contrarian trades when one side spikes (
> threshold) β buys the other outcome. - Multi-Asset Support: Run BTC, ETH, SOL, XRP simultaneously.
- Configurable & Extensible: YAML + environment variable overrides (
POLYBOT5M_*). - Redeem Automation: Auto redeem positions after resolution using Builder relayer (gasless).
Generates UP/DOWN signals every 5 minutes using:
- Market Discovery: Finds active 5-minute slug (e.g.,
btc-updown-5m-{epoch_ts}) β fetchescondition_id& asset IDs via Gamma API. - Orderbook Capture: Uses CLOB WebSocket β stores in memory for analysis.
- Price History: Rolling midpoint (bid+ask)/2 over tracking window (default 60s).
- Reference Price: Real-time spot from Coinbase or Binance; optional strike price scrape.
- Signal Engine: Compares first-half vs second-half midpoint averages β predicts UP or DOWN.
- Optional Execution: Market or limit buy at best ask per asset if credentials and
execution.enabled.
Flow Diagram (simplified):
Market Discovery β CLOB Orderbook β Price History β Spot vs Strike β Signal Engine β Execute
- Trigger: When
best_ask > threshold(e.g., 0.95) β market buy YES. - Risk Management: Optional stop-loss (
sell_on_drop) and hedge (hedge_on_risk). - Redeem: Auto redeem after resolution with
redeem_delay_seconds. - Multi-Cycle: Supports multiple assets and epochs in parallel.
- Trigger: When one outcome spikes above threshold (e.g., >0.98), buy the other outcome.
- Use Case: Profits from mean reversion when price spikes are temporary.
- Multi-Cycle: Repeat for multiple assets and epochs.
polymarket-trading-bot-5m-v4/
βββ config/
β βββ default.yaml # All configs: bot, api, markets, entry, risk, execution, buy_above, buy_opposite
βββ src/polybot5m/
β βββ cli.py # Main run
β βββ entry/engine.py # Signal computation
β βββ data/ # APIs, WS, orderbook, price_diff, scrape
β βββ execution/ # CLOB client, executor, redeem
βββ scripts/
β βββ run_5m_core.py # Buy-above
β βββ test_buy_opposite_098.py # Buy-opposite
β βββ run_until_resolution.py # Full cycle
β βββ step01-12_*.py # Step-by-step tests
βββ exports/ # Logs & activity JSONL
| Section | Purpose |
|---|---|
| bot | dry_run, log_level |
| api | Gamma & CLOB URLs |
| markets | Enabled assets & intervals |
| entry | Signal sampling, tracking window, confidence threshold |
| risk | Stop-loss %, max positions |
| execution | API keys, private key, order type, buy/sell style |
| buy_above | Threshold, amount, cycles, risk, hedge |
| buy_opposite | Threshold, amount, offset, cycles |
| reference_price | Coinbase/Binance, optional strike scrape |
β‘ Tip: Override any config with
POLYBOT5M_*environment variables.
- Main Run: Predicts 5-minute market outcomes better than average β executes trades.
- Buy-Above: Exploits momentum when YES price is high; profits if outcome wins more often than implied by price.
- Buy-Opposite: Profits from mean-reversion on price spikes.
β οΈ Risk Note: All strategies are directional speculation. Losses can occur if prediction is wrong or price slips.
-
Setup:
python -m venv .venv source .venv/bin/activate pip install -e .
Optional: Playwright for strike scraping.
-
Verify Config: Run step scripts (
step01_config.py,step02_slug.py) without network keys. -
Dry-Run Main Pipeline:
.venv/bin/polybot5m run --dry-run .venv/bin/python scripts/run_until_resolution.py --cycles 1
-
Dry-Run Strategy Scripts:
.venv/bin/python scripts/run_5m_core.py --dry-run --cycles 1 .venv/bin/python scripts/test_buy_opposite_098.py --dry-run --cycles 1
-
Add Credentials:
.envfile with CLOB & Builder keys for execution/redeem. -
First Live Run: Start with
dry_run=False, small amount, one cycle β verify signals and execution.
π Quick Reference Table: Install β signals β dry-run strategies β add credentials β first live run.
# Main pipeline
.venv/bin/polybot5m run
.venv/bin/polybot5m -c config/default.yaml run
# Buy-above strategy
.venv/bin/python scripts/run_5m_core.py --dry-run --cycles 1
# Buy-opposite strategy
.venv/bin/python scripts/test_buy_opposite_098.py --dry-run --cycles 5
# Full cycle until resolution
.venv/bin/python scripts/run_until_resolution.pyEnsure API keys and private key are set for execution; redeem uses Builder relayer keys.
| Aspect | polymarket-trading-bot-5m-v4 |
|---|---|
| Role | Signal + execution bot for 5m crypto UP/DOWN markets |
| Main Run | Orderbook + spot vs strike β UP/DOWN signal β optional execution |
| Strategies | Buy-above (momentum + risk exit), Buy-opposite (contrarian) |
| Markets | BTC, ETH, SOL, XRP (configurable) |
| Data Sources | Gamma, CLOB WS, Coinbase/Binance WS, optional strike scrape |
| Config | YAML + POLYBOT5M_* env overrides |
| Beginner Path | Clone β setup β dry-run β try strategies β add keys β first live run |
- Real copy trading β Mirrors every trade from the proxy wallets you choose (buy, sell, merge).
- Your keys, your rules β Runs on your machine with your wallet; no custody, no middleman.
- Flexible sizing β Copy by percentage of the traderβs order, or a fixed USD amount per trade.
- Multi-wallet β Run one executor and copy into several follower wallets at once.
- Monitor + Executor β Run a monitor (sleuth) to watch traders and fill the DB, and a separate executor to place orders (great for scaling or separating concerns).
- PnL at a glance β Check copy-trading performance with
npm run check-copy-pnl. - Preview mode β Dry-run: see what would be traded without sending real orders.
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
β Trade Monitor ββββββΆβ MongoDB βββββββ Trade Executor β
β (sleuth) β β (pending trades)β β (places orders) β
β β’ Polls API β β β β β’ Validates β
β β’ Saves trades β β β β β’ Copy % or $ β
ββββββββββββββββββββ ββββββββββββββββββββ β β’ Multi-wallet β
β β ββββββββββ¬ββββββββββ
β β β
βΌ βΌ βΌ
Polymarket API Your config Polymarket CLOB
(activity, positions) (COPY_STRATEGY, etc.) (orders)
- Monitor fetches target tradersβ activity and positions, deduplicates, and stores new trades.
- Executor reads pending trades, applies your copy strategy (percentage or fixed size), validates balance/positions, and posts orders for each follower wallet.
- You can run monitor and executor together (
npm run dev) or separately (npm run monitor+npm run executor).
- Copy-trading PnL β Run
npm run check-copy-pnlto see value, initial cost, unrealized/realized PnL, and position count for your follower wallet(s). Data comes from the Polymarket positions API. - Logs β The bot logs trades, balance checks, and errors; use your normal process (e.g.
logs/directory, PM2, Docker logs) to monitor.
- Private keys β Stored only in your
.env; never committed. Use a dedicated wallet with limited funds. - Preview mode β Use
PREVIEW_MODE=trueto test without sending orders. - Limits β
MAX_ORDER_SIZE_USD,MIN_ORDER_SIZE_USD, and optionalMAX_POSITION_SIZE_USD/MAX_DAILY_VOLUME_USDhelp cap risk.
4. Polymarket Arbitrage (Ladder Trading) Bot (5m / 15m / 1h / 4h / 1d crypto Up/Down markets) (Explain)
Polymarket trading bot is designed to provide automated liquidity in Polymarket prediction markets.
When a market is created on Polymarket:
-
YES token = pays $1 if event happens
-
NO token = pays $1 if event does not happen
Converts USDC.e into YES + NO tokens
Sells both tokens
Ensures the sum of prices β₯ target spread
Example:
| Token | Sell Price |
|---|---|
| YES | 0.54 |
| NO | 0.49 |
Total received:
0.54 + 0.49 = 1.03
Cost to create pair:
1.00
Profit before fees:
1.03 - 1.00 = 0.03 per pair
Typical range:
Total received β 1.03 β 1.10
After the market resolves:
- One token becomes $1
- The other becomes $0
The bot redeems the winning token.
The bot runs a state machine cycle:
IDLE
β
SPLIT
β
PAIR_SELL
β
MONITOR
β
REDEEM
β
IDLE
| Phase | Description |
|---|---|
| SPLIT | Convert USDC.e into YES and NO tokens |
| PAIR_SELL | Sell YES and NO tokens in sequential pairs |
| MONITOR | Wait for market resolution |
| REDEEM | Redeem winning tokens for USDC.e |
The bot sells tokens in pairs rather than all at once.
|
### For every pair:
1. Fetch orderbook 2. Read best bid prices 3. Compute optimal sell prices 4. Place YES and NO limit orders 5. Wait until both fill 6. Retry if timeout occurs |
|
Sell prices are calculated using:
yes_price = best_bid_yes + spread
no_price = best_bid_no + spread
Then the bot enforces:
yes_price + no_price β₯ min_pair_sum
Example configuration:
best_bid_yes = 0.49
best_bid_no = 0.50
spread = 0.01
Calculated:
yes_price = 0.50
no_price = 0.51
sum = 1.01
If min_pair_sum = 1.03, the bot increases both prices proportionally.
| Markets | Cycles per hour | Hourly Profit |
|---|---|---|
| 1 market (5m) | 12 | ~$36 |
| 2 markets | 12 | ~$72 |
| 4 markets | 12 | ~$144 |
polymarket-trading-ladder-bot
β
βββ config
β βββ default.yaml
β βββ paper.yaml
β
βββ src/polybot5m
β
β βββ cli.py
β βββ config.py
β βββ constants.py
β βββ engine.py
β
β βββ data
β β βββ gamma.py
β β βββ slug_builder.py
β
β βββ execution
β βββ clob_client.py
β βββ executor.py
β βββ split.py
β βββ redeem.py
β
βββ exports
βββ liquidity_maker_activity.json
Main configuration file:
config/default.yaml
Example:
liquidity_maker:
portfolio_allocation_usdc: 100
pair_size: 5
min_pair_sum: 1.03
price_follow_spread: 0.01
pair_sell_timeout_seconds: 300
order_check_interval_seconds: 5
redeem_delay_seconds: 10
stagger_delay_seconds: 2| Parameter | Description |
|---|---|
| portfolio_allocation_usdc | USDC used per market cycle |
| pair_size | Shares per YES/NO pair |
| min_pair_sum | Minimum combined sell price |
| price_follow_spread | Price offset above best bid |
| pair_sell_timeout_seconds | Cancel orders if not filled |
| order_check_interval_seconds | Poll order status |
Designed for short-term Polymarket crypto markets:
| Asset | 5m | 15m | 1h | 4h | 1d |
|---|---|---|---|---|---|
| BTC | β | β | β | β | β |
| ETH | β | β | β | β | β |
| SOL | β | β | β | β | β |
| XRP | β | β | β | β | β |
Slug format:
{symbol}-updown-{interval}-{epoch_timestamp}
Example:
btc-updown-5m-1709916600
Uses real orderbook data but no real trades.
polybot5m -c config/paper.yaml run
or
polybot5m run --dry-run
Example:
polybot5m run --cycles 1 --allocation 10
Meaning:
- run one cycle
- allocate $10 per market
polybot5m run \
--allocation 500 \
--cycles 5
Required for live trading.
PRIVATE_KEY=
FUNDER=
API_KEY=
API_SECRET=
API_PASSPHRASE=
Optional builder relayer keys:
BUILDER_API_KEY_1=
BUILDER_API_SECRET_1=
BUILDER_API_PASSPHRASE_1=
Multiple keys can be used to avoid rate limits.
Trading activity is exported to:
exports/liquidity_maker_activity.json
Example record:
{
"market": "btc-updown-5m",
"action": "pair_sell",
"yes_price": 0.52,
"no_price": 0.51,
"size": 5,
"timestamp": 1709916600
}| Feature | Description |
|---|---|
| Strategy | Liquidity market making |
| Profit source | Spread capture |
| Market type | Polymarket 5m / 15m / 1h / 4h / 1d crypto |
| Language | Python / Rust |
| APIs | Gamma API + CLOB API |
| Execution | Builder Relayer |

