Autonomous Polymarket Trading Bot
Disclaimer: This is an educational/portfolio project demonstrating algorithmic trading concepts. Use at your own risk. Past performance does not guarantee future results.
VEXOR is an intelligent trading system for Polymarket prediction markets that combines mathematical arbitrage detection, real-time news analysis, whale tracking, and market resolution monitoring to identify and execute profitable trades.
- DRY_RUN Mode: Safe simulation mode for testing strategies without real money
- Risk Management: Configurable max bet size, daily loss limits, and position limits
- Market Expiry Protection: Automatic check to avoid trading expired/resolved markets
- 60-Second Trading Cycle: Continuous monitoring and signal generation
- Instant Dashboard: Server-side caching for <50ms API response times
- Multi-Outcome Arbitrage: Detects when market prices don't sum to 100%
- Overbought (>100%): SELL overpriced outcomes
- Oversold (<100%): BUY underpriced outcomes
- Mean Reversion: Trades against 30%+ price movements in 24h
- Mathematical Edge: Profits from market inefficiencies, not predictions
- Risk/Reward: Guaranteed profit when mispricing corrects
- High-Probability Trades: Targets markets with 95%+ certain outcomes
- 60-Day Window: Only trades markets expiring within 60 days
- Profit Threshold: Minimum $30 potential profit per trade
- Smart Execution: Sells YES when price >=95c, buys NO when YES <=5c
- 9 Live News Sources:
- Wire Services: Reuters, AP News (highest reliability)
- Crypto News: CoinDesk, CoinTelegraph, TheBlock, Decrypt, CryptoPanic
- Mainstream: Yahoo Finance, ESPN, Politico
- Aggregators: Google News (14 topic queries)
- Social: Reddit (r/polymarket, r/cryptocurrency)
- Platform: Polymarket official blog
- Breaking News Detection: Real-time identification with 2x confidence boost
- Smart Deduplication: URL + fuzzy title matching (Levenshtein distance)
- Source Reliability Weighting: 0.5 (Reddit) to 1.0 (Reuters/AP)
- Instant Loading: Server-side caching with background refresh
- Real-time Metrics: P&L, positions, trade history
- Interactive UI: Click on positions, trades, news sources for details
- News Monitor: Live feed from all 9 sources with breaking news badges
- Resolution Stats: Win rate, total P&L, recent resolutions
- Dark/Light Theme: Toggle between themes
- Trade Alerts: Every trade execution with market details
- Resolution Notifications: Win/loss with P&L on market resolution
- Breaking News Alerts: High-confidence breaking news matching positions
- Daily Summaries: Performance overview and upcoming expirations
+-------------------------------------------------------------------+
| VEXOR BOT v1.2 |
+-------------------------------------------------------------------+
| |
| +------------------+ +------------------+ +------------------+ |
| | News Sources | | Polymarket | | Telegram | |
| | (9 feeds) | | API | | Bot | |
| +--------+---------+ +--------+---------+ +--------+---------+ |
| | | | |
| v v v |
| +--------------------------------------------------------+ |
| | Signal Generation | |
| | - Arbitrage Hunter (40%) - Mathematical edge | |
| | - Resolution Sniper (40%) - High probability | |
| | - Whale Tracker (15%) - Copy top wallets | |
| | - News Analyzer (5%) - Sentiment signals | |
| +------------------------+-------------------------------+ |
| | |
| v |
| +--------------------------------------------------------+ |
| | Trading Engine | |
| | - Risk management checks | |
| | - Market expiry validation | |
| | - Order execution (or DRY_RUN simulation) | |
| +------------------------+-------------------------------+ |
| | |
| v |
| +--------------------------------------------------------+ |
| | SQLite Database | |
| | - trades, markets_cache, news_cache | |
| +--------------------------------------------------------+ |
| |
| +--------------------------------------------------------+ |
| | Dashboard API (Express :3005) | |
| | - Server-side caching (<50ms response) | |
| | - Background refresh (30-60s intervals) | |
| +--------------------------------------------------------+ |
+-------------------------------------------------------------------+
- Node.js 18+
- npm
# Clone repository
git clone https://github.com/pieronoviello/vexor.git
cd vexor
# Install dependencies
npm install
# Configure environment
cp config/.env.example config/.env
# Edit config/.env with your credentials
# Start the bot
npm run devEdit config/.env:
# Mode
DRY_RUN=true # Set to false for live trading
# Risk Management
MAX_BET_SIZE=100 # Max bet in dollars
MAX_DAILY_LOSS=500 # Stop trading after this loss
MAX_OPEN_POSITIONS=100 # Maximum concurrent positions
MAX_POSITION_PER_MARKET=200 # Max exposure per market
# Polymarket API (required for live trading)
POLYMARKET_API_KEY=your_key
POLYMARKET_API_SECRET=your_secret
# Telegram (optional)
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_idAll endpoints respond in <50ms thanks to server-side caching.
| Endpoint | Method | Description | Caching |
|---|---|---|---|
/api/status |
GET | Bot status, config, stats | 60s |
/api/positions |
GET | All open positions with live prices | 30s |
/api/trades |
GET | Recent trades | None |
/api/performance |
GET | P&L metrics | None |
/api/news |
GET | News feed with source stats | On fetch |
/api/resolutions |
GET | Resolution history | None |
/api/resolutions/stats |
GET | Win rate, total P&L | None |
/api/expirations |
GET | Upcoming expirations | 60s |
const SIGNAL_WEIGHTS = {
arbitrage: 0.40, // Mathematical edge - highest priority
resolution: 0.40, // High probability outcomes
whale: 0.15, // Copy successful traders
news: 0.05, // Sentiment-based signals
};Finds mathematical inefficiencies in market pricing:
- Multi-outcome arbitrage: When prices don't sum to 100%
- Mean reversion: When prices move too fast (>30% in 24h)
Trades markets near resolution with near-certain outcomes (>=95% probability).
npm run dev # Start with ts-node (development)
npm run build # Compile TypeScript
npm start # Run compiled JS (production)npx tsc --noEmit- Money: Always use cents (integers) to avoid float errors
- Timestamps: ISO 8601 format
- Logging: Structured JSON with logger utility
- Error handling: Try/catch with exponential backoff retry
- API calls: 3 retries with 1s/2s/4s delays
- Dashboard caching optimization (<50ms response times)
- Progressive frontend loading
- Background cache refresh
- Arbitrage Hunter strategy
- Multi-outcome arbitrage detection
- Mean reversion signals
- Updated signal weights
- Initial release
- Resolution Sniper strategy
- News aggregation (9 sources)
- Telegram integration
- Interactive dashboard
Building VEXOR taught me valuable lessons about:
- Market Efficiency: Professional market makers arbitrage away most inefficiencies within milliseconds
- Real-time Systems: Building reliable systems that handle live data streams and API rate limits
- Risk Management: Implementing safeguards like DRY_RUN mode, position limits, and daily loss caps
- TypeScript Best Practices: Strict typing, async/await patterns, and error handling
- API Design: RESTful endpoints with caching for performance optimization
- Security: Protecting credentials, input validation, and security headers
MIT License - See LICENSE for details.
Piero Noviello - GitHub