Skip to main content

AlphaEvolve

Inspired by DeepMind’s AlphaEvolve coding agent—this project applies the same evolutionary-LLM principles to financial markets.

Autonomously discovers and back‑tests high‑performing algorithmic‑trading strategies using evolutionary LLM prompts, Backtrader, and the Papers‑With‑Backtest data ecosystem.

CI License


✨ Key Features

Layer Highlights
Data Zero‑setup loader for any Papers‑With‑Backtest dataset (pwb_toolbox) + caching to Feather
Strategies Seed templates with EVOLVE‑BLOCK markers that the LLM mutates
Evaluator Deterministic Backtrader walk‑forward, JSON KPIs (Sharpe, CAGR, Calmar, DD)
LLM Engine OpenAI o3 structured‑output chat → JSON diff/patch system
Evolution Async controller, SQLite hall‑of‑fame, optional MAP‑Elites niches
Dashboard (optional) Streamlit live view of metrics & equity curves

🚀 Quickstart

# clone and install in editable mode
$ git clone https://github.com/paperswithbacktest/pwb-alphaevolve.git
$ cd pwb-alphaevolve
$ pip install -e .

# set your OpenAI key (model "o3" required)
$ export OPENAI_API_KEY=sk-...

# set your Papers‑With‑Backtest dataset (e.g. "paperswithbacktest/Stocks-Daily-Price")
$ export HF_ACCESS_TOKEN=hf_

# launch the evolution controller (infinite loop)
$ python scripts/run_controller.py
$ streamlit run scripts/dashboard.py

The dashboard uses Streamlit to visualize the evolution process and back‑test results.


📂 Project structure (high‑level)

alpha_trader/
├── data/          # loaders & helpers on top of pwb_toolbox
├── strategies/    # seed strategies (EVOLVE‑BLOCK markers)
├── evaluator/     # Backtrader KPIs & walk‑forward
├── llm_engine/    # prompt builder + OpenAI client
├── evolution/     # controller, patching, islands
└── store/         # SQLite persistence
scripts/           # CLI entry‑points

⚙️ Installation

Python ≥ 3.10 required.

pip install pwb-alphaevolve

Or install the bleeding‑edge version:

pip install git+https://github.com/your‑org/pwb-alphaevolve.git

Core Dependencies

(See pyproject.toml for the full list.)


🤝 Contributing

  1. Fork the repo & create your feature branch (git checkout -b feat/new-feature).
  2. Commit your changes (git commit -m 'feat: add something').
  3. Push to the branch (git push origin feat/new-feature).
  4. Open a Pull Request.

Please run black + ruff before submitting.


📄 License

MIT © 2025 Contributors

Metadata

Release files for pwb-alphaevolve 0.1.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 pwb-alphaevolve 0.1.0
File Size Uploaded
pwb_alphaevolve-0.1.0.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pwb-alphaevolve 0.1.0
File Interpreter ABI Platform
pwb_alphaevolve-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / pwb_alphaevolve-0.1.0.tar.gz

Download URL pwb_alphaevolve-0.1.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
886a158034816667acc3b51b2ff3ab6543e70b5d7eda8f4323e00954b5ac43b7
BLAKE2b-256 checksum
How to use checksums
ec1c831c438383da8c17474d1b5cbf9ccf87bafab563e3e189696fa214844375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / pwb_alphaevolve-0.1.0-py3-none-any.whl

Download URL pwb_alphaevolve-0.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
619c1faab65ac065c9cddc998a9f601cd34ed1a550e37d76d9a666436e99b064
BLAKE2b-256 checksum
How to use checksums
a9ba92deee77627828bd676c9d5e0e436db9a1d1ac8a64790bcfb4eb130da3f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.0 This release

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