π§ Autonomous alpha research platform for WorldQuant BRAIN IQC 2026
LLM-powered closed-loop pipeline β Generate β Validate β Submit β Mutate β Repeat until BRAIN approves
OpenAlpha-Quant runs as a fully autonomous agent that:
- Generates alpha expressions using an LLM (Groq / Gemini / OpenAI) guided by a rigorous IQC research mandate
- Validates locally β syntax, fingerprint anti-crowding, estimated metrics via exact IQC formulas
- Submits to WorldQuant BRAIN β real simulation via the BRAIN REST API
- Reads real BRAIN results β actual Sharpe, Fitness, Turnover + every gate check (
LOW_SHARPE,LOW_FITNESS,LOW_SUB_UNIVERSE_SHARPE,SELF_CORRELATION, etc.) - Mutates surgically β each failing BRAIN check triggers a specific ELM mutation injected back into the LLM up to 20 times per alpha
- Live Dashboard UI β watch the closed-loop optimization, view live metrics, exact WorldQuant gate failure text, and expression patches
- Dockerized Deployment β easily run the background service and UI in an isolated environment
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β OpenAlpha - Quant β
β β
β LLM (Groq/Gemini/OpenAI) β
β β β
β βΌ β
β [GENERATION] Alpha expression + metrics + fingerprint β
β β β
β βΌ β
β [LOCAL VALIDATION] β
β β’ Syntax (operators, parens, variable whitelist) β
β β’ Fingerprint anti-crowding (5-dim POMDP memory) β
β β’ Estimated IQC gate check (Sharpe/Fitness/Turnover) β
β β PASS β
β βΌ β
β [BRAIN SUBMISSION] POST /simulations β poll β COMPLETE β
β β β
β βΌ β
β [REAL GATE CHECKS] checks[] from BRAIN API β
β β’ LOW_SHARPE β ts_zscore + volatility norm + subindustry β
β β’ LOW_FITNESS β ts_decay_linear(expr, 10) β
β β’ LOW_SUB_UNIVERSE_SHARPE β subindustry + interaction factors β
β β’ SELF_CORRELATION β full structural pivot (3+ dims) β
β β’ HIGH_TURNOVER β increase decay d=6β10β15β20 β
β β’ SIMULATION ERROR β enforce variable whitelist β
β β FAIL β inject targeted mutation β back to LLM β
β β PASS βββββββββββββββββββββββββββββββββββββββββββββββΊ β
β Alpha saved in BRAIN "My Alphas" β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Clone the repository:
git clone git@github.com:hitendras510/OpenAlpha-Brain.git cd OpenAlpha-Brain - Configure your credentials in
.env(WorldQuant + LLM).cp .env.example .env # Edit .env with your credentials - Start the application:
docker-compose up -d --build
- Open the UI Dashboard: http://localhost:8000/static/index.html
-
Install dependencies:
git clone git@github.com:hitendras510/OpenAlpha-Brain.git cd OpenAlpha-Brain pip install -r requirements.txt -
Configure
.env:cp .env.example .env
Edit
.env:Variable Required Description LLM_PROVIDERβ groq/gemini/openai/anthropicLLM_MODELβ e.g. llama-3.3-70b-versatile(Groq),gemini-1.5-flashLLM_API_KEYβ Your LLM provider API key BRAIN_EMAILβ Your worldquantbrain.com account email BRAIN_PASSWORDβ Your worldquantbrain.com account password BRAIN_SUBMIT_ENABLEDβ trueto enable auto-submission to BRAINFree LLM Keys
- Groq (30 RPM free): console.groq.com
- Gemini (generous free tier, recommended): aistudio.google.com/app/apikey
-
Run the Backend:
uvicorn main:app --port 8000
-
Launch Dashboard: Navigate to http://localhost:8000/static/index.html and click Start.
When BRAIN returns a simulation result, every failing check is mapped to a precise surgical mutation that gets injected into the LLM's next generation cycle:
| BRAIN Check | What It Means | Mutation Applied |
|---|---|---|
LOW_SHARPE |
Sharpe < 1.25 | Switch rank() β ts_zscore(), add volatility norm /ts_std_dev(close,20), tighten to subindustry |
LOW_FITNESS |
Fitness β€ 1.0 | Wrap with ts_decay_linear(expr, 10) targeting 15β35% turnover |
LOW_SUB_UNIVERSE_SHARPE |
Fails within industry groups | Change neutralization to subindustry, add interaction rank(A)*rank(B) |
HIGH_TURNOVER |
Turnover > 70% | Increase decay d=6β10β15β20 |
LOW_TURNOVER |
Turnover < 1% | Remove decay, shorter windows, use ts_delta() |
SELF_CORRELATION |
Correlated with existing alphas | Full 3-dim structural pivot to different factor family |
CONCENTRATED_WEIGHT |
Weights too concentrated | Add scale() + signed_power(expr, 0.5) |
SIMULATION ERROR |
Invalid variable name | Enforce variable whitelist, rewrite expression |
The LLM also receives the exact real metric values from BRAIN (Sharpe, Fitness, Turnover, Returns) alongside each mutation instruction.
Only these bare variable names work in BRAIN's FastExpr language:
Price/Volume : close, open, high, low, vwap, volume, adv20, returns, cap
Short Int : short_ratio, days_to_cover
Analyst : analyst_rating, price_target
Neutralize : industry, subindustry, sector (group_neutralize args only)
β οΈ Variables likeearnings,sales,short_interest,institutional_ownershipdo not exist as bare names β BRAIN uses dataset-prefixed names accessed via Data Explorer.
Sharpe β₯ 1.25 (target > 2.0)
Fitness > 1.0 Formula: Sharpe Γ sqrt(|Returns|) / max(Turnover, 0.125)
Turnover 1%β70% Sweet spot: 15%β35%
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Server health check |
/session/start |
POST | Start a new research session |
/session/{id} |
GET | Get session state (status, passed alphas, BRAIN results) |
/session/{id}/stop |
POST | Stop a running session |
/static/index.html |
GET | Real-time research dashboard |
| Status | Meaning |
|---|---|
GENERATING |
LLM is writing an alpha |
VALIDATING |
Local gate checks running |
SUBMITTING |
Alpha sent to BRAIN, polling for result |
ITERATING |
BRAIN returned failures, LLM mutating |
PASS |
Alpha passed all BRAIN checks β |
ERROR |
Unrecoverable error |
OpenAlpha-Brain/
βββ main.py # FastAPI server + session routes
βββ loop_engine.py # Core autonomous research loop
βββ brain_client.py # WorldQuant BRAIN REST API client
βββ prompts.py # LLM system prompt + ELM mutation feedback builders
βββ llm_client.py # Multi-provider LLM client (Groq/Gemini/OpenAI)
βββ validator.py # Local syntax + IQC metric validator
βββ alpha_parser.py # Parses LLM output into structured AlphaResult
βββ session_manager.py # JSON-backed session persistence
βββ models.py # Pydantic models (AlphaResult, BrainSubmissionResult, etc.)
βββ config.py # Settings loaded from .env
βββ watch_session.py # CLI watcher β runs until BRAIN PASS
βββ static/index.html # Real-time dashboard
βββ .env.example # Environment template
βββ requirements.txt
Each research session maintains a belief state that prevents redundant exploration:
- Topology Map β tracks which AST topologies have been explored (PASSED/FAILED/CROWDED)
- Dataset Usage β counts attempts per factor family; forces pivot after 3 consecutive fails
- Failure Catalog β logs each failure with fingerprint, metric values, mutation attempted
- Open Frontiers β unexplored 5-dimensional fingerprint combinations
- Rejected Motifs β topologies permanently retired for this session
.envis gitignored β credentials never leave your machine/sessionsdirectory is gitignored β session state stays local- BRAIN auth uses HTTP Basic Auth β session cookie (no API key storage)
MIT β see LICENSE
Built for WorldQuant IQC 2026 Β· Powered by Groq / Gemini Β· BRAIN API v1