Someone Has Built an Open Source AI Hedge Fund, Let's Check It Out!

Create your own AI Hedge Fund with this beginner-friendly guide! Simulate trades with AI agents for stocks like AAPL and MSFT, learn trading strategies, and explore sentiment analysis—all for free!

Ashley Goolam

Ashley Goolam

26 May 2025

Someone Has Built an Open Source AI Hedge Fund, Let's Check It Out!

Have you ever wondered how Wall Street’s elite use AI to rake in millions? With the AI Hedge Fund project, you can dive into the world of automated trading without risking a dime. This open-source gem from GitHub lets you simulate a hedge fund powered by AI agents inspired by legends like Warren Buffett and Cathie Wood. I got hooked exploring its trading strategies, and in this tutorial, I’ll show you how to set up your own AI Hedge Fund, run a trading simulation with stocks like Apple and Microsoft, and peek under the hood of its brainy agents. No finance PhD needed—just curiosity and a laptop! Ready to play hedge fund manager? Let’s roll!

💡
Need to document your APIs? Try APIdog for a slick, interactive way to create and share API docs—perfect for your AI trading projects!
button

What is the AI Hedge Fund? Your Virtual Trading Team

The AI Hedge Fund is an open-source project on GitHub that simulates a hedge fund using AI agents to make trading decisions. You can think of it as a digital dream team where each agent has a specialty, mimicking real-world investing gurus. Built for educational purposes, it uses large language models (LLMs) like GPT-4o or Llama 3 to analyze financial data and simulate trades—no real money involved. Key features include:

With 2K+ stars, it’s a hit for learning how AI is shaking up hedge funds. Let’s set it to trade smarter than a Wall Street bro!

ai hedge fund architecture

Setting Up Your AI Hedge Fund Environment

Before we unleash your AI Hedge Fund, let’s prep your system. This is beginner-friendly, and I’ll guide you through each step.

1. Check System Requirements:

2. Install Poetry: Poetry manages Python dependencies. Install it:

curl -sSL https://install.python-poetry.org | python3 -

Verify with poetry --version (e.g., 1.8.0). Add Poetry to your PATH if needed: export PATH="$HOME/.local/bin:$PATH".

3. Get API Keys:

4. Create a Project Folder: Stay organized:

mkdir ai-hedge-fund
cd ai-hedge-fund

Installing the AI Hedge Fund

Now, let’s clone and set up the AI Hedge Fund project. It’s quick and sets you up for trading simulations.

1. Clone the Repository: Grab the code from GitHub:

git clone https://github.com/virattt/ai-hedge-fund.git
cd ai-hedge-fund

This pulls the project (~50MB), including agent scripts and tools.

2. Install Dependencies: Use Poetry to install required libraries:

poetry install

This sets up Python packages like pandas, requests, and LLM SDKs. It takes a minute or two.

3. Configure API Keys: Create a .env file to store your keys:

cp .env.example .env

Edit .env with a text editor (e.g., nano .env) and add:

# For running LLMs hosted by openai (gpt-4o, gpt-4o-mini, etc.)
# Get your OpenAI API key from https://platform.openai.com/
OPENAI_API_KEY=your-openai-api-key

# For running LLMs hosted by groq (deepseek, llama3, etc.)
# Get your Groq API key from https://groq.com/
GROQ_API_KEY=your-groq-api-key

# For getting financial data to power the hedge fund
# Get your Financial Datasets API key from https://financialdatasets.ai/
FINANCIAL_DATASETS_API_KEY=your-financial-datasets-api-key

Save and exit. For local LLMs, skip OpenAI and use Ollama (see below).

4. Optional: Set Up Ollama for Local LLMs: Want to run models like Llama 3 locally? Install Ollama:

curl -fsSL https://ollama.com/install.sh | sh
ollama pull llama3

Start Ollama: ollama serve. This uses ~5GB for Llama 3. Ensure Docker is installed (docker.com) if running via Docker.

ollama

Running Your AI Hedge Fund: A Trading Simulation

