⚡️ Alpha Forge — How We Build It
Source: Notion | Last edited: 2025-10-28 | ID: 2992d2dc-3ef...
A structured, agent-ready R&D operating system for strategy creation.
🌍 1. Why We’re Building Alpha Forge
Section titled “🌍 1. Why We’re Building Alpha Forge”AI Agents are getting powerful — and creative.
Section titled “AI Agents are getting powerful — and creative.”- They can now reason, write working code, and even debug themselves.
- We believe they can design trading strategies end-to-end.
- They’re not perfect yet — but improving rapidly.
However, there are key limitations:
Section titled “However, there are key limitations:”- Long and complex strategy logic causes context loss and errors.
- Agents often reinvent the wheel, producing repetitive or unreviewable code.
- Reviewing or version-controlling thousands of lines of AI-generated code is inefficient.
💡 2. Our Solution — Alpha Forge
Section titled “💡 2. Our Solution — Alpha Forge”Instead of letting agents write full programs,
we let them build strategies with a structured DSL(yaml) and modular plugins.
Structured & Standardized
Section titled “Structured & Standardized”- Agent output is a DSL — concise, auditable, and consistent.
- Every strategy = one DSL file (the complete description).
- Same DSL → same result (100% reproducible).
- Easy to debug, compare, and verify like scientific experiments.
Reproducible & Transparent
Section titled “Reproducible & Transparent”- Each DSL defines:
- Data sources, features, models, evaluation, execution.
- Fully traceable from input → output → report.
- Enables experiment versioning and replay with zero ambiguity.
Integrated System — Engineering Advantage
Section titled “Integrated System — Engineering Advantage”- Built-in DAG compiler & runner (no manual orchestration).
- Auto-checkpointing for faster iteration.
- Standard escape bundle for exploratory Python code.
- Integrated backtest & evaluation pipeline.
- Designed for both human researchers and AI agents.
In short —
Agents (or humans) build strategies like Lego: small, composable, reproducible blocks.
🧱 3. How We Implement It
Section titled “🧱 3. How We Implement It”(1) Standard Flow → Defined by DSL
Section titled “(1) Standard Flow → Defined by DSL” data: source: "data.sample_csv" universe: ["BTCUSDT", "ETHUSDT"]
features: - name: "features.mom_20" # Reusable plugin params: { window: 5 }
strategy: using: "strategies.cs_rank" # Reusable plugin params: { long_n: 2 }
exec: using: "exec.sim" # Reusable plugin params: { fee_bps: 2 }Covers:
- Data loading
- Feature engineering (momentum, volatility, indicators)
- Backtest & evaluation
- Deployment configuration
(2) Exploratory Research → Python Escape Bundle
Section titled “(2) Exploratory Research → Python Escape Bundle”# strategy_escape.yaml - Run to features/labels stage data: source: "data.sample_csv" universe: ["BTCUSDT", "ETHUSDT", "BNBUSDT", "SOLUSDT"] start: "2023-01-01" end: "2023-12-31"
features: - name: "features.mom_20" params: { window: 5 } - name: "features.vol_20" params: { window: 5 }
labels: - name: "labels.forward_return" params: { horizon: 1 }
# Escape bundle automatically generated at this stage escape_bundle: enabled: true output_dir: "outputs/escape_bundle" from alpha_forge.core.escape import get_escape_bundle import pandas as pd import numpy as np
# 🎯 Load the escape bundle (standardized data) panel, prices, meta = get_escape_bundle()
print(f"Loaded data: {len(panel)} rows, {len(panel.columns)} features") print(f"Available features: {[c for c in panel.columns if c.startswith('feature.')]}") print(f"Available labels: {[c for c in panel.columns if c.startswith('label.')]}")
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # YOUR CUSTOM PYTHON LOGIC - NO LIMITS! # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Example 1: Add custom features def my_custom_feature_engineering(panel_df): """Try your experimental ideas here""" panel_df = panel_df.copy()
# Custom feature 1: Momentum ratio panel_df['feature.mom_vol_ratio'] = ( panel_df['feature.mom_20'] / (panel_df['feature.vol_20'] + 1e-8) )
# Custom feature 2: Exponential weighted momentum panel_df['feature.ewm_mom'] = panel_df.groupby('symbol')['price.close'].transform( lambda x: x.ewm(span=20).mean().pct_change(5) )
# Custom feature 3: Your ML model prediction # from sklearn.ensemble import RandomForestClassifier # model = RandomForestClassifier() # panel_df['feature.ml_signal'] = model.fit_predict(X, y)
return panel_df
panel = my_custom_feature_engineering(panel)Use cases:
- New idea validation
- Complex logic exploration
- One-off analysis
- Prototype development
(3) Mature Prototype → Promote Back into DSL
Section titled “(3) Mature Prototype → Promote Back into DSL” PLUGIN_REGISTRY.update({ "strategies.my_custom": "alpha_forge.plugins.strategies:my_custom_strategy" })Python prototype → Wrap as plugin → Register → DSL references the plugin → Fully systemized deployment→ Both AI-agents and researchers can use the same components.
⚙️ 4. Relationship to Touchstone
Section titled “⚙️ 4. Relationship to Touchstone”Alpha Forge builds on Touchstone’s foundation —
it splits data, feature, training, and evaluation layers into separate modular pipelines,
enabling far greater flexibility and agent-driven experimentation.
🚀 5. Vision
Section titled “🚀 5. Vision”Alpha Forge is not just a tool.
It’s a research operating system that empowers both AI agents and human researchers
to collaborate, experiment, and deploy trading intelligence — reproducibly and at scale.