Auto-trading bot that predicts BTC price direction (up/down) in 5-minute windows on Polymarket, with a Next.js dashboard and Telegram notifications.
- Two prediction strategies: Technical indicators (RSI, MACD, Bollinger Bands) + ML (Gradient Boosting)
- Live trading on Polymarket CLOB with configurable risk per trade
- Backtesting over any historical date range with equity curve and performance metrics
- Next.js dashboard: start/stop bot, view trades, run backtests, configure settings
- Telegram notifications on every trade open/close and backtest completion
cp .env.example .env
# Edit .env with your credentials:
# - Polymarket API key + private key (from polymarket.com)
# - Telegram bot token + chat IDdocker compose up --build- Dashboard: http://localhost:3000
- Backend API: http://localhost:8000/docs
Open http://localhost:3000/settings and click Train ML Model, or via API:
curl -X POST "http://localhost:8000/api/predictor/train?days=30"Go to the dashboard, select a strategy, and click Start Bot.
polytrip/
├── backend/
│ ├── main.py # FastAPI REST API
│ ├── trader.py # Live trading loop (APScheduler, every 5 min)
│ ├── backtester.py # Historical simulation engine
│ ├── predictor.py # TechIndicator + ML + Ensemble predictors
│ ├── polymarket_client.py # py-clob-client wrapper
│ ├── data_fetcher.py # Binance 1-min OHLCV (no auth needed)
│ ├── telegram_notifier.py # Trade + backtest Telegram alerts
│ ├── database.py # SQLAlchemy + SQLite
│ └── models.py # Trade, BacktestRun, BotConfig models
└── frontend/
├── app/page.tsx # Dashboard
├── app/backtest/page.tsx # Backtest control + results
└── app/settings/page.tsx # API keys, risk, strategy
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/status |
Bot status, open position, PnL |
| POST | /api/bot/start |
Start live trading |
| POST | /api/bot/stop |
Stop live trading |
| POST | /api/backtest |
Run a backtest |
| GET | /api/backtests |
List all backtest runs |
| GET | /api/backtests/{id} |
Backtest detail with equity curve |
| GET | /api/trades |
Trade history |
| GET | /api/config |
Current config |
| PUT | /api/config |
Update config |
| POST | /api/predictor/train |
Train ML model |
- Go to polymarket.com and connect a wallet
- Go to Profile → API Keys → Create API Key
- Your private key is your wallet's private key (keep safe!)
- Message @BotFather →
/newbot→ get your bot token - Message @userinfobot → get your chat ID
⚠️ Risk Warning: Crypto trading involves significant risk. Use only funds you can afford to lose. This software is provided for educational purposes.