| title | QuantEngine |
|---|---|
| emoji | ⚡ |
| colorFrom | blue |
| colorTo | green |
| sdk | gradio |
| sdk_version | 5.16.0 |
| app_file | app.py |
| pinned | false |
| license | mit |
High-Performance Quantitative Research & Statistical Arbitrage Engine
Accelerated with Apple Silicon Metal Performance Shaders (MPS / NPU), Kalman Filters, Hierarchical Risk Parity (HRP), and GARCH Volatility Modeling.
QuantEngine is a modular algorithmic trading and quantitative analytics framework designed for statistical arbitrage, portfolio optimization, dynamic risk management, and live broker execution.
┌──────────────────────────────────────┐
│ Live Market Data │
└──────────────────┬───────────────────┘
│
┌──────────────────────────┴──────────────────────────┐
▼ ▼
┌──────────────────────────┐ ┌──────────────────────────┐
│ Statistical Arbitrage │ │ Portfolio Allocation │
├──────────────────────────┤ ├──────────────────────────┤
│ • Engle-Granger Cointeg │ │ • Hierarchical Risk │
│ • Kalman Filter State │ │ Parity (HRP) │
│ • Ornstein-Uhlenbeck SDE │ │ • GARCH(1,1) Volatility │
│ • Metal GPU / NPU ResNet │ │ • FX Normalized Risk │
└────────────┬─────────────┘ └────────────┬─────────────┘
│ │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌──────────────────────────────────────┐
│ Broker Bridge & Risk Router │
├──────────────────────────────────────┤
│ • Position Sizing & Slippage Control │
│ • Alpaca Markets Execution Bridge │
│ • Live WebSocket Web Dashboard │
└──────────────────────────────────────┘
| Module | Core Concept | Description |
|---|---|---|
npu_neural.py |
Deep Residual Alpha Network | PyTorch ResNet architecture with LayerNorm, GELU activations, and Bayesian Weight Regularization optimized for Apple Silicon MPS (Metal Performance Shaders) to estimate statistical arbitrage alpha confidence scores. |
hrp.py |
Hierarchical Risk Parity (HRP) | Marcos López de Prado's tree-clustering portfolio allocation. Uses hierarchical single-linkage clustering, matrix quasi-diagonalization, and recursive bisection to construct robust risk-parity weights without matrix inversion instability. |
kalman.py |
State-Space Filtering | Adaptive dynamic hedge ratio ( |
cointegration.py |
Cointegration & Stationarity | Automated pair selection engine utilizing Augmented Dickey-Fuller (ADF), Engle-Granger two-step cointegration, and Johansen test vector error correction. |
garch.py |
Conditional Heteroskedasticity | GARCH(1,1) volatility engine for time-varying variance estimation, volatility clustering identification, and dynamic Value-at-Risk (VaR) calculation. |
stochastic.py |
Stochastic Calculus Models | Ornstein-Uhlenbeck mean-reversion parameter estimation (speed of mean reversion |
broker_bridge.py |
Execution & Risk Management | Production-grade broker integration with Alpaca Markets REST/WebSocket APIs, automated safety caps, and circuit breakers. |
web_server.py |
Interactive Web Dashboard | FastAPI & WebSocket dashboard providing real-time PnL monitoring, live spread charting, and tear sheet visualizations. |
Clone the repository and install the dependencies:
git clone https://github.com/ameerhmz/quant_engine.git
cd quant_engine
pip install -r requirements.txtStart the quantitative web server and dashboard:
python web_server.pyOpen your browser at http://localhost:8000 to monitor live signals, backtests, and portfolio allocations.
MIT License. Developed for research and algorithmic trading experiments.