A novel algorithmic trading architecture that integrates Wavelet Denoising, Probabilistic Regime Inference (HMM), and Deep Reinforcement Learning (PPO). This system decouples signal processing from decision-making, allowing the agent to dynamically adapt its aggression based on latent market states.
- Read the Full Whitepaper (PDF) – Detailed methodology, mathematical formulation, and stress test results.
- View the Implementation Code – Complete Python notebook including data pipeline, HMM training, and PPO agent execution.
The system employs a sequential pipeline to transform raw, noisy market microstructure data into a context-aware state representation.
-
Spectral Decomposition (Signal Purification): Raw signals (VIX, GEX, DIX) are processed using Discrete Wavelet Transform (
db4, Level-2) to remove high-frequency noise. - Latent Inference (Context Injection): A Gaussian Hidden Markov Model (HMM) infers the probability of the current market regime ($P(z_t|x_{1:t})$) and feeds this context to the agent.
- Deep Policy Network: A PPO agent utilizing Multi-Head Attention and Bi-LSTM to weigh regime context against price signals.
Tested on S&P 500 E-Mini Futures (2011–2025), Out-of-Sample.
| Model | Total Return | Sharpe Ratio | Max Drawdown | Alpha |
|---|---|---|---|---|
| RL Proposed (Signal + Regime) | 91.51% | 0.80 | 14.5% | 0.27 |
| RL Baseline (Signal Only) | 52.68% | 0.98 | 13.1% | 0.14 |
| Buy & Hold (Benchmark) | 43.46% | 0.71 | 18.9% | -0.00 |
Key Insight: The inclusion of HMM regime probabilities generated 0.13 excess Alpha compared to the baseline agent.
- Clone the repository.
- Install dependencies:
pip install numpy pandas matplotlib scikit-learn torch stable-baselines3 shimmy hmmlearn pywavelets gymnasium - Run the
Regime_Augmented_DRL_Implementation.ipynbnotebook.
Utilizes S&P 500 E-Mini Futures daily data combined with Market Microstructure Indicators (DIX, GEX) provided by SqueezeMetrics.
This codebase is for educational and research purposes only. It is not financial advice.