A production-ready automated trading system for Polymarket's 5-minute BTC/ETH/SOL Up/Down markets. Features realistic simulation mode, SNIPE strategy (late-window entries), arbitrage detection, and ML ensemble predictions.
┌─────────────────────────────────────────────────────────────────┐
│ VPS (Docker) │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Data │ │ Strategy │ │ Simulation │ │
│ │ Feeds │──▶│ Engine │──▶│ Engine │ │
│ │ │ │ │ │ │ │
│ │ - CLOB WS │ │ - SNIPE │ │ - Realistic fills │ │
│ │ - Binance WS │ │ - ARB │ │ - Slippage/fees/gas │ │
│ │ - Gamma API │ │ - ML Filter │ │ - PnL tracking │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ ML Ensemble Predictor │ │
│ │ LightGBM + Kronos-mini (AAAI'26) + LLM Sentiment │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Dashboard / API (Port 8080) │ │
│ │ - Real-time PnL, positions, trades │ │
│ │ - WebSocket live updates │ │
│ │ - Prometheus metrics (Port 9090) │ │
│ └──────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
https://polygon-rpc.com)# Clone and deploy
git clone <your-repo-url> bitgrab
cd bitgrab
chmod +x deploy.sh
./deploy.sh
The deploy script will:
.env from template (prompts for required values)# 1. Install Docker
curl -fsSL https://get.docker.com | sh
apt-get install -y docker-compose-plugin
# 2. Configure
cp .env.example .env
# Edit .env with your values
# 3. Deploy
docker compose up -d --build
# 4. Verify
docker compose logs -f bitgrab
Edit .env with your settings:
# Required
POLYGON_RPC_URL=https://polygon-rpc.com
# Simulation (paper trading)
SIMULATION_MODE=true
SIMULATION_INITIAL_BANKROLL=1000
SIMULATION_POSITION_SIZE_USDC=25
SIMULATION_MAX_DAILY_LOSS_USDC=100
SIMULATION_MAX_DAILY_VOLUME_USDC=2000
SIMULATION_LOSS_STREAK_PAUSE=3
# SNIPE Strategy
SNIPE_MIN_PRICE=0.93
SNIPE_MAX_PRICE=0.995
SNIPE_ENTRY_START_SECS=60
SNIPE_ENTRY_END_SECS=1
SNIPE_HEDGE_RATIO=0.30
SNIPE_REACTIVE_HEDGE_ENABLED=true
SNIPE_REACTIVE_HEDGE_TRIGGER_BPS=800
SNIPE_ARB_ENABLED=true
SNIPE_ARB_THRESHOLD_BPS=150
# ML
ML_ENABLED=true
ML_MODEL_PATH=./models/snipe_model.onnx
ML_CONFIDENCE_THRESHOLD=0.55
ML_KELLY_FRACTION=0.5
# Optional: LLM Sentiment (OpenRouter free tier)
OPENROUTER_API_KEY=
# Dashboard
DASHBOARD_PORT=8080
| Service | URL | Description |
|---|---|---|
| Dashboard | http://<VPS_IP>:8080 | Real-time PnL, positions, trades |
| Metrics | http://<VPS_IP>:9090 | Prometheus metrics |
| Health | http://<VPS_IP>:8080/api/status | JSON bot status |
Only go live after:
Then:
SIMULATION_MODE=false in .envPOLYGON_PRIVATE_KEY=0x...
POLYMARKET_FUNDER_ADDRESS=0x...
POLYMARKET_SIGNATURE_TYPE=2
POLYMARKET_API_KEY=...
POLYMARKET_API_SECRET=...
POLYMARKET_API_PASSPHRASE=...
$2 position size (Phase 1)bitgrab/
├── deploy.sh # One-command deployment
├── docker-compose.yml # Bot + Redis + Prometheus
├── Dockerfile # Main bot container
├── Dockerfile.dashboard # Dashboard container
├── prometheus.yml # Metrics config
├── .env.example # Config template
├── README.md
├── pyproject.toml
├── requirements.txt
└── src/
├── __init__.py
├── config.py # Pydantic settings
├── models.py # Data models
├── data_feeds.py # CLOB WS, Binance WS, Gamma API
├── simulation.py # Realistic sim engine
├── strategies.py # SNIPE, ARB, RiskManager
├── ml_models.py # LightGBM + Kronos + LLM
├── features.py # 30+ technical indicators
├── dashboard.py # aiohttp + WebSocket UI
├── main.py # Main orchestrator
└── bot.py # Legacy entry
# View logs
docker compose logs -f bitgrab
# Check status
docker compose ps
# Restart
docker compose restart bitgrab
# Update
git pull && docker compose up -d --build
bitgrab_bankroll_usdc - Current bankrollbitgrab_total_pnl_usdc - Cumulative P&Lbitgrab_daily_pnl_usdc - Today's P&Lbitgrab_win_rate - Winning trade %bitgrab_open_positions - Active positionsbitgrab_cycles_total - Trading cycles completedEducational/research software. Prediction markets involve substantial financial risk. Past performance ≠ future results. Test thoroughly in simulation before any live capital. Not financial advice.
MIT
2 commits
Python
66.7%
HTML
28.6%
Shell
4.1%
A production-ready automated trading system for Polymarket's 5-minute BTC/ETH/SOL Up/Down markets. Features realistic simulation mode, SNIPE strategy (late-window entries), arbitrage detection, and ML ensemble predictions.
┌─────────────────────────────────────────────────────────────────┐
│ VPS (Docker) │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Data │ │ Strategy │ │ Simulation │ │
│ │ Feeds │──▶│ Engine │──▶│ Engine │ │
│ │ │ │ │ │ │ │
│ │ - CLOB WS │ │ - SNIPE │ │ - Realistic fills │ │
│ │ - Binance WS │ │ - ARB │ │ - Slippage/fees/gas │ │
│ │ - Gamma API │ │ - ML Filter │ │ - PnL tracking │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ ML Ensemble Predictor │ │
│ │ LightGBM + Kronos-mini (AAAI'26) + LLM Sentiment │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Dashboard / API (Port 8080) │ │
│ │ - Real-time PnL, positions, trades │ │
│ │ - WebSocket live updates │ │
│ │ - Prometheus metrics (Port 9090) │ │
│ └──────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
https://polygon-rpc.com)# Clone and deploy
git clone <your-repo-url> bitgrab
cd bitgrab
chmod +x deploy.sh
./deploy.sh
The deploy script will:
.env from template (prompts for required values)# 1. Install Docker
curl -fsSL https://get.docker.com | sh
apt-get install -y docker-compose-plugin
# 2. Configure
cp .env.example .env
# Edit .env with your values
# 3. Deploy
docker compose up -d --build
# 4. Verify
docker compose logs -f bitgrab
Edit .env with your settings:
# Required
POLYGON_RPC_URL=https://polygon-rpc.com
# Simulation (paper trading)
SIMULATION_MODE=true
SIMULATION_INITIAL_BANKROLL=1000
SIMULATION_POSITION_SIZE_USDC=25
SIMULATION_MAX_DAILY_LOSS_USDC=100
SIMULATION_MAX_DAILY_VOLUME_USDC=2000
SIMULATION_LOSS_STREAK_PAUSE=3
# SNIPE Strategy
SNIPE_MIN_PRICE=0.93
SNIPE_MAX_PRICE=0.995
SNIPE_ENTRY_START_SECS=60
SNIPE_ENTRY_END_SECS=1
SNIPE_HEDGE_RATIO=0.30
SNIPE_REACTIVE_HEDGE_ENABLED=true
SNIPE_REACTIVE_HEDGE_TRIGGER_BPS=800
SNIPE_ARB_ENABLED=true
SNIPE_ARB_THRESHOLD_BPS=150
# ML
ML_ENABLED=true
ML_MODEL_PATH=./models/snipe_model.onnx
ML_CONFIDENCE_THRESHOLD=0.55
ML_KELLY_FRACTION=0.5
# Optional: LLM Sentiment (OpenRouter free tier)
OPENROUTER_API_KEY=
# Dashboard
DASHBOARD_PORT=8080
| Service | URL | Description |
|---|---|---|
| Dashboard | http://<VPS_IP>:8080 | Real-time PnL, positions, trades |
| Metrics | http://<VPS_IP>:9090 | Prometheus metrics |
| Health | http://<VPS_IP>:8080/api/status | JSON bot status |
Only go live after:
Then:
SIMULATION_MODE=false in .envPOLYGON_PRIVATE_KEY=0x...
POLYMARKET_FUNDER_ADDRESS=0x...
POLYMARKET_SIGNATURE_TYPE=2
POLYMARKET_API_KEY=...
POLYMARKET_API_SECRET=...
POLYMARKET_API_PASSPHRASE=...
$2 position size (Phase 1)bitgrab/
├── deploy.sh # One-command deployment
├── docker-compose.yml # Bot + Redis + Prometheus
├── Dockerfile # Main bot container
├── Dockerfile.dashboard # Dashboard container
├── prometheus.yml # Metrics config
├── .env.example # Config template
├── README.md
├── pyproject.toml
├── requirements.txt
└── src/
├── __init__.py
├── config.py # Pydantic settings
├── models.py # Data models
├── data_feeds.py # CLOB WS, Binance WS, Gamma API
├── simulation.py # Realistic sim engine
├── strategies.py # SNIPE, ARB, RiskManager
├── ml_models.py # LightGBM + Kronos + LLM
├── features.py # 30+ technical indicators
├── dashboard.py # aiohttp + WebSocket UI
├── main.py # Main orchestrator
└── bot.py # Legacy entry
# View logs
docker compose logs -f bitgrab
# Check status
docker compose ps
# Restart
docker compose restart bitgrab
# Update
git pull && docker compose up -d --build
bitgrab_bankroll_usdc - Current bankrollbitgrab_total_pnl_usdc - Cumulative P&Lbitgrab_daily_pnl_usdc - Today's P&Lbitgrab_win_rate - Winning trade %bitgrab_open_positions - Active positionsbitgrab_cycles_total - Trading cycles completedEducational/research software. Prediction markets involve substantial financial risk. Past performance ≠ future results. Test thoroughly in simulation before any live capital. Not financial advice.
MIT
2 commits
Python
66.7%
HTML
28.6%
Shell
4.1%