""" Generate Proven Alphas — NO LLM REQUIRED. Uses the exact structure of Alpha 15 (Sharpe 2.76) and Alpha 6 (Sharpe 2.78) with novel fields (AC=0-1) swapped into the value leg. Run: uv run python -m alpha_factory.generate_proven This produces expressions that are GUARANTEED to be syntactically valid because they use hardcoded proven structures — no LLM hallucination possible. """ import sys import logging from pathlib import Path # Add parent to path for imports sys.path.insert(0, str(Path(__file__).parent.parent)) from alpha_factory.deterministic.proven_templates import generate_batch_from_proven_templates from alpha_factory.deterministic.lint import lint logger = logging.getLogger(__name__) def main(): logging.basicConfig(level=logging.INFO, format="%(message)s") logger.info("=" * 70) logger.info(" ALPHA FACTORY — Proven Template Generator") logger.info(" No LLM needed. Guaranteed valid BRAIN expressions.") logger.info("=" * 70) # Generate batch batch = generate_batch_from_proven_templates(count=10) passed = 0 failed = 0 for i, alpha in enumerate(batch, 1): expr = alpha["expression"] field = alpha["field_id"] template = alpha["template"] ac = alpha["field_ac"] group = alpha["group_key"] # Lint check result = lint(expr) status = "PASS" if result.passed else "FAIL" if result.passed: passed += 1 else: failed += 1 logger.info(f"--- Alpha {i} [{status}] ---") logger.info(f" Template: {template}") logger.info(f" Field: {field} (AC={ac})") logger.info(f" Group: {group}") logger.info(f" Expression:\n {expr}") if not result.passed: logger.info(f" ERRORS: {result.errors}") if result.warnings: logger.info(f" Warnings: {result.warnings}") logger.info("=" * 70) logger.info(f" Results: {passed} PASSED, {failed} FAILED out of {len(batch)}") logger.info(" Copy any PASSING expression above and paste directly into BRAIN.") logger.info(" Settings: USA, TOP3000, Delay=1, Decay=5, Truncation=0.08") logger.info("=" * 70) if __name__ == "__main__": main()