Let’s fire up your AI Hedge Fund and simulate trades on stocks like Apple (AAPL) and Microsoft (MSFT). We’ll see how the AI agents work together.

1. Run the Simulation: In the ai-hedge-fund folder, execute:

poetry run python src/main.py --ticker AAPL,MSFT

Or, for local LLMs:

poetry run python src/main.py --ticker AAPL,MSFT --ollama

This command:

2. What Happens?: The agents collaborate:

run tests

View Results: Check the terminal for trade decisions, probabilities, and backtest results. Logs are saved in src/logs/.

3. Running the Backtester: use the following command:

poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA

Sample Output:

backtest

You also have the option to specify the start and end dates to backtest over a specific time period.

# With Poetry:
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA --start-date 2024-01-01 --end-date 2024-03-01

# With Docker (on Linux/Mac):
./run.sh --ticker AAPL,MSFT,NVDA --start-date 2024-01-01 --end-date 2024-03-01 backtest

# With Docker (on Windows):
run.bat --ticker AAPL,MSFT,NVDA --start-date 2024-01-01 --end-date 2024-03-01 backtest
How to Download and Use Ollama to Run LLMs Locally
The world of Artificial Intelligence (AI) is evolving at breakneck speed, with Large Language Models (LLMs) like ChatGPT, Claude, and Gemini capturing imaginations worldwide. These powerful tools can write code, draft emails, answer complex questions, and even generate creative content. However, usi…

Exploring AI Hedge Fund Features

Your AI Hedge Fund is more than a script—it’s a learning playground. Here’s how to dig deeper:

I tweaked the Technicals Agent to focus on RSI (Relative Strength Index) and saw sharper buy signals—super fun to experiment!

Documenting Your APIs with APIdog

Building on your AI Hedge Fund and want to document its APIs for others? APIdog is a top-notch tool for creating interactive API docs. Its sleek design and self-hosting options make it perfect for sharing your trading system’s endpoints—give it a spin!

apidog documentation

Troubleshooting and Tips

Why Use an AI Hedge Fund?

This AI Hedge Fund project is a goldmine for learning:

It’s like a finance lab where you’re the mad scientist. I loved seeing the Sentiment Agent catch bullish news on MSFT and adjust trades!

Final Thoughts: Become an AI Trading Pro

Congrats—you’ve launched your own AI Hedge Fund and simulated trades like a Wall Street wizard! From setting up AI agents to running trades on AAPL and MSFT, you’re now part of the AI investing revolution. Experiment with new stocks, tweak agents, or document your APIs with APIdog. Share your AI Hedge Fund tweaks on X or GitHub—I’m pumped to see your trading empire grow! Happy simulating!

button

Explore more

What is Doxygen and How to Download and Use It

What is Doxygen and How to Download and Use It

Discover what Doxygen is and how to download, install, and use it to auto-generate C/C++ code documentation. This tutorial covers setup and tips!

16 June 2025

How to Create Apple's Liquid Glass Effects in React

How to Create Apple's Liquid Glass Effects in React

Apple has always been at the forefront of user interface design, and one of their most captivating recent effects is the "liquid glass" look. This effect, characterized by its fluid, jelly-like appearance, adds a layer of depth and interactivity to UI elements. It's a subtle yet powerful way to make your applications feel more dynamic and engaging. In this article, we'll explore how to recreate this stunning effect in your React applications using the liquid-glass-react library. This library p

14 June 2025

What is Shadcn/UI? Beginner's Tutorial to Get Started

What is Shadcn/UI? Beginner's Tutorial to Get Started

For web developers, the quest for the perfect UI toolkit is a constant endeavor. For years, React developers have relied on traditional component libraries like Material-UI (MUI), Ant Design, and Chakra UI. These libraries offer a wealth of pre-built components, promising to accelerate development. However, they often come with a trade-off: a lack of control, style overrides that feel like a battle, and bloated bundle sizes. Enter Shadcn UI, a paradigm-shifting approach that has taken the React

14 June 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs