Reinforcement Learning
stable-baselines3
deep-reinforcement-learning
portfolio-optimization
quantitative-finance
hidden-markov-models
ppo
gymnasium
Instructions to use sour-d/regime-aware-portfolio-allocation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use sour-d/regime-aware-portfolio-allocation with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="sour-d/regime-aware-portfolio-allocation", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
Regime-Aware Reinforcement Learning for Dynamic Multi-Asset Portfolio Allocation Under Non-Stationary Market Conditions
Master's Thesis Project
Indian Institute of Technology Patna (IIT Patna)
GitHub Repository: sour-d/MS-Thesis
1. Project Overview
Dynamic portfolio allocation under non-stationary market conditions represents a fundamental challenge in quantitative finance. Traditional models (Markowitz Mean-Variance, Risk Parity) assume stationary asset return distributions and suffer massive drawdowns during sudden market crashes.
This project implements a decoupled continuous control architecture:
- Unsupervised Market Regime Detection: A Gaussian Hidden Markov Model (HMM) calibrated on rolling realized volatility and return indicators to infer latent macroeconomic market regimes (Bull, Sideways, Crisis Shock) without look-ahead bias.
- Custom OpenAI Gymnasium Environment:
PortfolioEnvenforcing the probability simplex via Softmax projection, proportional transaction costs (10 bps), slippage (2 bps), and Conditional Value-at-Risk (CVaR at 95%) reward shaping. - Continuous Control Deep RL Agent: Stable-Baselines3 PPO/SAC policy networks conditioned on the real-time HMM posterior regime probability vector.
- Walk-Forward Cross-Validation: Institutional benchmarking against Equal-Weight (1/N), Markowitz MVO, and Regime-Blind DRL agents.
2. Multi-Asset Indian Market Universe
- Equity:
NIFTYBEES.NS(Nippon India ETF Nifty 50 BeES) - Precious Metals / Safe Haven:
GOLDBEES.NS(Nippon India ETF Gold BeES) - Cash / Debt:
LIQUIDBEES.NS(Nippon India ETF Nifty 1D Rate Liquid BeES) - Benchmark:
^NSEI(NSE Nifty 50 Index)
3. Usage & Local Reproduction
git clone https://github.com/sour-d/MS-Thesis.git
cd MS-Thesis
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
# Run complete pipeline
make data
make regime
make train
make evaluate
4. Citation
@mastersthesis{regime_aware_rl_thesis_iitp,
author = {Das, Sourav},
title = {Regime-Aware Reinforcement Learning for Dynamic Multi-Asset Portfolio Allocation Under Non-Stationary Market Conditions},
school = {Indian Institute of Technology Patna},
year = {2025}
}
- Downloads last month
- 38