Skip to content

hu553in/polybot

Repository files navigation

Polybot

CI

Polymarket BTC/ETH 5-minute Up/Down trading bot with Chainlink-aligned pricing, executable CLOB quotes, paper/live modes, SQLite history, risk limits, and Telegram notifications.

⚠️ Financial warning

This bot does not guarantee profit. It can lose money, including all allocated capital. Do not trade live with money you cannot afford to lose.

What it does

  • Finds BTC and ETH 5-minute Up/Down markets on Polymarket
  • Uses Chainlink RTDS for settlement-line and current-price context
  • Uses Binance candles, volume, funding, and BTC/ETH correlation as supporting signals
  • Quotes executable entry price from CLOB order books
  • Applies confidence, edge, timing, liquidity, spread, quote freshness, and risk gates
  • Supports paper mode by default and live mode only when explicitly configured
  • Stores snapshots, decisions, trades, settlements, and health state in SQLite
  • Sends Telegram notifications for entries, failures, settlements, summaries, and wallet checks

Requirements

  • Python 3.13+
  • uv
  • Network access to Polymarket, Binance, Chainlink RTDS, and Polygon RPC
  • Optional: Telegram bot token and chat ID for notifications
  • Live mode only: Polymarket private key, funder wallet, pUSD balance, and allowances

Setup

make install-deps
cp .env.example .env

Edit .env, then use show-config and doctor before live mode. With no mode set, run starts in paper mode.

Configuration

All runtime settings use the POLYBOT_ prefix and are loaded from .env.

Area Main settings
Mode POLYBOT_PAPER, POLYBOT_LIVE, POLYBOT_ONCE, POLYBOT_DEBUG
Sizing POLYBOT_AMOUNT, POLYBOT_POSITION_*, POLYBOT_BANKROLL
Risk POLYBOT_MAX_TRADES*, POLYBOT_MAX_DAILY_*, POLYBOT_MAX_DRAWDOWN_PCT
Entry POLYBOT_MIN_CONFIDENCE, POLYBOT_MIN_EDGE, POLYBOT_ENTRY_*
Execution POLYBOT_MAX_SPREAD, POLYBOT_CLOB_*, POLYBOT_LIVE_*
Storage POLYBOT_STORAGE_*
Telegram POLYBOT_TELEGRAM_*
Endpoints POLYBOT_GAMMA_API_URL, POLYBOT_CLOB_API_URL, POLYBOT_POLYGON_RPC_URL

Use this to inspect parsed values with secrets masked:

uv run polybot show-config

Modes

Behavior paper live
Default when no mode is set yes no
Calls real CLOB execution no yes
Stores trades and decisions yes yes
Entry price quote VWAP taker limit
Requires POLYBOT_LIVE_PRIVATE_KEY + POLYBOT_LIVE_WALLET no yes

Run uv run polybot doctor before switching to live mode.

Usage

uv run polybot run
uv run polybot doctor
uv run polybot healthcheck
uv run polybot export

Docker image:

docker run --rm --env-file .env -v "$(pwd)/data:/app/data" ghcr.io/hu553in/polybot

The image runs polybot run by default. Pass another subcommand after the image name, for example doctor or healthcheck.

Trade export is read-only and never applies migrations:

uv run polybot export --output-file exports/polybot-trades.csv
uv run polybot export --since 2026-05-08T00:00:00Z
uv run polybot export --current-run
uv run polybot export --format summary

Strategy summary

  • Direction is based on current price versus the 5-minute window open
  • Very small moves are skipped before probability and edge math
  • Probability is heuristic and can be calibrated from settled SQLite history
  • Entry uses executable CLOB VWAP, not Gamma display prices
  • Late weak signals, stale price sources, stale quotes, bad spread, low depth, and risk limits block entry
  • Live mode repeats the edge check against the actual order price before submitting

Runtime behavior

  • POLYBOT_STORAGE_DATA_DIR stores SQLite data, migrations, and the heartbeat file
  • healthcheck reads local heartbeat state only; it does not call third-party APIs
  • doctor checks external APIs, storage, live credentials, CLOB balance/allowance, and Telegram
  • Telegram receives event notifications, not per-tick debug logs
  • Settlement prefers Polymarket's official result and retries pending settlements when data is not available at close
  • Ctrl-C requests a graceful stop and exits with code 130 after the current cycle

Development

make install-deps
make check

Focused checks:

make lint
make check-types
make test

Releases

No releases published

Packages

 
 
 

Contributors

Languages