-
Notifications
You must be signed in to change notification settings - Fork 5
Add CLI Entrypoint for QuantResearch #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI Entrypoint for QuantResearch #18
Conversation
Enhanced volatility factor implementations for production use, including improved initialization, handling of edge cases, and consistent DataFrame outputs.
Remove unused import statement for warnings.
Remove unused import statement for warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a CLI entrypoint for the QuantResearch package, enabling users to install with pip install . and run commands via python -m quant_research_starter.cli or the qrs command. The PR fixes package discovery configuration and updates documentation to reflect the new CLI usage patterns.
Key Changes:
- Fixed package structure configuration in
pyproject.tomlto properly locate packages insrc/layout - Updated README.md with comprehensive CLI usage instructions and examples
- Added automated test script (
test_cli.py) for end-to-end CLI validation
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Added setuptools configuration for package discovery in src/ layout |
| README.md | Updated CLI usage examples and instructions throughout documentation |
| test_cli.py | New automated test script for CLI functionality validation |
| src/quant_research_starter/factors/volatility.py | Refactored volatility factor implementations with vectorized operations |
| src/quant_research_starter/examples/benchmark/benchmark_factors.py | New benchmark script for factor performance comparison |
| src/quant_research_starter.egg-info/SOURCES.txt | Updated package source file listing |
| src/quant_research_starter.egg-info/PKG-INFO | Updated package metadata and documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - Proper `__init__` usage. | ||
| - Min_periods set on rolling operations; trimming of initial rows to avoid | ||
| ambiguous partial-window values. | ||
| - Guarding divide-by-zero when computing beta (market variance). | ||
| - Consistent handling for single-column (single-asset) DataFrames. | ||
| - Preserves DataFrame output shape/columns and sets self._values. | ||
| - Uses ddof=0 for rolling std/var to match population estimates (consistent & | ||
| fast). |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected capitalization of 'min_periods' to 'Min_periods'.
| returns = prices.pct_change().dropna() | ||
| if returns.shape[0] < self.lookback: | ||
| raise ValueError( | ||
| f"Need at least {self.lookback} non-NA return rows to compute idio-vol" |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Use consistent terminology: 'idio-vol' should be 'idiosyncratic volatility' or 'idio_vol' for clarity.
| f"Need at least {self.lookback} non-NA return rows to compute idio-vol" | |
| f"Need at least {self.lookback} non-NA return rows to compute idiosyncratic volatility" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Removed duplicated start section from PKG-INFO
Removed typo errors
notes added
right path updated
40bc780
into
OPCODE-Open-Spring-Fest:main
📋 Summary
This PR implements a CLI entrypoint for the QuantResearch package, allowing users to install the package with
pip install .and run CLI commands viapython -m quant_research_starter.clior theqrscommand.🎯 Issue Addressed
Resolves the feature request to add
setuptools/poetry entrypoint so users can pip install . and run quant-starter or similar CLI command.Labels:
packaging,enhancement,easy🔧 Changes Made
1. Package Configuration (
pyproject.toml)pyproject.toml[tool.setuptools.packages.find]to properly locate packages insrc/layout[tool.setuptools.package-dir]to map the root package properlyqrs = "quant_research_starter.cli:cli"2. Documentation Updates (
README.md)qrscommand3. Testing Infrastructure
test_cli.pyautomated test script📦 Installation
After merging this PR, users can:
🚀 Usage
Option 1: Python Module (Recommended - Always Works)
Option 2: Direct Command (If PATH is Configured)
🧪 Testing Instructions
Automated Testing
Run the comprehensive test script:
This will:
Manual Testing
Test each command individually:
1. Test help commands:
2. Test data generation:
python -m quant_research_starter.cli generate-data -o test_data.csv -s 10 -d 365 # Verify: test_data.csv should contain 10 symbols with 365 days of data3. Test factor computation:
python -m quant_research_starter.cli compute-factors \ -d test_data.csv \ -f momentum -f value -f size -f volatility \ -o test_factors.csv # Verify: test_factors.csv should contain factor scores4. Test backtest:
python -m quant_research_starter.cli backtest \ -d test_data.csv \ -s test_factors.csv \ -o test_results.json # Verify: test_results.json and backtest_plot.png should be createdExpected Output
When running the backtest, you should see:
Verification Checklist
pip install -e .completes without errorspython -m quant_research_starter.cli --helpshows the help menugenerate-datacommand creates a CSV filecompute-factorscommand creates a CSV with factor scoresbacktestcommand creates JSON results and PNG plot📊 Example Workflow
Complete end-to-end workflow:
🐛 Known Issues / Notes
python -mmethod works regardless.📝 Files Changed
pyproject.toml- Fixed package configurationREADME.md- Updated usage documentationtest_cli.py- New automated test scriptsrc/pyproject.toml- Removed (duplicate file)✨ Benefits
🔍 Screenshots
Add screenshots of the CLI in action if desired
📚 Related Documentation
✅ Checklist
👥 Reviewers
Please pay special attention to:
pyproject.tomlissue resloved #13
Ready for Review 🚀