A production-grade quantitative trading platform for the Quantiacs Q24 competition. This system provides a comprehensive ecosystem for developing, backtesting, analyzing, and managing algorithmic trading strategies across equities and cryptocurrencies.
- Multi-Strategy Portfolio Management - Run and compare 11+ strategies with individual isolation
- Advanced Factor Library - 32+ factors across 12 categories (momentum, value, quality, etc.)
- Professional Dashboard - 20+ analytical pages with real-time performance monitoring
- Risk Analytics - Comprehensive risk attribution, Brinson analysis, and ex-ante risk forecasting
- What-If Analysis - Scenario exploration with parameter surfaces
- Smart Data Caching - TTL-based caching to optimize API usage
- Regime Detection - Market regime classification with regime-aware metrics
- Python 3.7+
- Streamlit - Interactive web dashboard
- xarray - N-dimensional array computing
- pandas / numpy - Data manipulation and numerical computing
- Quantiacs API (qnt) - Market data access and backtesting
- Plotly / Matplotlib - Visualization
- scikit-learn / scipy - Machine learning and scientific computing
Q24_QUANT_SYSTEM/
├── src/Q24/
│ ├── strategies/ # Strategy implementations
│ │ ├── base.py # Abstract base class
│ │ ├── registry.py # Strategy discovery & registry
│ │ ├── ou_v1/ # Ornstein-Uhlenbeck mean-reversion
│ │ ├── glft_v1/ # Global Long-Short Tactical
│ │ ├── gtp51max/ # Optimized for max Sharpe
│ │ ├── q24_crypto_v*/ # Neural Crypto Alpha variants
│ │ └── benchmarks/ # Benchmark implementations
│ │
│ ├── strategy/ # Core strategy engine
│ │ ├── engine.py # Execution orchestrator
│ │ ├── data_loader.py # Market data with caching
│ │ ├── factors.py # Factor library (32+ factors)
│ │ ├── portfolio.py # Portfolio construction
│ │ ├── ic_weighting.py # Information coefficient weighting
│ │ └── risk_overlays.py # Risk management
│ │
│ ├── dashboard/ # Streamlit dashboard
│ │ ├── app.py # Main entry point
│ │ ├── _pages/ # 20+ dashboard pages
│ │ ├── components/ # Reusable UI components
│ │ └── analytics/ # Analytics modules
│ │
│ └── shared/ # Shared utilities
│
├── outputs/ # Strategy output directories
├── data-cache/ # Smart data caching
├── run_strategy.py # Strategy execution entry point
├── run_dashboard.py # Dashboard launcher
├── Run_Q24.command # macOS combined runner
└── .env # Configuration
- Python 3.7+
- Quantiacs API key (obtain from Quantiacs)
- Conda (recommended) or pip
-
Clone the repository:
git clone <repository-url> cd Q24_QUANT_SYSTEM
-
Create and activate environment:
conda create -n q24 python=3.10 conda activate q24
-
Install dependencies:
pip install streamlit pandas numpy xarray plotly matplotlib scikit-learn scipy pip install qnt # Quantiacs toolbox -
Configure environment variables in
.env:API_KEY=your-quantiacs-api-key Q24_TAG=2025-12-22 # Optional: tag for outputs Q24_FORCE_RERUN=false # Force re-run regardless of freshness Q24_AUTO_RUN_BENCHMARKS=true
Execute all enabled strategies:
python run_strategy.pyThis will:
- Load enabled strategies from
enabled_strategies.json - Skip strategies already run today (unless
Q24_FORCE_RERUN=true) - Execute each strategy and save results to
outputs/<strategy_id>/ - Auto-run benchmark strategies after regular strategies
Start the interactive portfolio management dashboard:
python run_dashboard.pyThe dashboard provides:
- Overview - KPI dashboard with performance charts
- Performance - Sharpe, Sortino, Calmar, drawdown metrics
- Weights - Portfolio composition over time
- Factors - Factor IC analysis and contribution
- Attribution - Factor and stock attribution
- Risk Analytics - Risk decomposition and ex-ante forecasting
- Elite Analytics - Regime, tail risk, convexity analysis
- Strategy Comparison - Multi-strategy performance comparison
- What-If Analysis - Scenario exploration
./Run_Q24.commandRuns diagnostics, executes strategies, and launches the dashboard.
-
Create a new directory in
src/Q24/strategies/:src/Q24/strategies/my_strategy/ ├── __init__.py ├── config.py # Strategy configuration ├── engine.py # Strategy implementation └── factors.py # Custom factors (optional) -
Implement the strategy by inheriting from
StrategyBase:from src.Q24.strategies.base import StrategyBase, StrategyConfig from src.Q24.strategies.registry import StrategyRegistry @StrategyRegistry.register class MyStrategy(StrategyBase): @classmethod def get_id(cls) -> str: return "my_strategy" @classmethod def get_display_name(cls) -> str: return "My Custom Strategy" def run(self): # Strategy implementation pass
-
Enable the strategy in
enabled_strategies.json:{ "enabled": { "my_strategy": true } }
| Strategy | Type | Description |
|---|---|---|
ou_v1 |
Mean-Reversion | Ornstein-Uhlenbeck process with 24 factors |
glft_v1 |
Tactical | Global Long-Short Tactical |
gtp51max |
Optimized | Maximum Sharpe optimization |
q24_crypto_v5 |
Crypto | Neural Crypto Alpha (28 factors) |
q24_crypto_v10x |
Crypto | Neural Crypto Alpha (12 factors) |
q24_crypto_v11x |
Crypto | Neural Crypto Alpha (10 curated factors) |
q23_composer_v1 |
Ensemble | 32-factor ensemble strategy |
benchmarks/* |
Benchmark | Equal-weight and market-cap benchmarks |
| Variable | Description | Default |
|---|---|---|
API_KEY |
Quantiacs API key | Required |
Q24_TAG |
Tag for output directories | Current date |
Q24_FORCE_RERUN |
Force re-run all strategies | false |
Q24_AUTO_RUN_BENCHMARKS |
Auto-run benchmarks after strategies | true |
Q24_SKIP_BENCHMARKS |
Skip benchmark execution | false |
Q24_DEBUG_RUNS |
Enable debug mode | false |
Configure which strategies to run in src/Q24/strategies/enabled_strategies.json:
{
"enabled": {
"ou_v1": true,
"glft_v1": false,
"benchmark_nas_ew": true
}
}- Overview - KPI dashboard with portfolio snapshot
- Performance - Comprehensive performance metrics
- Weights - Long/short portfolio composition
- Factors - Factor IC analysis
- Attribution - Factor/stock attribution
- Regime Analysis - Market regime detection
- Tail Risk - CVaR clustering and extreme risk
- Convexity - Gain decomposition analysis
- Alpha Decay - Signal freshness estimation
- Capacity - Portfolio scalability analysis
- Risk Attribution - Factor risk contribution
- Brinson Attribution - Active return decomposition
- Ex-Ante Risk - Forward risk projection
- Correlation Analysis - Rolling correlations
- Strategy Warehouse - Enable/disable strategies
- Strategy Comparison - Multi-strategy comparison
- What-If Analysis - Scenario exploration
- Diagnostics - System health monitoring
Strategy results are saved to outputs/<strategy_id>/:
outputs/ou_v1/
├── _wide_weights_2025-12-22.csv # Portfolio weights
├── _ic_2025-12-22.csv # Information coefficients
├── _factor_weights_2025-12-22.csv # Factor contributions
└── diagnostics.json # Performance metrics
Proprietary - All rights reserved.
For issues and feature requests, please open an issue in the repository.