I Built an AI Warren Buffett. Now It Trades For Me.
Set up the repository safely, validate its Buffett analyst, compare stocks, build hypothetical portfolios, run backtests, create dashboards, and plan paper trading without enabling live.
Download the complete installation and research guide
Install AI Hedge Fund for Buffett Style Stock Research
A drag and drop installation guide for Claude Code or Codex, with prompts for stock research, portfolio construction, backtesting, dashboards, and paper trading.
What you will achieve
Install the ai-hedge-fund repository, configure its Warren Buffett analyst, and run increasingly advanced experiments without enabling live trading.
Who this is for
Developers and investors who want to explore AI assisted fundamental analysis using Claude Code or Codex.
Difficulty: Intermediate
Short tutorial
A drag and drop installation guide for Claude Code or Codex, with prompts for stock research, portfolio construction, backtesting, dashboards, and paper trading.
Guide: Install the AI Hedge Fund and Run a Buffett Style Analyst
Time: 20 to 40 minutes, plus installation and
What this installation file does
Use this file as an instruction package for Claude Code or Codex. Save it as AI_HEDGE_FUND_BUFFETT_INSTALL.md, place it in the folder where you want the project installed, then ask your coding agent to read and execute it.
The agent will:
- Clone the
ai-hedge-fundrepository. - inspect the current repository documentation before changing anything.
- Install the required dependencies using the method specified by the repository.
- Configure only the credentials and services you approve.
- Verify that the Warren Buffett analyst can run.
- Provide prompts for individual stocks, watchlists, model portfolios, and backtests.
- Keep brokerage execution in paper mode unless you explicitly request otherwise.
This project simulates an investing framework associated with Warren Buffett. It is not Warren Buffett, does not know exactly what he would do, and does not provide guaranteed investment results. Treat every result as research for experimentation, not financial advice.
Master instruction for Claude Code or Codex
Copy the following prompt into your coding agent after attaching this file:
Read AI_HEDGE_FUND_BUFFETT_INSTALL.md completely, then install and validate the project described in it. Work inside the current directory. Before running commands, show me: 1. The proposed installation path. 2. The detected operating system and available package tools. 3. The major installation steps. 4. Any credentials or paid data access that may be required. Then proceed through the safe local installation steps. Follow the repository's current README and configuration files whenever they differ from assumptions in this document. Do not enable live trading. Do not request that I paste secret API keys into chat. Use environment variables or the repository's documented environment file. Never print secret values. Ask for confirmation before: 1. Installing system level packages. 2. Starting a paid model or data request. 3. Connecting to a brokerage account. 4. Submitting, replacing, or cancelling any paper order. 5. Making any change that could affect a live account. Stop after validation and report what works, what remains unconfigured, and the exact command I should use for the first Buffett style analysis.
Ordered installation path
1. Create a clean project folder
The coding agent should confirm the destination before cloning. The standard clone commands are:
git clone https://github.com/virattt/ai-hedge-fund.git cd ai-hedge-fund
If the repository already exists, do not clone over it. Inspect its status and ask whether to update it.
git status git remote -v
Do not discard local changes during an update.
2. Inspect the current repository instructions
Repository setup can change. Before installing dependencies, the agent must inspect:
README.md- Dependency and lock files
- Example environment files
- Available command line entry points
- The analyst definitions and Warren Buffett implementation
- Any testing or validation commands
Use the package manager and commands documented by the repository. Do not invent environment variable names, dependency versions, or command flags.
The agent should summarize its findings in this format:
Repository setup summary Runtime: Package manager: Install command: Environment template: Required data provider: Supported model providers: Buffett analyst location: Analysis command: Test or validation command: Unresolved requirements:
3. Install dependencies
Install dependencies according to the checked in documentation and lock files. Prefer a project specific virtual environment or the isolation method recommended by the repository.
Before installation, the agent should explain whether the command modifies only the project or also changes the wider system.
After installation, record:
Installation result Dependency installation: PASS or FAIL Runtime version: Project environment path: Warnings: Next required action:
4. Configure credentials safely
The transcript describes financial market data as necessary for analysis. Historical filings and longer backtests may require expanded or paid data access.
The agent must inspect the repository's example environment file and ask only for values that the current version actually requires.
Credential rules:
- Keep secrets in the documented local environment file or operating system environment.
- Never commit credential files.
- Never print complete API keys.
- Confirm that the credential file is excluded by Git.
- If a data subscription is insufficient, report the missing coverage instead of fabricating results.
- Do not silently switch data providers.
Use this configuration checklist:
[ ] Model provider configured [ ] Financial data provider configured [ ] Environment file excluded from Git [ ] No credentials visible in tracked files [ ] Buffett analyst found [ ] Analysis command found [ ] Brokerage integration disabled [ ] Live trading disabled
5. Validate the Buffett analyst
Locate the repository's Warren Buffett analyst and identify how it is selected. Then run the smallest documented validation that does not place trades.
The test should establish:
- The application starts successfully.
- The configured model can be reached.
- The required financial data can be retrieved.
- Only the Warren Buffett analyst is selected for the first analysis.
- The output contains a signal or verdict, confidence, and supporting reasoning when the repository supports those fields.
Do not describe the result as Warren Buffett's actual opinion. Label it as a Buffett style simulation based on the repository's implementation.
Use a lower cost model for repeated setup tests when supported. Reserve a more capable model for final analysis when deeper reasoning is worth the additional cost.
First analysis: one stock
After installation succeeds, give the coding agent this prompt:
Run only the Warren Buffett analyst from the installed ai-hedge-fund project on AAPL using the latest date and data available to the configured provider. Do not use other analyst signals. Do not place or prepare any trade. Present the result as a Buffett style simulation, not as Warren Buffett's real opinion. Return: 1. Verdict: bullish, neutral, or bearish. 2. Confidence from 0 to 100 percent, if supported by the project. 3. Business quality assessment. 4. Durability of the competitive advantage. 5. Management and capital allocation assessment. 6. Earnings and free cash flow observations. 7. Valuation and margin of safety. 8. The strongest reason to own it. 9. The strongest reason to avoid it. 10. Data date, data sources used by the application, and any missing inputs. Separate facts produced from retrieved data from model interpretation. Do not invent unavailable metrics.
A useful output structure is:
| Field | Result |
|---|---|
| Ticker | AAPL |
| Verdict | Bullish, neutral, or bearish |
| Confidence | 0 to 100 percent |
| Business quality | Concise assessment |
| Competitive advantage | Concise assessment |
| Valuation | Concise assessment |
| Margin of safety | Concise assessment |
| Main risk | Concise assessment |
| Data date | Date used by the run |
Compare several stocks
Use this prompt to analyze a watchlist and produce a ranked table:
Run only the Warren Buffett analyst on the following tickers: AAPL, NVDA, KO, META, TSLA Use one consistent analysis date and the same available data standard for every company. Do not place trades. Return a table with: 1. Rank. 2. Ticker. 3. Verdict. 4. Confidence. 5. Business predictability. 6. Competitive advantage. 7. Financial quality. 8. Valuation. 9. Margin of safety. 10. Primary concern. 11. One sentence conclusion. After the table, explain why the highest ranked company scored better than the lowest ranked company. Clearly flag missing or incomparable data. Do not treat confidence as expected return.
Replace the ticker list with a personal watchlist or current paper portfolio as needed.
Build a hypothetical portfolio
This prompt asks the analyst to allocate a fixed amount without executing orders:
Create a hypothetical 100,000 dollar portfolio using only the Warren Buffett analyst in the installed ai-hedge-fund project. Eligible universe: [INSERT TICKERS OR A DOCUMENTED INDEX UNIVERSE] This is a research simulation. Do not connect to a brokerage and do not submit orders. For each eligible company, classify it as: 1. Invest. 2. Good business, wrong price. 3. Outside the strategy. 4. Insufficient data. Then propose a portfolio with: 1. Ticker. 2. Target weight. 3. Dollar allocation. 4. Verdict. 5. Confidence. 6. Investment thesis. 7. Valuation concern. 8. Primary risk. Include a cash allocation. Confirm that weights total 100 percent and dollar allocations total 100,000 dollars. Explain any concentration limit you apply. Do not fabricate an analysis for companies with inadequate data.
When analyzing a large universe, begin with a small sample. Large scans can consume substantial model tokens and data requests.
Run a point in time backtest
A valid historical test must prevent future information from entering an earlier decision. Ask the agent to inspect whether the repository supports point in time data before running the test.
Design and run a point in time backtest for the Warren Buffett analyst. Start date: [YYYY-MM-DD] End date: [YYYY-MM-DD] Starting capital: 100000 Benchmark: S&P 500, if benchmark data is available through the configured source Eligible universe: [INSERT UNIVERSE] Review cadence: [INSERT CADENCE] Before running it, explain: 1. How the test prevents lookahead bias. 2. Whether filings are selected using their publication dates. 3. Whether delisted companies and universe membership are handled point in time. 4. Which price series is used. 5. Whether dividends, transaction costs, and slippage are included. 6. Which limitations remain. If the available data cannot support a defensible point in time test, stop and tell me what is missing. If it can, run the test and report: 1. Total return. 2. Annualized return. 3. Benchmark return. 4. Maximum drawdown. 5. Number of holdings. 6. Number of orders or rebalances. 7. Best and worst contributors. 8. Ending value. 9. Monthly portfolio values. 10. Methodology and limitations. Do not present the result as proof of future performance.
Historical data depth may depend on the configured provider and subscription. A failed request caused by plan limits should be reported plainly.
Generate a local HTML results dashboard
After a backtest produces structured results, use this prompt:
Create a self contained local HTML dashboard from the completed backtest results. Include: 1. Portfolio value compared with the benchmark. 2. Total and annualized returns. 3. Maximum drawdown. 4. Ending portfolio value. 5. Holdings and target weights. 6. Best and worst contributors. 7. A monthly results table. 8. Backtest assumptions and limitations. 9. The exact analysis period and data date. Use only the results already produced by the backtest. Do not invent missing observations. Save the dashboard inside a clearly named output directory and tell me how to open it locally.
Optional Alpaca paper trading plan
The transcript demonstrates connecting the strategy to an Alpaca paper account. Treat that as an optional extension, not part of the default installation.
Before implementing it, the agent must inspect whether the current repository already provides the integration. If it does not, it should propose the smallest auditable addition and wait for approval.
Use this planning prompt first:
Inspect this project for an existing Alpaca integration. Do not modify code and do not connect to any account yet. Report: 1. Whether Alpaca support already exists. 2. Which files implement it. 3. Which environment variables it requires. 4. How paper mode is enforced. 5. How current positions and open orders are read. 6. How proposed target weights become orders. 7. What confirmation occurs before order submission. 8. What logging, retry, and failure handling exist. 9. What additional work would be required. The design must default to paper trading. It must refuse live execution unless the code and configuration are deliberately changed after a separate confirmation.
If the integration exists or is approved for implementation, use this execution safety contract:
Connect only to an Alpaca paper account using credentials stored in local environment variables. Read the account, positions, buying power, and open orders. Do not submit, replace, or cancel anything yet. Generate a proposed rebalance containing: 1. Current position. 2. Current weight. 3. Target weight. 4. Proposed side. 5. Proposed quantity or notional value. 6. Estimated resulting weight. 7. Reason. 8. Any validation warning. Reject the plan if: 1. The account is not positively identified as a paper account. 2. Market data or account data is incomplete. 3. The target weights do not total 100 percent. 4. The plan exceeds available buying power. 5. An order would duplicate or conflict with an open order. 6. Any required credential is missing. Save the proposed orders as a reviewable local file. Wait for my explicit confirmation before submitting paper orders.
A safe paper trading sequence is:
Research signal
↓
Target portfolio
↓
Current account snapshot
↓
Proposed rebalance
↓
Validation checks
↓
Human confirmation
↓
Paper orders
↓
Execution log and reconciliationScheduling without uncontrolled execution
An always available computer or server is required for unattended scheduled runs. Begin with scheduled research reports, not autonomous orders.
Use this prompt to prepare a review job:
Create a scheduled portfolio review design for this project, but do not install a scheduler yet. The job should: 1. Run at the approved cadence. 2. Retrieve current data. 3. Run only the Warren Buffett analyst. 4. Compare current paper positions with proposed target weights. 5. Produce a dated report and proposed order file. 6. Send no orders automatically. 7. Record failures without retrying indefinitely. 8. Prevent overlapping runs. 9. Redact secrets from logs. Show the proposed files, commands, schedule, locking method, and recovery procedure. Wait for approval before implementing it.
The transcript discusses daily or multiday reviews, but a patient investment strategy may not benefit from frequent trading. Backtest results in the example suggested that excessive order activity added unnecessary shuffling. Choose the review cadence deliberately.
Final acceptance checklist
The coding agent should complete this checklist before declaring the setup ready:
[ ] Repository cloned from https://github.com/virattt/ai-hedge-fund [ ] Current README inspected [ ] Dependencies installed using repository instructions [ ] Environment configuration created safely [ ] Secret files excluded from Git [ ] Financial data connection validated [ ] Model connection validated [ ] Warren Buffett analyst located [ ] Single ticker analysis completed [ ] Output labeled as a Buffett style simulation [ ] Data date and missing inputs disclosed [ ] No live brokerage connection enabled [ ] No orders submitted [ ] Exact rerun command documented
Required completion report
At the end of installation, return:
AI Hedge Fund installation report Project path: Repository revision: Runtime: Dependency status: Configured model provider: Configured data provider: Buffett analyst status: Validation ticker: Validation result: Data limitations: Estimated paid services involved: Brokerage status: Disabled or Paper only Live trading status: Disabled First analysis command: Recommended next prompt:
Do not report success unless the application actually runs. If setup is incomplete, identify the exact missing dependency, credential, data entitlement, or configuration step.