Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1cab27f
Refactor into full-stack app with FastAPI, React, and Docker
google-labs-jules[bot] Jan 17, 2026
2ecdae5
Merge pull request #1 from Ramkumar78/feature-full-stack-refactor-976…
Ramkumar78 Jan 17, 2026
3f40de6
Finalize Docker setup, verify frontend, and enhance tests
google-labs-jules[bot] Jan 17, 2026
abad706
Merge branch 'main' into jules-9763559592349294111-f09d91ca
google-labs-jules[bot] Jan 17, 2026
eca454a
Merge pull request #3 from Ramkumar78/feature/full-stack-refactor-976…
Ramkumar78 Jan 17, 2026
c316b01
Merge branch 'main' into feature-full-stack-refactor-9763559592349294111
Ramkumar78 Jan 17, 2026
5772889
Merge pull request #2 from Ramkumar78/feature-full-stack-refactor-976…
Ramkumar78 Jan 17, 2026
cf116af
Resolve unit test failures and add security hardening for FE and BE
google-labs-jules[bot] Jan 17, 2026
975e4fd
Merge pull request #4 from Ramkumar78/security-hardening-tests-148761…
Ramkumar78 Jan 17, 2026
e7a9a3d
Update README with Docker access instructions
google-labs-jules[bot] Jan 17, 2026
b873d16
Merge pull request #5 from Ramkumar78/docs-readme-docker-access-34277…
Ramkumar78 Jan 17, 2026
7a8e546
Fix LightGBM 500 error by adding libgomp1 and add CI test workflow
google-labs-jules[bot] Jan 17, 2026
1453733
Merge pull request #6 from Ramkumar78/docker-fix-libgomp1-67176643271…
Ramkumar78 Jan 17, 2026
98484c2
Fix unit tests and Hurst exponent calculation bug
google-labs-jules[bot] Jan 17, 2026
35fc246
Merge pull request #7 from Ramkumar78/fix-unit-tests-hurst-1002829371…
Ramkumar78 Jan 17, 2026
eb2706b
Update UI and Backend to support multiple models
google-labs-jules[bot] Jan 18, 2026
b535365
Merge pull request #8 from Ramkumar78/feature-multi-model-ui-update-8…
Ramkumar78 Jan 18, 2026
c89471a
Fix OSError in model training by ensuring output directories exist
google-labs-jules[bot] Jan 18, 2026
e5b5ab1
Merge pull request #9 from Ramkumar78/fix-training-output-dir-error-1…
Ramkumar78 Jan 18, 2026
a62381f
Fix 404 error on metrics endpoint for XGBoost model
google-labs-jules[bot] Jan 18, 2026
06ee013
Merge pull request #10 from Ramkumar78/fix-xgboost-metrics-404-293823…
Ramkumar78 Jan 18, 2026
06f35f8
Fix pytest ModuleNotFoundError by making app and tests packages
google-labs-jules[bot] Jan 18, 2026
65bcac0
Merge pull request #11 from Ramkumar78/fix-pytest-import-error-517251…
Ramkumar78 Jan 18, 2026
6444fee
Add CI coverage workflow and configuration
google-labs-jules[bot] Jan 18, 2026
deb98d6
Merge pull request #12 from Ramkumar78/ci-coverage-workflow-364278867…
Ramkumar78 Jan 18, 2026
3a78f0a
Fix CatBoost prediction error and refactor Ensemble model for correct…
google-labs-jules[bot] Jan 18, 2026
fbc40c3
Merge pull request #13 from Ramkumar78/fix-catboost-ensemble-predicti…
Ramkumar78 Jan 18, 2026
c115f19
feat: Add custom asset training pipeline and UI
google-labs-jules[bot] Jan 18, 2026
f85c21a
Merge branch 'main' into custom-asset-training-2262982718160639686
Ramkumar78 Jan 18, 2026
002fb43
Implement comprehensive testing framework for Backend and Frontend
google-labs-jules[bot] Jan 18, 2026
702321d
Merge pull request #15 from Ramkumar78/unit-test-framework-implementa…
Ramkumar78 Jan 18, 2026
86aaff7
Merge pull request #14 from Ramkumar78/custom-asset-training-22629827…
Ramkumar78 Jan 18, 2026
16f4ce9
Migrate all unit tests to BDD framework using pytest-bdd
google-labs-jules[bot] Jan 18, 2026
177b4dd
Merge pull request #16 from Ramkumar78/bdd-test-migration-58923131904…
Ramkumar78 Jan 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
relative_files = True
omit =
tests/*
*/__init__.py
67 changes: 67 additions & 0 deletions .github/workflows/ci-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI Coverage

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

permissions:
contents: write
pull-requests: write

jobs:
test-and-coverage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"] # Aligns with your project's requirement

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

# CRITICAL STEP: Install System Dependencies for TA-Lib & LightGBM
# This mimics the logic inside your Dockerfile but runs on the GitHub Action runner
- name: Install System Dependencies (TA-Lib & OpenMP)
run: |
sudo apt-get update
sudo apt-get install -y libgomp1 build-essential wget
# Download and build TA-Lib from source
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
sudo make install

- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install testing & security tools (from optionsauditor ci.yml)
pip install pytest pytest-cov bandit pip-audit pytest-rerunfailures
# Install project requirements
pip install -r requirements.txt

- name: Security Scan - Python Static Analysis (Bandit)
# Scans 'app' directory, skips B104 (binding to all interfaces)
run: bandit -r app -ll -s B104

- name: Security Scan - Python Dependencies (pip-audit)
run: pip-audit

- name: Run tests with Coverage
# Targets 'app' folder for coverage, runs tests in 'tests' folder
run: pytest --cov=app --cov-report=xml --cov-report=term tests/

- name: Coverage Badge
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76 changes: 76 additions & 0 deletions .github/workflows/docker-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Docker Build and Training Pipeline Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build Docker image
run: docker build -t spy-backend .

- name: Run Docker container
run: |
docker run -d --name spy-backend -p 8000:8000 spy-backend
sleep 10 # Wait for the server to start

- name: Wait for API to be ready
run: |
# Retry loop to check if the API is responding
for i in {1..30}; do
if curl -s http://localhost:8000/docs > /dev/null; then
echo "API is up!"
exit 0
fi
echo "Waiting for API..."
sleep 2
done
echo "API failed to start."
docker logs spy-backend
exit 1

- name: Refresh Data
run: |
response=$(curl -s -w "%{http_code}" -X POST http://localhost:8000/data/refresh)
http_code=${response: -3}
echo "Response: $response"
if [ "$http_code" -ne 200 ]; then
echo "Data refresh failed with status $http_code"
docker logs spy-backend
exit 1
fi

- name: Generate Features
run: |
response=$(curl -s -w "%{http_code}" -X POST http://localhost:8000/features/generate)
http_code=${response: -3}
echo "Response: $response"
if [ "$http_code" -ne 200 ]; then
echo "Feature generation failed with status $http_code"
docker logs spy-backend
exit 1
fi

- name: Train LightGBM Model
run: |
response=$(curl -s -w "%{http_code}" -X POST http://localhost:8000/train/lightgbm)
http_code=${response: -3}
echo "Response: $response"
if [ "$http_code" -ne 200 ]; then
echo "LightGBM training failed with status $http_code"
docker logs spy-backend
exit 1
fi

- name: Stop Docker container
if: always()
run: docker stop spy-backend
49 changes: 49 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install TA-Lib
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib
./configure --prefix=/usr
make
sudo make install
cd ..
pip install -r requirements.txt
pip install pytest httpx

- name: Run tests
run: |
pytest tests/

- name: Linting
run: |
pip install flake8
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Security Scan
run: |
pip install bandit
bandit -r app/
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Use an official Python runtime as a parent image
FROM python:3.12-slim

# Set work directory
WORKDIR /app

# Install system dependencies (needed for TA-Lib and other libraries)
# build-essential and python3-dev for compiling C extensions
# curl for healthchecks
RUN apt-get update && apt-get install -y \
build-essential \
python3-dev \
curl \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*

# Install TA-Lib C library
# Download and install TA-Lib C library
RUN curl -L http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz -o ta-lib-0.4.0-src.tar.gz && \
tar -xzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib && \
./configure --prefix=/usr && \
make && \
make install && \
cd .. && \
rm -rf ta-lib ta-lib-0.4.0-src.tar.gz

# Copy requirements file
COPY requirements.txt .

# Install Python dependencies
# Update requirements to not use ta-lib-binary if it fails on linux, we use standard ta-lib since we installed C lib
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application
COPY . .

# Create output directory for persistence
RUN mkdir -p output/models/lightgbm

# Expose port
EXPOSE 8000

# Run the API
CMD ["uvicorn", "app.api.main:app", "--host", "0.0.0.0", "--port", "8000"]
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,37 @@ pip install xgboost lightgbm catboost
pip install scikit-learn matplotlib seaborn
```

### 2. Download Data
### 2. Docker Deployment

The application works best when run as a full-stack Dockerized application using Docker Compose. This automatically builds and starts both the backend API and the frontend dashboard.

```bash
# Build and run the application
docker-compose up --build
```

#### Accessing the Application

Once the containers are running (you will see logs indicating the server started), open your web browser and navigate to:

- **Frontend Dashboard**: http://localhost:3000
- This is the main interface where you can view predictions, charts, and trigger data updates.
- **Backend API Documentation**: http://localhost:8000/docs
- Interactive Swagger UI to test API endpoints directly.

> **Note**: If port 3000 or 8000 is already in use on your machine, you may need to modify the port mapping in `docker-compose.yml`.

### 3. Download Data (Manual / Docker)

You can trigger data download from the dashboard UI or manually:

```bash
# Download OHLCV data for SPY, VIX, TLT, DXY, GLD (2015-present)
python download_data.py
# If running locally:
python -m app.core.download_data

# If running via API:
curl -X POST http://localhost:8000/data/refresh
```

See [download_data.md](download_data.md) for details.
Expand Down
Empty file added app/__init__.py
Empty file.
Loading