$ show strongca22-cpu/gabagool
Gabagool is a Python-based arbitrage trading bot for Polymarket's 15-minute prediction markets, with performance-critical components implemented in Rust via PyO3 extensions. The bot implements the 'Gabagool arbitrage' strategy: buying both YES and NO shares when their combined cost is less than $1.00 to guarantee profit regardless of market outcome. The architecture features a modular design separating concerns into API clients (Gamma and CLOB), trading strategy, position tracking, risk management, and persistence layers. Key components include a thread-local HTTP session manager to prevent connection pool issues, a SQLite-based persistence layer for trade and position data, and a thread-safe position tracker with expiration mechanisms. The system supports multiple operational modes including live trading, paper trading simulation, and backtesting against historical data. Recent development activity shows active maintenance with ongoing Rust integration for performance optimization.
The LLM identified 3 files worth highlighting for reuse:
Implements ThreadLocalSessionMixin providing thread-local HTTP sessions to prevent connection pool exhaustion in multi-threaded environments. This isolated utility solves a common scalability issue in HTTP clients and can be extracted for use in any concurrent Python application making external API calls.
Provides thread-safe tracking of long/short positions with automatic expiration after configurable time limits to prevent stuck positions. The component encapsulates position lifecycle management with clean interfaces for adding, reducing, and querying positions, making it reusable in any trading or inventory management system requiring concurrent access with time-based cleanup.
Implements a clean persistence layer using SQLite for storing trades, positions, and settlement data with proper connection handling and transaction management. The component abstracts database operations behind a simple API, allowing easy extraction and reuse in other applications requiring lightweight relational storage without ORM overhead.