# ArbIntel Part 1: Architecture of a Production-Grade Prediction Market Engine Prediction markets like Polymarket and Kalshi have emerged as highly efficient forecasting mechanisms. However, the microstructure of these markets presents unique challenges: high latency, sparse order books, and fragmented liquidity. To exploit these inefficiencies, we built **ArbIntel**, a production-grade algorithmic trading system. In this first part of a four-part series, we'll dive into the architecture of ArbIntel. ## The Tri-Layer Architecture A robust trading system requires strict separation of concerns. ArbIntel employs a tri-layer design: 1. **Data Ingestion Layer**: The foundation of any quantitative model is clean data. ArbIntel establishes persistent async WebSocket connections to both the Polymarket Gamma API and the Kalshi v2 trade API. Real-time tick updates (Bids, Asks, Sizes) are normalized into implied probabilities (0.0 to 1.0) and persisted to a local TimescaleDB instance for tick-level backtesting. 2. **Strategy execution Layer**: This is where the Alpha is generated. Raw ticks are fed through multiple independent engines: * *Cross-Platform Arbitrage Scanner*: Continuously monitors the spread between Polymarket and Kalshi. * *Bayesian Fair Value Model*: Estimates the "true" probability of an event using continuous Beta distribution updates. * *NLP Momentum Tracker*: Analyzes breaking news and social sentiment to front-run retail flows. 3. **Execution & Risk Layer**: Alpha is useless without execution. ArbIntel utilizes a Paper Trading framework enforcing rigorous risk constraints, including maximum position sizing and daily drawdown limits. ## Technical Stack Overview * **Language**: Python 3.13 (Asyncio heavy) * **Database**: PostgreSQL + TimescaleDB extension * **Machine Learning**: `hmmlearn` (Regime Detection), Hugging Face `transformers` (Sentiment) * **Dashboard**: Streamlit + Plotly In **Part 2**, we will explore the mathematics behind our Bayesian Fair-Value Model and how we use 1D Kalman Filters to smooth out the noise of illiquid order books.