-
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
Merged
ayushkrtiwari
merged 21 commits into
OPCODE-Open-Spring-Fest:main
from
adityacosmos24:aditya
Oct 27, 2025
Merged
Changes from 15 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9f99632
feat: optimize idiosyncratic volatility factor using vectorized covarβ¦
adityacosmos24 af12d1a
feat: Reorder imports in benchmark_factors.py
adityacosmos24 327c549
feat: refactor volatility factors for production readiness
adityacosmos24 18fe964
remove unused import of warnings module
adityacosmos24 a4fecd2
feat: fixed errors
adityacosmos24 e6456f6
Merge branch 'aditya' of https://github.com/adityacosmos24/QuantReseaβ¦
adityacosmos24 33626dc
remove unused import in volatility.py
adityacosmos24 e0436fb
errors
adityacosmos24 485151d
Merge branch 'aditya' of https://github.com/adityacosmos24/QuantReseaβ¦
adityacosmos24 8c54477
errors
adityacosmos24 7dbdd60
fix: sort imports with Ruff
adityacosmos24 b70d514
format code with black
adityacosmos24 83f8e31
feat: added setuptools poetry entrypoint
adityacosmos24 badb979
chore: update readme with new command syntax and paths
adityacosmos24 c8c5596
Merge branch 'main' into aditya
adityacosmos24 50f717d
chore: updated gitignore
adityacosmos24 cfe2ec9
Merge branch 'aditya' of https://github.com/adityacosmos24/QuantReseaβ¦
adityacosmos24 dd8b845
docs: duplicates removed
ayushkrtiwari 77b56b6
docs: fix typo error
ayushkrtiwari e140970
docs: added description
ayushkrtiwari 2f2bf84
docs: fixed path issue
ayushkrtiwari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| #!/usr/bin/env python3 | ||
| """ | ||
| Simple test script for QuantResearch CLI | ||
| This demonstrates all the CLI functionality | ||
| """ | ||
|
|
||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| def run_command(cmd): | ||
| """Run a command and print the result""" | ||
| print(f"\n{'='*60}") | ||
| print(f"Running: {cmd}") | ||
| print('='*60) | ||
| result = subprocess.run(cmd, shell=True, capture_output=True, text=True) | ||
|
|
||
| if result.stdout: | ||
| print(result.stdout) | ||
| if result.stderr and result.returncode != 0: | ||
| print(f"ERROR: {result.stderr}") | ||
| return False | ||
|
|
||
| return result.returncode == 0 | ||
|
|
||
|
|
||
| def main(): | ||
| """Run all CLI tests""" | ||
| print("\nπ§ͺ Testing QuantResearch CLI") | ||
| print("="*60) | ||
|
|
||
| # Define test directories | ||
| test_data_dir = Path("test_data") | ||
| test_output_dir = Path("test_output") | ||
|
|
||
| # Create test directories | ||
| test_data_dir.mkdir(exist_ok=True) | ||
| test_output_dir.mkdir(exist_ok=True) | ||
|
|
||
| # Test 1: Show help | ||
| success = run_command("python -m quant_research_starter.cli --help") | ||
| if not success: | ||
| print("\nβ Test 1 FAILED: Help command") | ||
| sys.exit(1) | ||
|
|
||
| # Test 2: Generate data | ||
| success = run_command( | ||
| "python -m quant_research_starter.cli generate-data " | ||
| "-o test_data/data.csv -s 5 -d 100" | ||
| ) | ||
| if not success: | ||
| print("\nβ Test 2 FAILED: Generate data") | ||
| sys.exit(1) | ||
|
|
||
| # Test 3: Compute factors | ||
| success = run_command( | ||
| "python -m quant_research_starter.cli compute-factors " | ||
| "-d test_data/data.csv -f momentum -f value -o test_output/factors.csv" | ||
| ) | ||
| if not success: | ||
| print("\nβ Test 3 FAILED: Compute factors") | ||
| sys.exit(1) | ||
|
|
||
| # Test 4: Run backtest | ||
| success = run_command( | ||
| "python -m quant_research_starter.cli backtest " | ||
| "-d test_data/data.csv -s test_output/factors.csv " | ||
| "-o test_output/backtest_results.json" | ||
| ) | ||
| if not success: | ||
| print("\nβ Test 4 FAILED: Run backtest") | ||
| sys.exit(1) | ||
|
|
||
| # Verify output files exist | ||
| print("\nπ Checking output files...") | ||
| files_to_check = [ | ||
| test_data_dir / "data.csv", | ||
| test_output_dir / "factors.csv", | ||
| test_output_dir / "backtest_results.json", | ||
| test_output_dir / "backtest_plot.png" | ||
| ] | ||
|
|
||
| all_exist = True | ||
| for file_path in files_to_check: | ||
| if file_path.exists(): | ||
| print(f"β {file_path} exists ({file_path.stat().st_size} bytes)") | ||
| else: | ||
| print(f"β {file_path} missing!") | ||
| all_exist = False | ||
|
|
||
| if not all_exist: | ||
| print("\nβ Some output files are missing") | ||
| sys.exit(1) | ||
|
|
||
| # Summary | ||
| print("\n" + "="*60) | ||
| print("β ALL TESTS PASSED!") | ||
| print("="*60) | ||
| print(f"\nπ Test files created in:") | ||
| print(f" - {test_data_dir}/") | ||
| print(f" - {test_output_dir}/") | ||
| print("\nπ‘ You can view the results and plots in the test_output directory.") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.