Automated trading system for Polymarket BTC 5-minute prediction markets — real-time data collection, strategy engine, backtesting, and web dashboard.
🎯 Polymarket BTC 5M Auto-Trading System
Automated trading system for Polymarket BTC 5-minute prediction markets
Features
- 📊 Real-time Data Collection — WebSocket-based BTC price and market data streaming
- 🤖 Automated Trading — Strategy engine with configurable entry/exit rules
- 📈 Backtesting — Historical performance analysis with detailed metrics
- 🖥️ Web Dashboard — Real-time monitoring and control interface
- 🔒 Risk Management — Position sizing, stop-loss, and exposure limits
Screenshots
Trading Control
Real-time market monitoring with strategy configuration, entry signals, and trade execution controls.
Market Data
Market list with historical results, price gap analysis, and interactive market replay charts.
Data Analysis
Performance analytics with equity curve, daily P&L, win rate trends, and trade volume breakdown.
Architecture
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Collector │────▶│ Trader │────▶│ CLOB API │
│ (WebSocket) │ │ (Strategy) │ │ (Polymarket)│
└─────────────┘ └──────┬──────┘ └─────────────┘
│
┌──────▼──────┐
│ WebUI │
│ (Dashboard) │
└─────────────┘
Components
| Module | Description | |--------|-------------| | btc5m-collector/ | Real-time data collection (BTC price, market events, orderbook) | | btc5m-trader/ | Trading strategy engine with live/sim modes | | btc5m-webui/ | Web-based monitoring dashboard | | docs/ | Architecture documentation and analysis reports | | windows/ | Windows-specific deployment scripts | | runtime/ | Runtime configuration and state management |
Quick Start
Prerequisites
- Python 3.11+
- Node.js 18+ (for WebUI)
- Polymarket API key
Installation
# Clone the repository
git clone https://github.com/yyq7903/auto-trading.git
cd auto-trading
Install Python dependencies
pip install -r requirements.txt
Copy and configure environment
cp btc5m-trader/.env.example btc5m-trader/.env
Edit .env with your API keys
Start the collector
python btc5m-collector/collect.py
Start the trader (simulation mode first!)
python btc5m-trader/sim/trader.py
Start the WebUI (optional)
cd btc5m-webui && npm install && npm run dev
Configuration
Edit btc5m-trader/config.json:
{
"entry_threshold": 0.75,
"min_gap": 10,
"max_position": 100,
"riskpertrade": 0.02
}
Strategy
The system trades Polymarket's BTC 5-minute prediction markets based on:
- Price Gap Analysis — Measures deviation from Chainlink oracle price
- Timing Window — Enters between T-25s and T-5s before settlement
- Direction Logic — Up if gap ≥ 0, Down if gap < 0
- Risk Checks — Validates balance, position size, and exposure limits
Performance
Backtesting results on historical data:
| Metric | Value | |--------|-------| | Markets Analyzed | 133 | | Signal Accuracy | 55-65% | | Avg Trade Duration | ~5 min | | Risk per Trade | 2% of bankroll |
Tech Stack
- Python — Core trading logic and data collection
- WebSocket — Real-time market data streaming
- Polymarket CLOB API — Order execution
- Chainlink Oracle — Price reference
- React/Vite — Web dashboard
Contributing
Contributions welcome! Please read the contributing guidelines first.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Disclaimer
⚠️ This is experimental software for educational purposes.
- Trading involves risk of loss
- Past performance does not guarantee future results
- Use at your own risk
- Never trade with money you cannot afford to lose
License
MIT License — see LICENSE for details.
Built with ❤️ for the Polymarket community