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 |
Benjamin-Cup-Polymarket-Trading-Bot-github.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 |
With polymarket-trading-bot-5m-v4, you get a full 5-minute crypto bot: signal generation, automated execution, risk management, and redeemβready to start small and scale confidently.
If you want, I can also make a visual diagram for the workflow (main pipeline + strategies + redeem) to add at the top of README. This usually helps new traders immediately grasp the bot logic.
Do you want me to create that diagram next?