arbintel / README.md
AJAY KASU
Add Hugging Face Spaces YAML metadata
38b7cdb
---
title: ArbIntel
emoji: ๐Ÿ“ˆ
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: 1.32.0
app_file: app.py
pinned: false
---
# ArbIntel: Prediction Markets Alpha Engine
## System Architecture & Documentation
### 1. Overview
ArbIntel is a real-time trading intelligence system designed for Polymarket and Kalshi. It features cross-platform arbitrage scanning, Bayesian fair-value probabilistic modeling, HMM regime detection, and an NLP sentiment pipeline for event-driven trading.
### 2. Core Modules
#### Data Ingestion (`src/clients/` & `src/ingestion.py`)
- Async WebSocket and REST clients for Polymarket and Kalshi.
- Real-time normalization of order books to implied probabilities (0-1).
- TimescaleDB storage schema for tick-level data.
#### Arbitrage Engine (`src/strategies/arbitrage.py`)
- **Cross-Platform Arbitrage**: Identifies risk-free margins between Polymarket and Kalshi considering fee schedules.
- **Intra-Market Parity**: Detects structural pricing violations (e.g., YES + NO < 1.0).
#### Bayesian Fair Value (`src/models/bayesian.py`)
- Evaluates real-time market action against a Beta-distribution belief system.
- Adjusts expected probability (Fair Value) based on trade volume and decays older beliefs.
#### NLP Sentiment Pipeline (`src/models/nlp.py`)
- Hugging Face `ProsusAI/finbert` integration.
- Scores incoming news and social feeds for bullish/bearish confidence to feed momentum strategies.
#### HMM Regime Detection (`src/models/hmm.py`)
- 2-state Gaussian Hidden Markov Model.
- Utilizes log-returns, volume spikes, and bid-ask spreads to classify "Stable" vs "Volatile" market conditions for dynamic position sizing.
#### Backtesting & Execution (`src/backtest/engine.py` & `src/execution.py`)
- Event-driven Pandas backtester calculating Sharpe, Max DD, and Win Rates accounting for basis-point slippage.
- Paper Trading engine enforcing risk limits (maximum capital deployed, daily loss limits).
#### Blockchain Integration (`src/blockchain.py`)
- Polygon RPC listener monitoring USDC (`0x2791Bca...`) transfers into the Polymarket Exchange Contract.
- Generates "Whale Alerts" for transaction sizes exceeding expected retail limits.
#### Alerts (`src/alerts.py`)
- Discord & Slack webhook integration for instant arbitrage notification.
### 3. Running the Dashboard
The Streamlit dashboard allows manual overriding and live viewing of the `CrossPlatformArbitrage` scanner. Deployable directly to Hugging Face Spaces.
```bash
streamlit run app.py
```