ai-hedge-fund README

The project's README from github.com/virattt/ai-hedge-fund. As one markdown file: README.md.

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.

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:

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

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.

ai-hedge-fund (virattt/ai-hedge-fund)

Searching Database…

这是什么?一个由AI驱动的对冲基金概念验证项目,利用AI(由大语言模型驱动的“阿尔法模型”)做出模拟交易决策。它明确用于教育和研究目的,并非真实交易或投资。
这是交易机器人,还是我自己运行的终端应用?这是一个你安装并在本地运行的Python命令行工具。不带任何参数运行时,它会启动一个交互式终端应用,用于搭建和回测一只基金。
怎么安装和运行?用 'uv tool install aihf' 或 'pip install aihf' 安装到你的环境中,然后可在任意位置运行;默认运行会打开交互式终端应用。
需要哪些API密钥?需要一个 Financial Datasets API 密钥,用于获取价格、基本面和财报数据;还需要一个大语言模型密钥,可选择 Anthropic、OpenAI、DeepSeek、Google、xAI 或 Kimi 之一,用于驱动阿尔法模型。应用会在首次使用时请你输入这些密钥,并保存到 ~/.hedge-fund/.env。
它会执行真实交易吗?不会,系统从不下真实订单,它只模拟和回测决策,项目also明确声明不得用于真实投资。
这个项目里的“mandate”是什么?mandate 是保存下来的基金定义,包括其策略、人员、风险设置、资金规模和再平衡周期,以文件形式存放在 ~/.hedge-fund/mandates/ 中。它不会硬编码股票代码;运行时你可以通过 --tickers 指定具体股票。
项目接下来有什么计划?团队正在将其重构为一个持续运行、全天候在线的AI对冲基金,其中投资者代理将变为可插拔、可回测的“阿尔法模型”,这些模型可以进行回测、模拟交易,并可选择实盘运行。
能否不使用交互界面,只运行一次基金周期?可以,非交互模式下你可以用一个 mandate 文件运行一次基金周期;完整的周期记录会以 JSON 格式输出到标准输出(stdout),同时一段简短的可读摘要会输出到标准错误(stderr)。
Creator
virattt
Size
4.1 MB
Stars
64.1K
Age
1y
Commits · 90 Days