Skip to content

hypercoreiai/DRLWorkbench

Repository files navigation

DRLWorkbench

Deep Reinforcement Learning Backtesting and Analysis Framework

A comprehensive Python framework for developing, testing, and deploying Deep Reinforcement Learning agents for quantitative finance applications.

Features

✅ Implemented Core Features

  1. Backtesting Framework — Walk-forward validation, rolling windows, transaction costs, slippage modeling with realistic portfolio simulation
  2. Regime Analysis — Detect bull/bear/sideways markets using K-Means, GMM, or rule-based methods; compute regime-conditioned metrics
  3. Error Handling & Logging — Comprehensive exception hierarchy, centralized logging with rotation, checkpointing for resume capability
  4. Data Validation — Statistical tests (stationarity via ADF test), data quality checks (outliers, missing data), type validation

🚧 Planned Features (See Documentation)

  1. Hyperparameter Tuning — Systematic grid search + random search with early stopping
  2. Comparative Strategy Analysis — Side-by-side comparison, sensitivity analysis, performance attribution
  3. Ensemble Models — Framework for combining multiple forecasters/DRL agents
  4. Enhanced Visualizations — Equity curves with regime backgrounds, rolling metrics, interactive dashboards
  5. Professional Reporting — PDF/HTML/CSV export with automated formatting

Installation

# Clone the repository
git clone https://github.com/hypercoreiai/DRLWorkbench.git
cd DRLWorkbench

# Create a virtual environment (optional but recommended)
python -m venv .venv

# Activate the virtual environment
# Windows:
.venv\Scripts\activate
# Linux/Mac:
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Quick Start

The main entry point for the pipeline is run_pipeline.py.

# Run the pipeline with default configuration
python run_pipeline.py

# Run with a specific config file
python run_pipeline.py --config configs/my_config.yaml

# Resume from a checkpoint
python run_pipeline.py --resume outputs/checkpoint.pkl

Documentation

Comprehensive documentation is available in the project:

Project Structure

Running Tests

# Run all tests
pytest tests/ -v

# Run with coverage report
pytest tests/ --cov=drlworkbench --cov-report=html

# Run specific test module
pytest tests/test_validation/ -v

Development Status

Current Version: 0.1.0 (Alpha)

Test Coverage: 76% (22 tests, all passing)

Security: No vulnerabilities detected (CodeQL verified)

Core Modules

Utils Module

  • setup_logger() - Centralized logging configuration
  • Checkpoint - Save/load state for long-running operations
  • Exception Classes - Hierarchy for better error handling

Backtesting Module

  • BacktestEngine - Core backtesting with transaction costs
  • Portfolio - Position and cash management
  • Performance metrics: Sharpe, Sortino, Calmar, max drawdown

Regime Detection Module

  • RegimeDetector - Market state identification
  • Methods: K-Means, Gaussian Mixture Model, Rule-based
  • Automatic regime labeling (Bear/Sideways/Bull)

Validation Module

  • DataValidator - Comprehensive data quality checks
  • Statistical tests: ADF (stationarity), outlier detection
  • Data type validation and missing data analysis

Contributing

This project follows professional Python development practices:

  • Type hints throughout the codebase
  • Comprehensive docstrings (NumPy style)
  • Unit tests with pytest
  • Code formatting with black
  • Linting with flake8

License

MIT License - see LICENSE file for details

Authors

DRLWorkbench Team

Acknowledgments

Built on industry-standard libraries:

  • NumPy, Pandas, SciPy for numerical computing
  • scikit-learn for machine learning algorithms
  • statsmodels for statistical tests
  • matplotlib, seaborn, plotly for visualization

About

1. Backtesting Framework 2. Regime Analysis 3. Error Handling & Logging 4. Data Validation 5. Hyperparameter Tuning 6. Comparative Strategy Analysis 7. Ensemble Models 8. Enhanced Visualizations 9. Professional Reporting

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages