Skip to content

Commit 5360531

Browse files
committed
docs: legacy, streamlit fixed
1 parent c14e6c2 commit 5360531

File tree

19 files changed

+573
-944
lines changed

19 files changed

+573
-944
lines changed

README.md

Lines changed: 324 additions & 227 deletions
Large diffs are not rendered by default.

legacy/streamlit/README.md

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
# QuantResearchStarter
2+
3+
[![Python Version](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
4+
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
5+
[![CI](https://github.com/username/QuantResearchStarter/actions/workflows/ci.yml/badge.svg)](https://github.com/username/QuantResearchStarter/actions)
6+
7+
A modular, open-source quantitative research and backtesting framework built for clarity, reproducibility, and extensibility. Ideal for researchers, students, and engineers building and testing systematic strategies.
8+
9+
---
10+
11+
## Why this project
12+
13+
QuantResearchStarter aims to provide a clean, well-documented starting point for quantitative research and backtesting. It focuses on:
14+
15+
* **Readability**: idiomatic Python, type hints, and small modules you can read and change quickly.
16+
* **Testability**: deterministic vectorized backtests with unit tests and CI.
17+
* **Extensibility**: plug-in friendly factor & data adapters so you can try new ideas fast.
18+
19+
---
20+
21+
## Key features
22+
23+
* **Data management** — download market data or generate synthetic price series for experiments.
24+
* **Factor library** — example implementations of momentum, value, size, and volatility factors.
25+
* **Vectorized backtesting engine** — supports transaction costs, slippage, portfolio constraints, and configurable rebalancing frequencies (daily, weekly, monthly).
26+
* **Risk & performance analytics** — returns, drawdowns, Sharpe, turnover, and other risk metrics.
27+
* **CLI & scripts** — small tools to generate data, compute factors, and run backtests from the terminal.
28+
* **Production-ready utilities** — type hints, tests, continuous integration, and documentation scaffolding.
29+
30+
---
31+
32+
## Quick start
33+
34+
### Requirements
35+
36+
* Python 3.10+
37+
* pip
38+
39+
### Install locally
40+
41+
```bash
42+
# Clone the repository
43+
git clone https://github.com/username/QuantResearchStarter.git
44+
cd QuantResearchStarter
45+
46+
# Install package in development mode
47+
pip install -e .
48+
49+
# Install development dependencies (tests, linters, docs)
50+
pip install -e ".[dev]"
51+
52+
# Optional UI dependencies
53+
pip install streamlit plotly
54+
```
55+
56+
### Quick CLI Usage
57+
58+
After installation, you can use the CLI in two ways:
59+
60+
**Option 1: Direct command (if PATH is configured)**
61+
```bash
62+
qrs --help
63+
# generate synthetic sample price series
64+
qrs generate-data -o data_sample/sample_prices.csv -s 5 -d 365
65+
# compute example factors
66+
qrs compute-factors -d data_sample/sample_prices.csv -f momentum -f value -o output/factors.csv
67+
# run a backtest
68+
qrs backtest -d data_sample/sample_prices.csv -s output/factors.csv -o output/backtest_results.json
69+
```
70+
71+
**Option 2: Python module (always works)**
72+
```bash
73+
python -m quant_research_starter.cli --help
74+
python -m quant_research_starter.cli generate-data -o data_sample/sample_prices.csv -s 5 -d 365
75+
python -m quant_research_starter.cli compute-factors -d data_sample/sample_prices.csv -f momentum -f value
76+
python -m quant_research_starter.cli backtest -d data_sample/sample_prices.csv -s output/factors.csv -o output/backtest_results.json
77+
```
78+
79+
### Demo (one-line)
80+
81+
```bash
82+
make demo
83+
```
84+
85+
### Step-by-step demo
86+
87+
```bash
88+
# generate synthetic sample price series
89+
python -m quant_research_starter.cli generate-data -o data_sample/sample_prices.csv -s 5 -d 365
90+
91+
# compute example factors
92+
python -m quant_research_starter.cli compute-factors -d data_sample/sample_prices.csv -f momentum -f value -o output/factors.csv
93+
94+
# run a backtest
95+
python -m quant_research_starter.cli backtest -d data_sample/sample_prices.csv -s output/factors.csv -o output/backtest_results.json
96+
97+
# DISCLAIMER: OLD VERSION
98+
# optional: start the Streamlit dashboard, if on main stream
99+
streamlit run src/quant_research_starter/dashboard/streamlit_app.py
100+
# NEW VERSION: if streamlit is in legacy folder
101+
streamlit run legacy/streamlit/streamlit_app.py
102+
```
103+
104+
---
105+
106+
## Example: small strategy (concept)
107+
108+
```python
109+
from quant_research_starter.backtest import Backtester
110+
from quant_research_starter.data import load_prices
111+
from quant_research_starter.factors import Momentum
112+
113+
prices = load_prices("data_sample/sample_prices.csv")
114+
factor = Momentum(window=63)
115+
scores = factor.compute(prices)
116+
117+
bt = Backtester(prices, signals=scores, capital=1_000_000)
118+
results = bt.run()
119+
print(results.performance.summary())
120+
```
121+
122+
### Rebalancing Frequency
123+
124+
The backtester supports different rebalancing frequencies to match your strategy needs:
125+
126+
```python
127+
from quant_research_starter.backtest import VectorizedBacktest
128+
# Daily rebalancing (default)
129+
bt_daily = VectorizedBacktest(prices, signals, rebalance_freq="D")
130+
131+
# Weekly rebalancing (reduces turnover and transaction costs)
132+
bt_weekly = VectorizedBacktest(prices, signals, rebalance_freq="W")
133+
134+
# Monthly rebalancing (lowest turnover)
135+
bt_monthly = VectorizedBacktest(prices, signals, rebalance_freq="M")
136+
137+
results = bt_monthly.run()
138+
```
139+
140+
Supported frequencies:
141+
- `"D"`: Daily rebalancing (default)
142+
- `"W"`: Weekly rebalancing (rebalances when the week changes)
143+
- `"M"`: Monthly rebalancing (rebalances when the month changes)
144+
145+
> The code above is illustrative—see `examples/` for fully working notebooks and scripts.
146+
147+
---
148+
149+
## CLI reference
150+
151+
Run `python -m quant_research_starter.cli --help` or `python -m quant_research_starter.cli <command> --help` for full usage. Main commands include:
152+
153+
* `python -m quant_research_starter.cli generate-data` — create synthetic price series or download data from adapters
154+
* `python -m quant_research_starter.cli compute-factors` — calculate and export factor scores
155+
* `python -m quant_research_starter.cli backtest` — run the vectorized backtest and export results
156+
157+
**Note:** If you have the `qrs` command in your PATH, you can use `qrs` instead of `python -m quant_research_starter.cli`.
158+
159+
---
160+
161+
## Project structure (overview)
162+
163+
```
164+
QuantResearchStarter/
165+
├─ src/quant_research_starter/
166+
│ ├─ data/ # data loaders & adapters
167+
│ ├─ factors/ # factor implementations
168+
│ ├─ backtest/ # backtester & portfolio logic
169+
│ ├─ analytics/ # performance and risk metrics
170+
│ ├─ cli/ # command line entry points
171+
│ └─ dashboard/ # optional Streamlit dashboard
172+
├─ examples/ # runnable notebooks & example strategies
173+
├─ tests/ # unit + integration tests
174+
└─ docs/ # documentation source
175+
```
176+
177+
---
178+
179+
## Tests & CI
180+
181+
We include unit tests and a CI workflow (GitHub Actions). Run tests locally with:
182+
183+
```bash
184+
pytest -q
185+
```
186+
187+
The CI pipeline runs linting, unit tests, and builds docs on push/PR.
188+
189+
---
190+
191+
## Contributing
192+
193+
Contributions are very welcome. Please follow these steps:
194+
195+
1. Fork the repository
196+
2. Create a feature branch
197+
3. Add tests for new behavior
198+
4. Open a pull request with a clear description and rationale
199+
200+
Please review `CONTRIBUTING.md` and the `CODE_OF_CONDUCT.md` before submitting.
201+
202+
---
203+
204+
## AI policy — short & practical
205+
206+
**Yes — you are allowed to use AI tools** (ChatGPT, Copilot, Codeium, etc.) to help develop, prototype, or document code in this repository.
207+
208+
A few friendly guidelines:
209+
210+
* **Be transparent** when a contribution is substantially generated by an AI assistant — add a short note in the PR or commit message (e.g., "Generated with ChatGPT; reviewed and adapted by <your-name>").
211+
* **Review and test** all AI-generated code. Treat it as a helpful draft, not final production-quality code.
212+
* **Follow licensing** and attribution rules for any external snippets the AI suggests. Don’t paste large verbatim copyrighted material.
213+
* **Security & correctness**: double-check numerical logic, data handling, and anything that affects trading decisions.
214+
215+
This policy is intentionally permissive: we want the community to move fast while keeping quality and safety in mind.
216+
217+
---
218+
219+
## License
220+
221+
This project is licensed under the MIT License — see the `LICENSE` file for details.
222+
223+
---
224+
225+
## Acknowledgements
226+
227+
Built with inspiration from open-source quant libraries and the research community. If you use this project in papers or public work, a short citation or mention is appreciated.

src/quant_research_starter/frontend/cauweb/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
"@tailwindcss/vite": "^4.1.17",
1313
"chart.js": "^4.5.1",
1414
"lucide-react": "^0.263.1",
15-
"react": "^18.2.0",
15+
"react": "^19.2.0",
1616
"react-chartjs-2": "^5.3.1",
17-
"react-dom": "^18.2.0",
18-
"react-router-dom": "^6.8.0"
17+
"react-dom": "^19.2.0",
18+
"react-router-dom": "^6.30.1"
1919
},
2020
"devDependencies": {
2121
"@tailwindcss/cli": "^4.1.17",
2222
"@tailwindcss/postcss": "^4.1.17",
2323
"@types/react": "^18.3.26",
2424
"@types/react-dom": "^18.3.7",
2525
"@vitejs/plugin-react": "^4.7.0",
26-
"autoprefixer": "^10.4.21",
26+
"autoprefixer": "^10.4.22",
2727
"postcss": "^8.5.6",
2828
"tailwindcss": "^4.1.17",
2929
"typescript": "^5.9.3",
30-
"vite": "^5.0.0"
30+
"vite": "^5.4.21"
3131
}
3232
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[project]
2+
name = "quant-research-frontend"
3+
version = "0.1.0"
4+
description = ""
5+
authors = [
6+
{name = "AYUSH KUMAR TIWARI",email = "[email protected]"}
7+
]
8+
readme = "README.md"
9+
requires-python = ">=3.12"
10+
dependencies = [
11+
]
12+
13+
14+
[build-system]
15+
requires = ["poetry-core>=2.0.0,<3.0.0"]
16+
build-backend = "poetry.core.masonry.api"

src/quant_research_starter/frontend/cauweb/src/main.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom/client';
3+
34
import { App } from './App';
45
import './styles/globals.css'; // Make sure this import exists
56
import './index.css';

src/quant_research_starter/frontend/metrics/package.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/quant_research_starter/frontend/metrics/postcss.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)