Skip to content

Commit 30ff0ad

Browse files
committed
Quant Research Demo Website
0 parents  commit 30ff0ad

File tree

93 files changed

+4979
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+4979
-0
lines changed

.coverage

52 KB
Binary file not shown.

.github/ISSUE_TEMPLATE/good

Whitespace-only changes.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: "Good First Issue: Add Bollinger Bands factor"
3+
about: Implement a simple Bollinger Bands factor example
4+
labels: good-first-issue
5+
---
6+
7+
### Summary
8+
Add a new example factor `BollingerBandsFactor` under `src/quant_research_starter/factors/`.
9+
10+
### Tasks
11+
- Create `bollinger.py` with a factor computing z-score of price vs. rolling band.
12+
- Export in `factors/__init__.py`.
13+
- Add unit tests in `tests/test_factors.py`.
14+
- Update README with a short mention.
15+
16+
### Definition of Done
17+
- `pytest` passes and coverage unchanged or better.
18+
19+
---
20+
name: "Good First Issue: Add New Simple Factor"
21+
title: "Factor Implementation: [Your Factor Name]"
22+
labels: ["good-first-issue", "enhancement", "factors"]
23+
assignees: []
24+
---
25+
26+
## Description
27+
Add a new factor implementation to the factors module. This is a great first issue to understand how factors work in the framework.
28+
29+
## Suggested Factor
30+
**Factor Name**: Liquidity Factor
31+
**Description**: Measure trading liquidity using volume-based metrics
32+
33+
## Implementation Steps
34+
1. Create new file `src/quant_research_starter/factors/liquidity.py`
35+
2. Implement a `LiquidityFactor` class inheriting from `Factor`
36+
3. Use trading volume (or synthetic volume) to compute liquidity measures
37+
4. Add basic tests in `tests/test_factors.py`
38+
5. Update `src/quant_research_starter/factors/__init__.py` to export the new factor
39+
40+
## Code Example
41+
```python
42+
class LiquidityFactor(Factor):
43+
def compute(self, prices: pd.DataFrame, volumes: pd.DataFrame = None) -> pd.DataFrame:
44+
# Your implementation here
45+
# Suggested: Use dollar volume or turnover as liquidity proxy
46+
pass
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: "Good First Issue: Add weekly/monthly rebalancing option"
3+
about: Add `rebalance_freq` support to `VectorizedBacktest`
4+
labels: good-first-issue
5+
---
6+
7+
### Summary
8+
Teach `VectorizedBacktest` to rebalance weekly or monthly via a `rebalance_freq` parameter.
9+
10+
### Tasks
11+
- Update `_should_rebalance` to respect `W` and `M` frequencies.
12+
- Add tests in `tests/test_backtest.py`.
13+
- Document in README.
14+
15+
### Definition of Done
16+
- Tests pass; daily default unchanged.
17+
18+
19+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: "Good First Issue: Add Plotly PnL chart to CLI"
3+
about: Enhance CLI to output interactive Plotly HTML chart
4+
labels: good-first-issue
5+
---
6+
7+
### Summary
8+
Modify CLI backtest command to also save a Plotly HTML chart for PnL.
9+
10+
### Tasks
11+
- Use Plotly to create an interactive equity curve.
12+
- Save to `output/backtest_plot.html`.
13+
- Add a unit smoke test that the file is created.
14+
15+
### Definition of Done
16+
- CLI still supports Matplotlib PNG; Plotly HTML added.
17+
18+
19+

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### Summary
2+
Describe the change and why it’s needed.
3+
4+
### Changes
5+
-
6+
7+
### Testing
8+
- [ ] `pytest` passes locally
9+
- [ ] Linting passes (`ruff`, `black`)
10+
11+
### Screenshots (optional)
12+
13+
### Related Issues
14+
Fixes #
15+
16+
17+

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [3.10, 3.11, 3.12]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e ".[dev]"
28+
29+
- name: Lint with ruff
30+
run: |
31+
ruff check src/ tests/
32+
33+
- name: Check formatting with black
34+
run: |
35+
black --check src/ tests/
36+
37+
- name: Run tests
38+
run: |
39+
pytest --cov=src/quant_research_starter --cov-report=xml
40+
41+
- name: Upload coverage to Codecov
42+
uses: codecov/codecov-action@v3
43+
with:
44+
file: ./coverage.xml
45+
flags: unittests
46+
name: codecov-umbrella
47+
48+
build-docker:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- name: Build Docker image
54+
run: |
55+
docker build -t quant-research-starter:latest .

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 23.7.0
4+
hooks:
5+
- id: black
6+
args: ["--line-length=88"]
7+
- repo: https://github.com/charliermarsh/ruff-pre-commit
8+
rev: v0.0.280
9+
hooks:
10+
- id: ruff
11+
args: ["--fix"]
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.4.0
14+
hooks:
15+
- id: end-of-file-fixer
16+
- id: trailing-whitespace
17+
18+
19+

CODE_OF_CONDUCT.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
### Code of Conduct
2+
3+
We are committed to fostering a welcoming and inclusive community.
4+
5+
#### Our Standards
6+
- Be respectful and considerate.
7+
- Assume good intent; seek to understand.
8+
- Accept constructive feedback gracefully.
9+
- Focus on what is best for the community.
10+
11+
#### Unacceptable Behavior
12+
- Harassment, discrimination, or demeaning comments.
13+
- Trolling, personal attacks, or political flame wars.
14+
- Publishing others' private information without consent.
15+
16+
#### Enforcement
17+
- Report incidents to the maintainers via `SECURITY.md` contact or GitHub.
18+
- Maintainers may take appropriate action, including warnings or bans.
19+
20+
Adapted from the Contributor Covenant.
21+
22+
23+

CONTRIBUTING.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
### Contributing Guidelines
2+
3+
Thank you for considering contributing to QuantResearchStarter!
4+
5+
#### Getting Started
6+
- Fork the repo and create your branch from `main`.
7+
- Python 3.10+ is required.
8+
- Install in editable mode: `pip install -e .[dev]`.
9+
- Run tests and linters locally: `make test` and `make lint`.
10+
11+
#### Development Workflow
12+
- Create a focused branch: `feature/<short-name>` or `fix/<short-name>`.
13+
- Write unit tests for new features and bug fixes.
14+
- Ensure `ruff` and `black` pass.
15+
- Update documentation and docstrings as needed.
16+
17+
#### Pull Requests
18+
- Fill in the PR template.
19+
- Keep PRs small and focused.
20+
- Include before/after behavior when applicable.
21+
- Link related issues.
22+
23+
#### Good First Issues
24+
- Look for issues labeled `good-first-issue` or `help-wanted`.
25+
- Comment on an issue to get assigned.
26+
27+
#### Code Style
28+
- Follow PEP8 with `ruff` and `black` formatting.
29+
- Use type hints for public functions.
30+
- Keep functions small and readable.
31+
32+
#### Testing
33+
- Tests live under `tests/` and run with `pytest`.
34+
- Aim for ~70% coverage of core modules.
35+
36+
#### Commit Messages
37+
- Use imperative tone: "Add X", "Fix Y".
38+
- Reference issues: `Fixes #123`.
39+
40+
#### Security
41+
- See `SECURITY.md` to report vulnerabilities.
42+
43+
We appreciate your contributions!
44+
45+
46+

0 commit comments

Comments
 (0)