Skip to content

Latest commit

 

History

75 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VEXOR

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.


Features

Core Trading Engine

  • 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

Arbitrage Hunter Strategy (Primary)

  • 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

Resolution Sniper Strategy

  • 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

News Intelligence System

  • 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)

Dashboard (Port 3005)

  • 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

Telegram Integration

  • 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

Architecture

+-------------------------------------------------------------------+
|                         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)               |      |
|  +--------------------------------------------------------+      |
+-------------------------------------------------------------------+

Installation

Prerequisites

  • Node.js 18+
  • npm

Setup

# 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 dev

Configuration

Edit 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_id

API Endpoints

All 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

Trading Strategies

Signal Weights

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
};

Arbitrage Hunter

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)

Resolution Sniper

Trades markets near resolution with near-certain outcomes (>=95% probability).


Development

Scripts

npm run dev      # Start with ts-node (development)
npm run build    # Compile TypeScript
npm start        # Run compiled JS (production)

Type Checking

npx tsc --noEmit

Project Conventions

  • 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

Changelog

v1.2.0 (2026-02-04)

  • Dashboard caching optimization (<50ms response times)
  • Progressive frontend loading
  • Background cache refresh

v1.1.0 (2026-02-03)

  • Arbitrage Hunter strategy
  • Multi-outcome arbitrage detection
  • Mean reversion signals
  • Updated signal weights

v1.0.0 (2026-01-28)

  • Initial release
  • Resolution Sniper strategy
  • News aggregation (9 sources)
  • Telegram integration
  • Interactive dashboard

What I Learned

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

License

MIT License - See LICENSE for details.


Author

Piero Noviello - GitHub

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages