| title | Quant AI - Autonomous Institutional Algorithmic Trading Platform | ||||||
|---|---|---|---|---|---|---|---|
| emoji | π | ||||||
| colorFrom | blue | ||||||
| colorTo | indigo | ||||||
| sdk | docker | ||||||
| app_port | 7860 | ||||||
| pinned | true | ||||||
| license | mit | ||||||
| short_description | Institutional ML Trading with C++20 OFI Engine & LOB Alpha | ||||||
| tags |
|
Ultra-Low Latency C++20 Engine Β· Microstructure LOB Causal Alpha Β· Self-Evolving Reinforcement Learning
π Launch Live Web App (Hugging Face Space) Β· π Live Real-Time LOB Wave Terminal Β· π Quantitative Research Handbook Β· π System Evolution Chronicle
Quant.ai is an institutional-grade, fully autonomous quantitative trading platform designed for high-volatility US equities (e.g., TSLA, NVDA, MSTR, SNDK). The system bridges nano-second C++20 execution mechanics, causal limit order book (LOB) machine learning, and self-reflective reinforcement learning (RL) into a unified, high-expectancy trading architecture.
Unlike naive retail bots relying on lagging technical indicators or rigid stop-halt lockouts, Quant.ai operates strictly on continuous probabilistic pricing, dynamic microstructural order flow signals, and maximum expected utility
βββββββββββββββββββββββββββββββββββββββββββ
β Alpaca SIP / IEX Real-Time Feeds β
βββββββββββββββββββββ¬ββββββββββββββββββββββ
β WebSocket / Raw Ticks
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β‘ Ultra-Low Latency C++20 Core Engine β
β ββ NASDAQ ITCH 5.0 Binary Deserializer βββββΊ Microsecond L2/L3 Order Book Reconstruction β
β ββ Lock-Free SPSC RingBuffer βββββββββββββββΊ Sub-50ΞΌs POSIX Shared Memory IPC (SHM) β
β ββ AVX-2 SIMD Vector Acceleration ββββββββββΊ Real-time Vectorized OFI & Microprice Drift β
ββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Zero-Copy IPC / Pybind11
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π§ Institutional ML & Decision Intelligence Core β
β ββ GP Saggese Limit Order Book Wave Model ββΊ 15~30m Microstructure Alpha (Purged CV 72.07%) β
β ββ Multi-Model Calibrated Probabilities βββΊ Platt Scaling Win Rate + MFE/MAE Dynamic Regressorsβ
β ββ Hidden Markov Model (HMM) βββββββββββββββΊ Dynamic Regime Classification (Bull / Bear / Chop)β
β ββ Post-Market Self-Reflecting RL ββββββββββΊ Autonomous Mistake Attribution & Q-Policy Update β
ββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Actionable Orders
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π Max-Profit Dynamic Execution Matrix β
β ββ Cross-Sectional Leader Concentration ββββΊ 60% Capital Allocation to Top Momentum Alpha β
β ββ Staged Dynamic Golden Pyramid (60%) βββββΊ Aggressive Profit Compounding on Trend Discovery β
β ββ Smart Order Routing (SOR) βββββββββββββββΊ Maker/Taker Cost Optimization & Impact Modeling β
ββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HTTP & WebSockets
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π₯οΈ Next-Gen Institutional Interactive Terminals β
β ββ π Live LOB Wave Terminal βββββββββββββββΊ Real-time 5m Intraday Streaming + 7 Causal Panels β
β ββ π Robinhood-Style Forecast Overlay βββββΊ Neon Real-Time Track vs ML Extrapolated Trajectoryβ
β ββ π Full-Stack React Executive Cockpit βββΊ Live Equity Radar, Exposure Gauges, & Audit Logs β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Binary Feed Parsing: High-performance binary decoders for NASDAQ ITCH 5.0 and OUCH protocol, processing millions of market events per second with zero memory allocations on the critical path.
- Microsecond Limit Order Book: Cache-friendly contiguous memory order book supporting tick-by-tick level insertions, cancels, price-level sweeps, and cross-matching.
- Lock-Free SPSC & Shared Memory: Sub-50 microsecond IPC across C++ market-feed daemons and Python AI inference engines using lock-free single-producer single-consumer ring buffers in POSIX shared memory.
- AVX-2 SIMD Feature Computation: Vectorized math pipelines computing rolling volatility, correlation matrices, and Order Flow Imbalance (OFI) across multi-asset universes.
-
Giacinto Paolo (GP) Saggese (Teza Capital) Order Book Dynamics:
Replacing uninterpretable deep black-boxes with causal limit order book physics. The engine computes 7 core microstructural alphas:
- Order Flow Imbalance (OFI): Normalized tick-by-tick changes in bid/ask depth volume;
- Microprice Drift (bps): Depth-weighted center-of-mass price drift relative to mid-price;
- Queue Imbalance Ratio: Dynamic queue exhaustion metrics detecting iceberg walls;
- Sweep Velocity: Aggressive market taker consumption speed;
- Volume Acceleration: 5-minute surge acceleration over historical baseline;
- Wick Absorption Ratio: Intraday candle wick capital rejection index;
- HRT Toxic Flow: Adverse selection toxicity gauge inspired by high-frequency market making.
- Strict Purged & Embargoed Cross-Validation: Designed strictly under Marcos Lopez de Pradoβs framework. Features zero lookahead bias with out-of-sample purged validation accuracy reaching 61.97% ~ 72.07%.
-
Calibrated Win-Rate & Dynamic Expectancy Boundary:
Platt-scaled win-rate probabilities
$P_{\text{win}}$ coupled with Maximum Favorable Excursion (MFE) and Maximum Adverse Excursion (MAE) regressors to dynamically size positions based on pure mathematical expectancy:$$E[R] = P_{\text{win}} \cdot \mathbb{E}[\text{MFE}] - (1 - P_{\text{win}}) \cdot \mathbb{E}[\text{MAE}]$$
- Autonomous Mistake Taxonomy: End-of-day automated audit analyzing every completed execution. It automatically classifies execution anomalies into a causal taxonomy (e.g., knife-catching against institutional distribution sweeps, false-breakout chase, low-volatility overtrading).
- Dynamic Q-Table Policy Gating:
The RL agent updates strategy decision weights (
Q-Policy Gate) iteratively based on daily real-world feedback without manual code modifications, allowing the system to continuously adapt to changing market volatility regimes.
- Continuous Multi-Regime Execution: No artificial lockouts or circuit breakers. The system maintains continuous long/short deployment wherever positive mathematical expectation exists.
- Cross-Sectional Leader Momentum Concentration: Real-time relative strength scoring concentrates up to 60% of available capital into the single strongest market leader (e.g., riding full-day trend expansions like MSTR +5.7%).
- Dynamic Staged 60% Golden Pyramid: Once an initial base position generates positive floating alpha and structure confirmation, the system triggers a secondary pyramid scale-in to compound winning waves to maximum profit capacity.
- Smart Order Routing (SOR): Real-time estimation of queue replenishment rates, dynamically balancing passive maker fills (earning rebates) against aggressive taker sweeps (guaranteeing fill urgency).
| Win-Rate Calibration Curve | Monte Carlo CVaR Tail Risk | SOR Maker vs Taker Optimization |
|---|---|---|
![]() |
![]() |
![]() |
- π Real-Time LOB Microstructure Wave Terminal (Try Live on Hugging Face):
- Seamless instant ticker switching (TSLA, NVDA, MSTR, SNDK, etc.);
- π Live TODAY Intraday Streaming: Auto-polls fresh 5m bars, microprice drift, and OFI volume histograms every 8 seconds;
- Smart debounced wave inflection markers clearly highlighting
WAVE LONGandWAVE SHORTreversal opportunities.
- π Robinhood-Style Forecast Trajectory Overlay:
- Neon-lit real-time historical path juxtaposed with dashed ML forecasted trajectory bands;
- Forward extrapolation of expected 15~30 minute order book wave trajectories.
- π Full Institutional React Cockpit (frontend/):
- Real-time portfolio NAV equity curve, sector concentration radar, live order stream, and risk metrics.
Quant.ai/
βββ .github/ # GitHub Actions CI/CD & Automated Hugging Face Space Synchronization
βββ assets/ # Institutional terminal screenshots, microstructure charts, and badges
βββ backend/ # FastAPI Async Backend, WebSocket Services & ML Alpha Algorithms
β βββ app/ # Core Trading Platform
β β βββ broker/ # Alpaca Direct Market Access (DMA) Gateway & Ledger
β β βββ ml/ # 7 Causal LOB Models, Probability Calibration, & Real-time Wave Services
β β βββ ipc/ # POSIX Shared Memory & Lock-Free IPC Interop Bridge
β βββ data/ # Historical Dataset Stores & Visual Chart Pipelines
βββ cpp_engine/ # C++20 Nano-Second Low Latency Core (ITCH/OUCH, LOB, RingBuffers)
βββ cpp_quant_engine/ # Pre-compiled C++ Binary Python Extensions
βββ docs/ # π Academic Research Handbook, Foundational Papers (PDFs), & System Logs
β βββ papers/ # Cont-Stoikov, Saggese, Bouchaud, Almgren-Chriss Reference Papers
β βββ QUANT_RESEARCH_HANDBOOK.md # Mathematical Proofs & Model Formulations
β βββ STRATEGY_EVOLUTION_HISTORY.md # Complete Development History & Architectural Decisions
βββ frontend/ # React + Vite + TypeScript Institutional Trading Cockpit
βββ reports/ # Strategy Backtest Audits & Monte Carlo Risk Reports
βββ scripts/ # π οΈ 12 Simulation, Optimization, Training, & Visual Generation Scripts
βββ tests/ # Automated Unit & Regression Test Suite
βββ Dockerfile # Production Multi-Stage Container Image
βββ Makefile # One-Click Build, Test, & Execution Commands
βββ requirements.txt # Python Core Dependencies
βββ README.md # Master Institutional Repository Documentationgit clone https://github.com/ypeng12/Quant.ai.git
cd Quant.ai
# Install Python 3.11 core dependencies
pip install -r requirements.txtcd cpp_engine
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
cd ../..# Start FastAPI backend with live microstructural computing engine on port 8000
python3 -m uvicorn backend.main_api:app --host 127.0.0.1 --port 8000 --reloadOnce launched, open in your browser:
- π Live LOB Wave Terminal: http://127.0.0.1:8000/saggese_wave_visual_dashboard.html
- π Interactive API Docs (Swagger UI): http://127.0.0.1:8000/docs
# Run full automated test suite
make test
# Execute institutional max-profit multi-asset simulation
python3 scripts/run_max_profit_simulation.py --capital 500000
# Execute post-market self-reflection & RL Q-table update
python3 scripts/run_daily_reflection.py --date 2026-09-11
# Re-generate full multi-ticker LOB wave visual data
python3 scripts/generate_saggese_wave_dashboard.pyQuant.ai's mathematical modeling is strictly grounded in peer-reviewed quantitative finance literature:
- Cont, R., Kukanov, A., & Stoikov, S. (2014): The Price Impact of Order Book Events. Journal of Financial Econometrics (Foundational OFI dynamics).
- Saggese, G. P. (Teza Capital / University of Maryland): Simple First & Interpretable Tree Models on Limit Order Book Dynamics.
- Almgren, R., & Chriss, N. (2000): Optimal Execution of Portfolio Transactions. Journal of Risk (Dynamic market impact & Smart Order Routing).
- Marcos Lopez de Prado (2018): Advances in Financial Machine Learning. Wiley (Purged K-Fold Cross-Validation & Deflated Sharpe Ratio audit).
- Ledoit, O., & Wolf, M. (2004): A Well-Conditioned Estimator for Large-Dimensional Covariance Matrices. Journal of Multivariate Analysis (Spectral shrinkage).
For complete mathematical derivations, proof of convergence, and backtest audit trails, please refer to docs/QUANT_RESEARCH_HANDBOOK.md.
This repository is intended strictly for quantitative finance research, algorithmic engineering, and academic analysis. Live trading involves substantial risk of financial loss. Users must thoroughly evaluate their own risk tolerance and assume full responsibility for all capital deployment and execution outcomes.




