Skip to main content

AI Hedge Fund

This is a proof of concept for an AI-powered hedge fund. The goal of this project is to explore the use of AI to make trading decisions. This project is for educational purposes only and is not intended for real trading or investment.

🚧 The project is evolving. We're rebuilding it into a persistent, always-on AI hedge fund — a fund as a first-class entity you can backtest, paper-trade, and (opt-in) run live, with the investor agents reimagined as pluggable, backtestable "alpha models." Read the Vision → and the Roadmap →.

Note: the system does not actually make any trades.

Twitter Follow

Disclaimer

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

By using this software, you agree to use it solely for learning purposes.

How to Install

pipx install aihf

(or uv tool install aihf, or pip install aihf into an environment of your choice)

Then run it from anywhere:

aihf

API keys

The app asks for keys the first time it needs them and saves them to ~/.hedge-fund/.env — nothing to configure up front. It needs:

  • A Financial Datasets API key, for prices, fundamentals, and earnings.
  • One model API key for the investor agents. Supported providers: Anthropic, OpenAI, DeepSeek, Google, xAI, Kimi, TypeSafe (Jev).

Keys exported in your shell always win over the saved file.

How to Run

Interactive app

aihf

With no arguments, this launches the interactive terminal app. Build a fund — pick stocks, strategies, rebalance cadence — or backtest a saved fund and watch its equity curve draw against its benchmark. Funds you build are saved as mandate files in ~/.hedge-fund/mandates/.

Non-interactive

Run one fund cycle from a mandate file. The full cycle record prints to stdout as JSON; a short human summary goes to stderr:

aihf ~/.hedge-fund/mandates/example.yaml --tickers AAPL,MSFT

Run the same mandate with Jev after configuring TYPESAFE_API_KEY:

aihf ~/.hedge-fund/mandates/example.yaml --tickers AAPL,MSFT --model jev-1.13.0

Backtest the mandate over history at its rebalance cadence:

aihf ~/.hedge-fund/mandates/example.yaml --tickers AAPL,MSFT --backtest

A mandate is the desk — strategies, staff, risk, capital, cadence — and never names tickers; --tickers says what to point it at for this run.

Development

git clone https://github.com/virattt/ai-hedge-fund.git
cd ai-hedge-fund
poetry install
poetry run aihf
poetry run pytest hedge_fund

How to Contribute

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

Important: Please keep your pull requests small and focused. This will make it easier to review and merge.

Feature Requests

If you have a feature request, please open an issue and make sure it is tagged with enhancement.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release files for aihf 2.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aihf 2.3.0
File Size Uploaded
aihf-2.3.0.tar.gz 103.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aihf 2.3.0
File Interpreter ABI Platform
aihf-2.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 230.9 kB

Release files / aihf-2.3.0.tar.gz

Download URL aihf-2.3.0.tar.gz
Size 103.3 kB
Tags Source
SHA-256 checksum
How to use checksums
17e2b89a39f926c95d9e4d9fa1d8a0c1d438ee8733e2d8d8522673c0e05b3230
BLAKE2b-256 checksum
How to use checksums
e8c8f7096d30438f5194a9ab8169d8d636d6736693e1ee9d0e3678ecb3587d8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.11.8 Darwin/24.1.0

Release files / aihf-2.3.0-py3-none-any.whl

Download URL aihf-2.3.0-py3-none-any.whl
Size 127.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3feeda3766d3354e0eb682cc945c91674841df016fca4891f9ccece5aed03a65
BLAKE2b-256 checksum
How to use checksums
9e001398b343c15d0f9c91e08a5946b035e0b8281ed28a7a24621129e8783c26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.11.8 Darwin/24.1.0

Release history Release notifications | RSS feed

2.4.0

2 release files

2.3.1

2 release files

This release

2.3.0 This release

2 release files

2.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page