A terminal-based trading bot for Polymarket's BTC 15-minute prediction markets using the "Gabagool" strategy - a delta-neutral hedging approach that aims to profit regardless of market outcome.
The Gabagool strategy exploits price inefficiencies in binary prediction markets:
- Entry: When market is skewed (one side cheaper than the other), buy the cheap side
- Hedge: Buy the opposite side to create a delta-neutral position
- Profit: If
avg_YES + avg_NO < $1.00, you profit regardless of outcome (since winning side pays $1.00)
Buy 50 YES @ $0.45 = $22.50
Buy 50 NO @ $0.52 = $26.00
Total cost: $48.50
Outcome (either way): 50 shares x $1.00 = $50.00
Profit: $1.50 (guaranteed)
As market close approaches, the bot accepts higher pair costs:
- Normal (>10 min): max pair cost 0.995 (small profit)
- Eager (5-10 min): max pair cost 1.005 (tiny loss acceptable)
- Urgent (2-5 min): max pair cost 1.01 (1% loss acceptable)
- Emergency (<2 min): max pair cost 1.02 (2% loss to close position)
- Real-time price streaming via WebSocket
- Terminal UI (TUI) with live prices, positions, and P&L
- Paper trading mode for testing
- Risk management (exposure limits, position limits)
- Automatic market discovery for BTC 15-minute markets
# Clone the repository
git clone <repo-url>
cd hexatrade
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtCopy the example environment file and configure:
cp .env.example .envEdit .env with your credentials (only needed for live trading):
POLYMARKET_API_KEY=your_api_key
POLYMARKET_SECRET=your_secret
POLYMARKET_PASSPHRASE=your_passphrase
WALLET_PRIVATE_KEY=your_wallet_private_key
# Trading mode
TRADING_MODE = "paper" # "paper" or "live"
PAPER_TRADING_BALANCE = 100.0 # Starting balance for paper trading
# Entry conditions
ENTRY_MIN_SKEW = 0.10 # Minimum price difference to enter
ENTRY_MAX_CHEAP_PRICE = 0.50 # Max price for cheap side
# Risk limits
MAX_TOTAL_EXPOSURE = 100.0 # Max $ across all markets
MAX_PER_MARKET_EXPOSURE = 50.0 # Max $ per market
MAX_UNHEDGED_MARKETS = 1 # Complete hedge before new positionsource venv/bin/activate
python main.py┌─────────────────────────────────────────────────────────────┐
│ Open Positions │ Summary │ Recent Activity │
│ - Market positions │ - Balance │ - Trade logs │
│ - P&L per position │ - Exposure │ - Blocked trades │
│ │ - Expected P&L │ │
├─────────────────────────────────────────────────────────────┤
│ LIVE MARKET PRICES │
│ MARKET YES NO SUM SKEW SIGNAL │
│ BTC-15M-00AM $0.5600 $0.4500 $1.0100 $0.11 BUY NO │
└─────────────────────────────────────────────────────────────┘
Ctrl+C- Graceful shutdown with final summary
hexatrade/
├── main.py # Entry point, orchestrates components
├── config.py # Configuration constants
├── trading_strategy.py # Gabagool strategy implementation
├── position_tracker.py # Tracks positions and calculates P&L
├── risk_manager.py # Enforces trading limits
├── order_executor.py # Paper/live order execution
├── market_discovery.py # Finds active BTC 15-min markets
├── price_monitor.py # Processes price updates
├── websocket_client.py # WebSocket connection to Polymarket
├── tui.py # Terminal user interface
└── requirements.txt # Python dependencies
- Market Discovery: Finds active BTC 15-minute prediction markets on Polymarket
- WebSocket Connection: Subscribes to real-time price updates
- Strategy Evaluation: On each price update, evaluates if entry/hedge conditions are met
- Risk Check: Validates trade against exposure limits
- Execution: Places order (paper or live)
- Position Tracking: Updates positions and calculates guaranteed profit
- This is experimental software for educational purposes
- Paper trading mode is recommended for testing
- Past performance does not guarantee future results
- Only trade with funds you can afford to lose
- Polymarket may have terms of service restrictions in your jurisdiction
rich- Terminal UIwebsockets- WebSocket clientrequests- HTTP clientpython-dotenv- Environment variable loading