Small project that implements a pairs-trading backtester with a FastAPI backend and a Vite + React frontend.
backend/— FastAPI app, models (Kalman filter, backtester, metrics), and tests. 🐍frontend/— Vite + React UI (Tailwind CSS) served by Nginx in Docker. ⚛️infra/—docker-compose.ymlto run the full stack locally.
This repository includes a small Docker Compose setup that builds and runs the backend and frontend containers.
Requirements: Docker and docker-compose installed on your machine.
From the repository root:
cd infra
docker-compose up --build- Backend will be available at
http://localhost:8000(API path/api/v1). - Frontend will be served at
http://localhost:3000and proxies API calls to the backend.
Stop the stack with:
docker-compose down- Create and activate a Python virtual environment and install the backend requirements:
python -m venv .venv
source .venv/bin/activate
pip install -r backend/requirements.txt- Run the FastAPI app (from
backend/):
uvicorn app.main:app --reload --port 8000- Install dependencies and run the dev server (from
frontend/web):
cd frontend/web
npm install
npm run dev- When running the frontend dev server, set
VITE_API_BASEto point to the backend (for examplehttp://localhost:8000/api/v1) if needed.
- Backend tests live in
backend/app/tests. Run them withpytestfrom the repo root (or inside the backend venv):
pytest backend/app/tests -qSee LICENSE.