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.

image

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. Or, instead of a key, the private key of a Base wallet holding USDC: every call then pays for itself with x402 (pip install 'aihf[x402]'; last 365 days of data, non-professional use).
  • 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. It has two modes:

  • Paper trading — your funds, each with a ledger of real market days and fake money. Highlight a fund to see what its next run will do; press enter to run it through the next completed session (an approval step shows the exact decision about to execute before anything trades), s for its full session history, h/r for the kill switch. Build a new fund from the same list: strategies, capital, cadence, tickers, and it is live. Every session is appended to a hash-chained ledger in ~/.hedge-fund/paper/<name>/, so NAV is a track record, not a reset.
  • Backtesting — replay a fund over history and watch its equity curve draw against its benchmark. Results are saved to ~/.hedge-fund/research/. Fund definitions live in ~/.hedge-fund/mandates/ and carry no tickers; you pick the universe per backtest.

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.

Metadata

Release files for aihf 2.7.2

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.7.2
File Size Uploaded Provenance Actions
aihf-2.7.2.tar.gz 184.5 kB Without provenance Details for aihf-2.7.2.tar.gz

Built distribution (wheel)

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

Total release size: 412.5 kB

Release files / aihf-2.7.2.tar.gz

Download URL aihf-2.7.2.tar.gz
Size 184.5 kB
Tags Source
SHA-256 checksum
How to use checksums
20673f0099e15bc60ae875f9959bb9839dcb3ec65d7bd97a1ac3e75b1b2ac165
BLAKE2b-256 checksum
How to use checksums
3b517a0ad1a991754628f86a9d8a7e52924617e9f377b8e4eb23a8ad5832a1c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.11.8 Darwin/27.2.0

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

Download URL aihf-2.7.2-py3-none-any.whl
Size 228.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b767ebdaabf38fed3ab4f3ef6bcbbd4d2e5ccb2903543dd5dfb10b02242c6f5
BLAKE2b-256 checksum
How to use checksums
e883086eefa0a6abc5c4177e18602c634822b7d1fc1299cabed66366cfe49a46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.11.8 Darwin/27.2.0

Security for aihf 2.7.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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