View Demo • Read the Logic • Install
In Prediction Markets (e.g., Polymarket, Kalshi), arbitrage opportunities are fleeting. Traditional bots compete on Latency (Speed).
- The Trap: A naive bot sees a price spread ($0.05) and executes.
- The Reality: Low liquidity causes Slippage. The order fills at a worse price, turning a theoretical profit into a realized loss.
- The Result: "Toxic Flow" bankruptcy.
PolyMind replaces Speed with Probability. It utilizes a Gradient Boosted Decision Tree (XGBoost) to act as an "Execution Gate." Before any trade is submitted, the AI analyzes Level 2 Order Book dynamics to predict the probability of a successful fill.
"We don't trade often. We trade when we win."
We simulated 1,000 trades in a hostile market environment specifically designed with "Liquidity Traps" (High Spread / Zero Depth).
| Strategy | Execution Logic | Final PnL | Result |
|---|---|---|---|
| 🔴 Naive Bot | if Spread > $0.02 |
-$7,845 | 💀 Bankruptcy (Slippage) |
| 🟢 PolyMind AI | if AI_Confidence > 90% |
+$18,211 | 🚀 Profit (Alpha) |
PolyMind treats execution as a classification problem, not a regression problem.
Where the execution gate logic is defined as:
This non-linear filtering allows the system to ignore 80% of "noisy" signals that trap standard algorithms.
The system is designed as a modular microservice pipeline.
flowchart LR
A[("Market Data Stream")] --> B(Feature Engineering)
B --> C{XGBoost Model}
C -- "Confidence < 90%" --> D[🛑 Reject Trade]
C -- "Confidence > 90%" --> E[✅ Execute Order]
E --> F[("Portfolio Manager")]
D --> G[("Risk Logs")]
style C fill:#f9f,stroke:#333,stroke-width:2px
style E fill:#bbf,stroke:#333,stroke-width:2px
- Market Simulator: Generates synthetic Level 2 data (Spread, Liquidity, Volatility) with realistic "Trap" injection.
- Alpha Model: XGBoost Classifier trained on 5,000 historical trade scenarios to detect "Toxic Flow."
- Execution Engine: Python class that mimics a live trading loop with latency simulation.
- Python 3.8+
- Jupyter Notebook / Google Colab
# 1. Clone the repository
git clone https://github.com/eatosin/PolyMind-Crypto-Arbitrage.git
# 2. Install dependencies
pip install xgboost pandas numpy scikit-learn matplotlibOpen PolyMind_Arbitrage_Engine.ipynb and run all cells to:
- Generate fresh synthetic market data.
- Train the XGBoost model in real-time.
- Visualize the PnL curve against a Naive Bot.
Owadokun Tosin Tobi Physicist & Quant Developer
- Research: ReasonBench (LLM Evaluation)
- Engineering: Sentinel (MLOps)
- Forensics: Spectre (Deepfake Detection)
Disclaimer: This software is for educational and research purposes only. Do not use for live financial trading without rigorous risk management.
This software is a theoretical backtest simulation.
- Results generated using synthetic order book data to demonstrate the XGBoost probability engine.
- Live market conditions (latency, slippage, fees) may vary significantly.
- This code is for educational and engineering portfolio purposes only and does not constitute financial advice.
