File size: 3,975 Bytes
f5ee5c7
 
f19c2fe
f5ee5c7
f19c2fe
 
 
 
 
 
 
 
 
 
 
 
 
f5ee5c7
 
 
 
 
 
f19c2fe
 
f5ee5c7
f19c2fe
f5ee5c7
 
042cd1d
 
 
f19c2fe
f5ee5c7
 
f19c2fe
f5ee5c7
 
f19c2fe
f5ee5c7
 
 
f19c2fe
 
 
 
 
 
 
 
 
 
f5ee5c7
 
 
 
 
 
 
 
f19c2fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f5ee5c7
 
 
f19c2fe
f5ee5c7
f19c2fe
 
 
 
 
 
 
f5ee5c7
f19c2fe
 
 
 
 
 
f5ee5c7
 
 
f19c2fe
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Contributing to QuantIQ

Thank you for your interest in contributing to QuantIQ! We welcome developers of all backgrounds to help us build a premium quantitative research terminal.

This document details the project architecture, developer setup, code guidelines, and deployment workflows.

---

## πŸ“‚ Project Structure Map

*   `backend/` β€” FastAPI core server. Exposes GraphQL/REST APIs and WebSocket channels.
*   `frontend/` β€” React / TypeScript client built with Vite and Tailwind CSS.
*   `worker/` β€” Tick ingestion service. Periodically polls Yahoo Finance and dispatches ticks to Redpanda Cloud.
*   `alembic/` β€” Database migrations for watchlists, strategy records, and user targets.
*   `assets/` β€” UI mockups, database schemas, and documentation images.
*   `train.py` β€” Offline model training script that generates indicator features and exports `model.onnx`.
*   `deploy_hf.ps1` β€” Automated deployment pipeline script for Hugging Face Spaces.

---

## πŸ› οΈ Local Development Setup

### 1. Ingest Ingestion & Backend Setup
Prerequisites: Make sure you have [uv](https://astral.sh/uv) and [Docker Desktop](https://www.docker.com/) installed.

```bash
# Sync python virtual environment and lock file
uv sync

# Copy the environment template and configure keys
cp .env.example .env

# Spin up local PostgreSQL (NeonDB replica) and Redis containers
docker-compose up -d

# Execute database migrations
uv run alembic upgrade head

# Start the local FastAPI server
uv run uvicorn backend.app.main:app --reload
```

### 2. Start Background Services
```bash
# Start the ingestion worker (fetches stock ticks every 5 seconds)
uv run python worker/worker.py

# Start Celery worker with beat enabled (logs ML predictions and outcomes)
uv run celery -A backend.app.services.celery_app worker --beat --loglevel=info
```

### 3. Frontend Dashboard Setup
```bash
cd frontend
npm install
npm run dev
```

---

## πŸš€ Deployment Workflow (Hugging Face Spaces & GitHub)

Hugging Face Spaces hosting requires a custom metadata block (YAML frontmatter) at the very top of `README.md`. To keep the GitHub repository clean while pushing updates to Hugging Face, **you must use the automated deployment script:**

### Hugging Face Deployment Procedure:
1. Ensure your changes are committed on your local branch.
2. In PowerShell, execute the deployment script from the project root:
   ```powershell
   .\deploy_hf.ps1
   ```
3. **What this script does automatically:**
   * Prepends the YAML frontmatter configuration block to `README.md`.
   * Commits the change (`chore: add HF Space config for deployment`).
   * Pushes the commit to the Hugging Face space repository (`git push hf main`).
   * Automatically restores the clean `README.md` file back to its default state.
   * Commits the cleanup (`chore: restore clean README for GitHub`).
4. Finally, push your clean branch changes directly to GitHub:
   ```bash
   git push origin main
   ```

---

## 🧼 Code Quality & Style Guidelines

To keep the pipeline green, verify the following standards locally before opening a pull request:

### 🐍 Python (Backend / Worker)
*   **Linter & Formatter**: We use `ruff`. Run the check locally:
    ```bash
    uv run ruff check .
    ```

### βš›οΈ TypeScript & React (Frontend)
*   **Formatters**: Ensure typescript compiling (`tsc`) and Vite bundling compile cleanly:
    ```bash
    cd frontend
    npm run build
    ```

---

## 🎯 Open Development Goals

Check out our active GitHub Issues page or pick one of these tasks to start:
1. **[Backend] Model Metadata Endpoint**: Expose `GET /api/v1/ml/metadata` to parse and return properties from the loaded `model.onnx`.
2. **[Frontend] RSI Reference Boundaries**: Use the Lightweight Charts API to draw Overbought (70) and Oversold (30) reference price lines.
3. **[Backend] Discord/Slack webhook price alerts**: Build a dispatcher service sending real-time stock crossings directly to webhook endpoints.