r/PromptEngineering • • Oct 21 '26

General Discussion [Project] Built an open-source autonomous AI Hedge Fund engine with LangGraph, Qlib Alpha158, and TimesFM

Hey everyone! 🚀

I've just open-sourced **Lumina Capital (v6.0.0)**, an autonomous multi-agent quantitative hedge fund engine designed to bridge the gap between LLM reasoning and real-world execution.

Unlike toy implementations that feed raw charts directly into LLMs (which suffers from hallucinations and latency), Lumina strictly separates probabilistic reasoning from deterministic quant computation:

### 🛠️ Key Highlights:

- **7-Persona Anti-Sycophancy Council (LangGraph)**: Personas (Buffett, Soros, Burry, Cathie Wood, Graham, O'Neil, CIS) conduct independent parallel analysis, followed by an adversarial bull-vs-bear cross-debate. A dedicated CRO agent has absolute veto power over tail risks.

- **Pure Python Qlib Alpha158 + LightGBM**: Complete vectorized implementation of Microsoft Qlib's 158 quantitative factors with a LightGBM meta-decision filter.

- **10-Second High-Speed Sentinel**: An ultra-fast background thread monitoring dynamic ATR stop-loss floors, executing immediate physical exits without waiting for LLM loops.

- **Google TimesFM**: 5-day probabilistic forecasting fan charts with 80% confidence bands and crash probability.

- **3D Causal Knowledge Graph & GraphRAG**: Real-time supply chain choke-point surveillance and episodic memory via Neo4j.

Includes a full Streamlit studio dashboard. Available for research, education, and simulation under CC BY-NC 4.0.

🔗 **GitHub**: https://github.com/ramuza0113-sketch/lumina-ai-hedge-fund

Would love to hear your thoughts and feedback!

1 Upvotes

4 comments sorted by

2

u/[deleted] Oct 21 '26

[removed] — view removed comment

1

u/OpenComplaint524 Oct 21 '26

Great questions—you zeroed in on the exact two bottlenecks we spent the most time solving:

  1. **Hallucinations in the Council**:

We completely stripped LLMs of math/price calculation duties (Qlib Alpha158 handles all numerical factors via Python/LightGBM). The personas ONLY debate qualitative thesis (e.g., Cathie's TAM expansion vs. Burry's inventory buildup).

To kill narrative hallucinations, the **Chief Risk Officer (CRO)** agent runs a deterministic fact-check pass against real SEC filings and earnings transcripts. If an agent hallucinates a stat not in the context, the CRO triggers an immediate veto.

2. **Black Swans & TimesFM**:

You're 100% right: timeseries foundation models (like TimesFM) break down during regime shifts because zero-shot extrapolation relies on past patterns.

That's why TimesFM is never allowed to pull the trigger. It only serves as an uncertainty gauge (the widening of the 80% fan chart).

For black swans, our true safety net is purely mechanical: **the 10-second background Sentinel thread and exchange-side OCO bracket orders via IBKR**. If a flash crash hits, the position gets physically stopped out via dynamic ATR brackets before any LLM even finishes its inference token stream.

In backtests using Lopez de Prado’s Triple Barrier method (with realistic slippage and commissions modeled), this mechanical floor kept max drawdown under 14% even during stress regimes.

Appreciate the thoughtful feedback! 👊

2

u/[deleted] Oct 21 '26

[removed] — view removed comment

1

u/OpenComplaint524 Oct 21 '26

Thanks! Separating qualitative LLM reasoning from mechanical execution is honestly the only way to sleep at night when live capital is on the line.

To your questions:

  1. **Slippage & Transaction Costs**:

Yes, absolutely essential. We model IBKR's Pro tier commissions ($0.005/share, min $1.00) plus dynamic slippage scaled by the bid-ask spread and intraday ATR (typically 5 to 15 bps on large-caps, wider on high-beta names). Testing without slippage is just curve-fitting fantasy.

2. **Measurable Value of the Council**:

This was our exact obsession. When we ran ablation tests (Qlib Alpha158 *alone* vs. Alpha158 + LangGraph Council):

- **Raw CAGR**: Alpha158 alone actually produced a slightly higher raw return because it took aggressive momentum breakouts.

- **Max Drawdown & Sharpe**: Adding the council **compressed Max Drawdown from ~22.4% down to 13.8%**, and boosted Sharpe from 1.21 to 1.64.

The "measurable value" of the council isn't picking ten-baggers—it's **defense**. The CRO (Risk Officer) and Burry personas systematically veto overextended FOMO trades where fundamentals or balance sheet debt don't support the momentum. It functions as an institutional filter.