Deploy an AI-powered hedge fund on Render in one click. A team of ~19 famous-investor agents — Warren Buffett, Charlie Munger, Michael Burry, Cathie Wood, and more — analyze the tickers you choose and produce trading signals and a final portfolio decision. You get a FastAPI backend, a React web UI, and a managed PostgreSQL database, all wired together automatically.
Warning
This project is for educational and research purposes only. It does not place real trades and is not investment advice. See the Disclaimer.
ai-hedge-fund-compressed.mp4
The render.yaml Blueprint provisions three resources, grouped under a single ai-hedge-fund Render project (a production environment) so they appear together in the Dashboard:
┌─────────────────────────┐
Browser ─────► │ ai-hedge-fund-web │ React/Vite static site (CDN)
│ (static site) │
└───────────┬─────────────┘
│ VITE_API_URL (auto-wired)
▼
┌─────────────────────────┐
│ ai-hedge-fund-api │ FastAPI backend (agents + backtester)
│ (web service, Python) │
└───────────┬─────────────┘
│ DATABASE_URL (auto-wired)
▼
┌─────────────────────────┐
│ ai-hedge-fund-db │ Managed PostgreSQL
│ (Postgres) │
└─────────────────────────┘
| Resource | Type | Role |
|---|---|---|
ai-hedge-fund-api |
Python web service | REST API that runs the agents and the backtester |
ai-hedge-fund-web |
Static site | React/Vite front end served over Render's CDN |
ai-hedge-fund-db |
PostgreSQL | Persists saved flows and runs |
- One Blueprint, one project.
render.yamldeclares the backend, frontend, and database inside a singleai-hedge-fundproject — no manual service creation, and all resources land in one Dashboard project. DATABASE_URLis auto-wired from the managed Postgres into the backend. You never set it by hand.VITE_API_URLis auto-wired from the backend's URL into the frontend build. The front end knows where the API lives with no configuration.- CORS is auto-wired and locked down.
FRONTEND_URLis injected from the frontend service's host, so the backend allows exactly that origin (plus localhost for dev). - SPA routing is handled by a static-site rewrite to
index.html.
Required:
- A Render account (the free plan is enough to try it).
- An LLM provider and API key — pick one of OpenAI, Anthropic, Groq, Google Gemini, or DeepSeek, and supply it via
LLM_PROVIDER+LLM_API_KEY.
Required for real results:
- A Financial Datasets API key for market data (stock prices + fundamentals), supplied via
FINANCIAL_DATASETS_API_KEY. financialdatasets.ai no longer has a free tier (see Cost expectations). Without a funded key, runs still complete but every ticker returns no data ($N/A,hold 0). The app can deploy without it, but you'll need it before any run produces real signals.
- Fork this repository (the Blueprint deploys from your fork's default branch).
- In your fork's README, click the Deploy to Render button (update the button URL to point at your fork if you renamed it).
- When Render prompts for environment variables, set
LLM_PROVIDERLLM_API_KEY, andFINANCIAL_DATASETS_API_KEY(see Environment variables). Leave the rest blank. - Click Apply. Render builds the backend, builds the frontend, provisions Postgres, and connects them.
On a fresh Apply, Render wires the two services' public URLs to each other automatically (
VITE_API_URLandFRONTEND_URL) — there's no manual URL step.As part of this, the backend deploys twice — once on creation, then again automatically once the frontend's URL is wired into
FRONTEND_URL. Wait for the second backend deploy to go live before testing; until then you may briefly see CORS errors.
- Fork this repository.
- In the Render Dashboard, choose New → Blueprint.
- Connect your GitHub account and select your fork. Render reads
render.yamlautomatically. - Fill in the environment variables (below) and click Apply.
Note: Due to the web service cold start with Alembic migrations, the Components pane on the right-hand side of the flows UI may take some extra time to load. Check the backend logs to monitor and ensure that Alembic migrations have run successfully and Components load in the UI.
Set these in the Render Dashboard (the ai-hedge-fund-api service's Environment tab), at deploy time or later. API keys are read only from these environment variables — never entered or stored in the app UI (see API-key security). Supply one LLM provider and its key.
| Variable | Required? | What it's for |
|---|---|---|
LLM_API_KEY |
required | API key for your LLM provider — always required (there is no keyless or default-to-OpenAI mode; without a key every run fails with No LLM provider configured). With LLM_PROVIDER unset, this key is used as an OpenAI key. Keys: OpenAI, Anthropic, Groq, Google Gemini, DeepSeek. |
LLM_PROVIDER |
optional | Provider for LLM_API_KEY, one of OpenAI, Anthropic, Groq, Google, DeepSeek, OpenRouter, xAI, Kimi, GigaChat. Leave blank to use your LLM_API_KEY as an OpenAI key. |
FINANCIAL_DATASETS_API_KEY |
required for real runs | Market data (prices + fundamentals) for all tickers — financialdatasets.ai. No free tier (see Cost expectations). Deploy succeeds without it, but every run returns empty ($N/A, hold 0). |
DATABASE_URL |
auto | Injected from the managed Postgres — do not set manually. |
VITE_API_URL |
auto | Injected into the frontend build from the backend's RENDER_EXTERNAL_URL (its https://…onrender.com URL, slug included) — do not set manually. |
FRONTEND_URL |
auto | Injected from the frontend's RENDER_EXTERNAL_URL and used as the CORS allow-list. Set manually only for a custom frontend domain (comma-separated origins). |
Set LLM_API_KEY to an OpenAI key and the app runs on OpenAI gpt-5.5 out of the box — no LLM_PROVIDER needed. An LLM key is always required: this "default to OpenAI" is only provider selection for the key you supply, not a keyless mode. With no LLM key set at all, every run fails with No LLM provider configured.
- Leaving
LLM_PROVIDERblank (or setting it toOpenAI) uses the OpenAI default model. - To use another provider, set
LLM_PROVIDERto that provider (e.g.Anthropic). The app then automatically defaults runs to a matching-provider model and, in the model pickers, grays out models whose provider has no key — so you can't accidentally pick a model your key can't run. You can still choose any other enabled model per agent.
You can also set per-provider keys (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY); those take precedence over LLM_API_KEY for their provider. On the CLI, pass --provider / --model as before.
Upstream stores API keys in the database and lets you enter them in the UI — fine for a single-user local tool, but on a public URL with no auth it exposes every operator's keys. This template removes that path: keys are read only from backend environment variables (LLM_API_KEY / LLM_PROVIDER, provider-specific vars like OPENAI_API_KEY, and FINANCIAL_DATASETS_API_KEY) — never entered in the browser, sent in request bodies, or stored server-side. The Settings → API Keys page is read-only, showing which providers are configured (no values).
- Wait for all three services to go live in the Dashboard (the first backend build takes a few minutes).
- If you didn't set your LLM key at deploy time, add it now on the
ai-hedge-fund-apiservice's Environment tab and redeploy. (Keys are backend env vars only — see API-key security.) - Open the
ai-hedge-fund-webURL and start a run.
In the web UI you pick the tickers to analyze, choose which investor agents participate, and select the LLM model. The agents each produce a signal; a Risk Manager sets position limits and a Portfolio Manager makes the final call. You can also run a backtester over a historical date range.
The quickest way to a working flow:
-
Use a ready-made Swarm example — In the right-hand menu under
Components, expand theSwarmsmenu. Select Value Investors, or one of the other options, which already wire analysts into a Portfolio Manager. Then just set your tickers and run. -
Or build the minimal flow by hand — add a Stock Input, one or more analyst nodes (e.g. Michael Burry), and a Portfolio Manager, then connect them: Stock Input → analyst(s) → Portfolio Manager. (A Risk Manager is inserted automatically between analysts and the Portfolio Manager.)
If a run finishes with no decisions, your flow is missing a Portfolio Manager or its nodes aren't connected — see Troubleshooting.
- Render: the Blueprint uses free plans for all three resources, so you can deploy and try it at no cost.
- Financial data: financialdatasets.ai has no free tier — the cheapest option is $20 one-time for 1,000 requests. You need a funded key before any run returns real signals; without it, every ticker shows
$N/A/hold 0. - LLM usage: billed by your chosen provider (OpenAI, Anthropic, etc.) per token — cost scales with how many agents and tickers you run.
The app also runs locally (CLI and web). See app/README.md for the full-stack web app and the quick CLI path below:
cp .env.example .env # add at least one LLM key
poetry install
poetry run python src/main.py --ticker AAPL,MSFT,NVDA
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDALocally the backend falls back to SQLite when DATABASE_URL is unset, so no database setup is required for development.
The database schema is managed by Alembic, not created automatically on startup. Before running the web backend for the first time (and after pulling schema changes), apply migrations once from the repo root:
poetry run alembic -c app/backend/alembic.ini upgrade headOn Render this runs for you on every deploy — it's baked into the backend service's startCommand, so a fresh fork's database is built automatically and no manual migration step is needed.
| Symptom | Likely cause / fix |
|---|---|
| Backend deploy fails during build | Python version mismatch — the Blueprint pins PYTHON_VERSION=3.11.9; keep it (deps require 3.11). |
| App loads but every run errors with an auth/key message | No LLM key set. Add one on the ai-hedge-fund-api Environment tab and redeploy. The app's Settings → API Keys page shows which providers are currently configured. |
| A run finishes but shows no decisions (or the backtester errors) | The flow has no Portfolio Manager node, or its nodes aren't connected. Wire your analysts into a Portfolio Manager (Stock Input → analyst(s) → Portfolio Manager) or start from a built-in template — see Using the AI hedge fund. |
| First request hangs ~30–60s | Free-tier cold start — the service is waking up. Subsequent requests are fast. |
Every ticker shows $N/A and hold 0 / 100% |
Missing, invalid, or unfunded FINANCIAL_DATASETS_API_KEY. financialdatasets.ai returns 401 (no key) or 402 (key valid but no credits), so no market data reaches the agents. Set a funded key (from $20) on the ai-hedge-fund-api Environment tab and redeploy. |
| Frontend loads but the flows list spins forever / CORS errors in the network tab | The backend's FRONTEND_URL must equal the frontend's URL (it's the CORS allow-list). A fresh Apply wires this automatically, but a code-only redeploy does not (re)create fromService env vars — so if FRONTEND_URL is missing (e.g. it was added to render.yaml after the first deploy, or you renamed a service), run a Blueprint sync (Dashboard → your Blueprint → Sync), not just a redeploy. For a custom frontend domain, add it to FRONTEND_URL (comma-separated origins). |
| "OpenAI API key not found" with a non-OpenAI key | Set LLM_PROVIDER to your provider (e.g. Anthropic) so the app defaults runs to a matching-provider model. Confirm it under Settings → API Keys ("Configured: …"). On the CLI, pass --provider. |
| Models are grayed out / can't be selected in the model picker | Expected. The picker only enables providers that have a key configured — a model whose provider has no key is disabled (tooltip: "No API key configured for …"). Set that provider's env var (OPENAI_API_KEY, ANTHROPIC_API_KEY, …, or LLM_PROVIDER + LLM_API_KEY) on the ai-hedge-fund-api service and redeploy. If every model is grayed out, no LLM key is set at all. |
| Data doesn't persist across restarts | You're on the free Postgres (expires after 30 days) or fell back to SQLite locally — upgrade the DB plan for durability. |
Does:
- Deploy a working, multi-agent AI hedge-fund web app on Render with one click.
- Provision and wire together a backend, frontend, and Postgres database.
- Let you experiment with different investor agents, LLMs, and backtests.
Doesn't:
- Place real trades or connect to a brokerage.
- Provide investment advice or guarantees of any kind.
- Ship a production system with auth and rate limiting — it's a demo/educational template.
This project is for educational and research purposes only.
- Not intended for real trading or investment
- No investment advice or guarantees provided
- Creator assumes no liability for financial losses
- Consult a financial advisor for investment decisions
- Past performance does not indicate future results
MIT — see LICENSE. Based on virattt/ai-hedge-fund.