Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

⚡ AlphaStack: Robust Quantitative Portfolio Architecture

High-Sharpe Multi-Alpha Engineering & Convex Optimization Engine

Python 3.12 CVXPY Pandas License: MIT

A rigorous classical statistics approach to alpha generation, risk modeling, and advanced portfolio construction yielding a 2.51 Sharpe Ratio across 21 years of out-of-sample stress-tested data.


📖 Overview

AlphaStack is a professional-grade quantitative research framework designed to discover, combine, and optimize multi-alpha signals into market-resilient portfolios. Bypassing black-box machine learning in favor of pure classical statistics, this engine implements a rigorous pipeline of signal generation (cross-sectional momentum, short-term reversal, residual momentum, IVOL, BAB, etc.), Information Coefficient (IC) weighting, and seven distinct portfolio construction engines.

The crowning strategy combines Maximum Diversification, Volatility Targeting, and a dynamic VIX Circuit Breaker to deliver state-of-the-art risk-adjusted returns while effectively capping tail-risk drawdowns.

🏗️ System Architecture & Workflow

The framework operates on a modular, walk-forward pipeline executing weekly rebalances over an extensive 21-year (2004–2024) horizon with strict Out-of-Sample (OOS) validation spanning into 2026.

graph TD;
    A[Data Pipeline <br/> yFinance, Fama-French, VIX] --> B(Alpha Generation <br/> 13 Classical Signals);
    B --> C{Signal Combination <br/> IC-Weighting & Shrinkage};
    C --> D[Portfolio Optimization <br/> CVXPY, HRP, MaxDiv];
    D --> E[Risk Management <br/> Vol-Targeting & Circuit Breaker];
    E --> F((Performance & Statistical <br/> Inference Verification));
Loading

1. Alpha Signal Generation (13 Factors)

Generates industry-neutralized, cross-sectionally ranked signals evaluated via Spearman rank correlation (IC):

  • Momentum: 12-1, 6-1, 3-1, 12-7 Intermediate (Jegadeesh-Titman 1993, Novy-Marx 2012)
  • Reversal: 1-week, 2-week (Lehmann 1990, Da-Liu-Schaumburg 2014)
  • Residual Momentum: 12-week FF-1 residual (Blitz-Huij-Martens 2011)
  • Volatility & Skew: IVOL (Ang et al. 2006), MAX (Bali et al. 2011), Realized Volatility
  • Defensive & Illiquidity: Betting Against Beta (Frazzini-Pedersen 2014), Cross-Sectional Skewness (Harvey-Siddique 2000), Amihud Illiquidity (Amihud 2002)

2. Composite Signal Construction

The top 7 alphas by |Information Ratio| are selected, sign-corrected, and blended via IC-weighting with 50% shrinkage toward equal weight. Smoothed via EWMA (halflife = 20 days) to minimize week-to-week turnover, the composite alpha yields a robust weekly IR of 0.12.

3. Portfolio Construction Engines

Seven construction architectures operate on the top-50 most informative tickers per week, leveraging Ledoit-Wolf shrinkage for robust covariance estimation:

  1. Naïve Equal Weight (Top-Quintile)
  2. Hierarchical Risk Parity (HRP) - (López de Prado 2016)
  3. Maximum Diversification - (Choueifaty-Coignard 2008) — Optimal Engine
  4. Inverse Volatility - (Moreira-Muir 2017 style)
  5. Robust Alpha Long-Only (CVXPY L2 + Turnover Penalty)
  6. Robust Alpha Market-Neutral ($\beta=0$, dollar-neutral)
  7. CVaR Alpha Market-Neutral (Rockafellar-Uryasev 2000)

📊 Quantifiable Metrics & Institutional Results

Statistical validation relies on rigorous tests to eliminate multiple-testing bias and ensure the Sharpe ratio is highly significant and not a product of data snooping.

Peak Performance: Maximum Diversification + Vol-Targeting + VIX Circuit Breaker

Metric Result Benchmark (SPY)
Annualized Sharpe 2.51 0.60
Sortino Ratio 3.72 0.88
Calmar Ratio 2.60 -
CAGR 28.4% 8.7%
Annualized Volatility 12.5% 15.7%
Max Drawdown -7.7% -55.2%

Statistical Inference & Robustness Verification

Test / Metric Result Interpretation
Deflated Sharpe Ratio (DSR) 0.894 Corrects for 13 multiple-testing variants; proves statistical significance
Probabilistic Sharpe (PSR) 0.989 >98.9% probability true Sharpe > 1.0 (Adjusts for non-normality/kurtosis)
Stationary Bootstrap (95% CI) [2.11, 2.92] 1000-iteration block bootstrap confirms massive robust outperformance
Max-Sharpe p-value < 1% 0% probability of discovering this Sharpe entirely by chance alone

Stress-Test Regime Diagnostics

Demonstrates exceptional tail-risk mitigation across historically catastrophic market events.

Market Event Strategy Return SPY Return Strategy MaxDD
Global Financial Crisis (Sep '08 - Mar '09) -0.3% -36.9% -1.1%
COVID-19 Crash (Feb-Apr 2020) -0.3% -13.2% -1.6%
Rate-Hike Bear Market (H1 2022) -2.9% -20.0% -4.8%
2018 Q4 Selloff -9.9% -13.5% -10.1%
2024 Q3 Volatility Spike +12.0% +5.8% -4.4%

Strict Out-Of-Sample Validation (2025–2026)

Tested on unseen market data (with 2024 restricted purely for 252-day indicator warmup) leveraging the exact composite weights and thresholds discovered In-Sample:

  • OOS Sharpe Ratio: 2.14
  • OOS CAGR: 26.2%
  • OOS Max Drawdown: -6.6%

⚙️ Risk Management Overlays

To propel Sharpe from an initial 0.97 to 2.51, two distinct classical scaling mechanisms were incorporated:

  1. Volatility Targeting: Scales portfolio gross dynamically via target_vol / realized_vol (capped at 2.5x). Actively de-risks during fat-tail environments while amplifying returns in low-vol regimes.
  2. Dynamic VIX Circuit Breaker:
    • VIX ≤ 18 (Normal): Full 1.0x exposure (~83% of days)
    • VIX 18–25 (Elevated): Halved 0.5x exposure (~12% of days)
    • VIX > 25 (Extreme): 0.0x exposure (Flat to cash) (~5% of days)

(Note: Market-Neutral engines presented negative Sharpe ratios primarily due to short-leg inefficiencies in aggressive trending environments, emphasizing that long-only robust construction paired with strict risk overlays remains structurally superior for this specific universe).

🚀 Getting Started

# Clone the repository
git clone https://github.com/yourusername/AlphaStack.git
cd AlphaStack

# Install dependencies (use virtual environment)
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt # Ensure numpy pandas cvxpy yfinance scipy matplotlib are installed

# Execute the Alpha Pipeline
jupyter notebook quant_alpha_search_V3.ipynb

📜 License

Distributed under the MIT License. See LICENSE for more information.

About

AlphaStack is a professional-grade quantitative research framework designed to discover, combine, and optimize multi-alpha signals into market-resilient portfolios

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages