This guide walks you through cloning the repository, spinning up the required infrastructure, running database migrations, and starting both the FastAPI server and the Celery worker — all on your local machine. By the end you will have a fully operational Research Layer instance and will have created your first strategy via the REST API.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/najmulhossainnj/Hedge-fund-backend/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure the following are available on your machine:- Python 3.12+ — the project targets the CPython 3.12 runtime; earlier versions are not tested.
- Docker — used to run Postgres, Redis, MinIO, and MLflow as local containers without a system-wide install of each service.
- Git — to clone the repository.
All Python dependencies — including PyTorch, vectorbt, Backtrader, and the HuggingFace Transformers stack — are declared in
requirements.txt and installed into a local virtualenv. No system-level installation of any ML framework is required.Installation
Install Python dependencies
The full dependency set — FastAPI, SQLAlchemy, Celery, MLflow, XGBoost, vectorbt, FinBERT, and more — is pinned in
requirements.txt for reproducibility.Start infrastructure services with Docker
The platform depends on four external services: PostgreSQL (primary store), Redis (cache, Celery broker and result backend), MinIO (S3-compatible artifact store), and MLflow (experiment tracking). Run each as a Docker container:
MinIO’s browser console is available at
http://localhost:9001. Log in with minioadmin / minioadmin and create two buckets manually — research-artifacts and feature-store — before running the application for the first time.Configure environment variables
Copy the example environment file and edit it to match your local setup:Open
.env and set (at minimum) the following variables — the defaults match the Docker containers started in the previous step:Apply database migrations
Alembic manages all schema changes. Generate the initial migration from the current ORM models and then apply it:On subsequent schema changes (e.g., after a
git pull), only alembic upgrade head is needed.Start the FastAPI server
--reload flag enables hot-reload on code changes — ideal for local development. For production use the Docker image instead (see the Deployment guide).Once the server is up, the health endpoint confirms everything is wired correctly:Start the Celery worker (separate terminal)
Long-running tasks — model training, hyperparameter tuning, backtest execution, and feature generation — are dispatched to Celery workers. Open a second terminal, activate the same virtualenv, and start a worker:The worker picks up tasks from Redis and runs the engine pipelines concurrently. The Dockerfile.worker image (with
--concurrency=2) can be used for containerised deployments.Your First Strategy
With the server running, create a strategy definition using a simplecurl request. The strategy object acts as the root entity that ties together features, models, backtests, and validation runs:
id as the strategy_id when creating features, backtest configs, or kicking off a model training run against this strategy’s universe.
Next Steps
Strategies
Learn how strategies tie together features, models, and backtest configurations into a coherent research pipeline.
Deployment
Deploy the API server and Celery worker as Docker containers, configure production environment variables, and connect to managed Postgres and Redis.
Plugin Architecture
Add custom feature plugins, ML model backends, signal generators, and backtest engines by implementing a base interface and registering a module.
API Reference: Strategies
Full reference for all strategy endpoints — create, read, update, delete, and promote to the Portfolio Layer.