This project is currently a work in progress. To track progress, please get updates here.
This is the backend server for the AI Hedge Fund project. It provides a simple REST API to interact with the AI Hedge Fund system, allowing you to run the hedge fund through a web interface.
This backend project is a FastAPI application that serves as the server-side component of the AI Hedge Fund system. It exposes endpoints for running the hedge fund trading system and backtester.
This backend is designed to work with a future frontend application that will allow users to interact with the AI Hedge Fund system through their browser.
- Clone the repository:
git clone https://github.com/virattt/ai-hedge-fund.git
cd ai-hedge-fund- Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 -- Install dependencies:
# From the root directory
poetry install- Set up your environment variables:
# Create .env file for your API keys (in the root directory)
cp .env.example .env- Edit the .env file to add your API keys:
# For running LLMs hosted by openai (gpt-4o, gpt-4o-mini, etc.)
OPENAI_API_KEY=your-openai-api-key
# For running LLMs hosted by groq (deepseek, llama3, etc.)
GROQ_API_KEY=your-groq-api-key
# For getting financial data to power the hedge fund
FINANCIAL_DATASETS_API_KEY=your-financial-datasets-api-keyTo run the development server:
# Navigate to the backend directory
cd app/backend
# Start the FastAPI server with uvicorn
poetry run uvicorn main:app --reloadThis will start the FastAPI server with hot-reloading enabled.
The API will be available at:
- API Endpoint: http://localhost:8000
- API Documentation: http://localhost:8000/docs
POST /hedge-fund/run: Run the AI Hedge Fund with specified parametersGET /ping: Simple endpoint to test server connectivity
app/backend/
βββ api/ # API layer (future expansion)
βββ models/ # Domain models
β βββ __init__.py
β βββ schemas.py # Pydantic schema definitions
βββ routes/ # API routes
β βββ __init__.py # Router registry
β βββ hedge_fund.py # Hedge fund endpoints
β βββ health.py # Health check endpoints
βββ services/ # Business logic
β βββ graph.py # Agent graph functionality
β βββ portfolio.py # Portfolio management
βββ __init__.py # Package initialization
βββ main.py # FastAPI application entry point
This project is for educational and research purposes only.
- Not intended for real trading or investment
- No warranties or guarantees provided
- Creator assumes no liability for financial losses
- Consult a financial advisor for investment decisions
By using this software, you agree to use it solely for learning purposes.