Inspiration

Trading research often gets split across disconnected tools: one system for backtesting, another for market news, another for notes, and another for execution. We wanted to explore what a more coherent research workflow could look like—one where quantitative evidence, market regime, current external information, and prior research context can all be brought together without letting an LLM become the trading strategy itself.

What it does

Fin Trading Brain is an agentic semiconductor research system. It combines a deterministic quantitative engine with regime-aware risk controls, external research, and persistent memory.

The system can rank semiconductor candidates, evaluate the current QQQ market regime, surface risk and cost-sensitivity information, retrieve relevant external evidence through Bright Data, recall prior research through Cognee, and synthesize everything into a structured research brief. It also saves reproducible JSON artifacts for later analysis.

The current system is research-only and does not autonomously place trades.

How we built it

We built the project in layers.

The core Alpha Lab engine is written in Python and handles portfolio backtesting, shared-capital position sizing, next-session execution assumptions, slippage, stop/max-hold/reversal exits, walk-forward validation, parameter sweeps, symbol attribution, regime analysis, and rolling 10-day performance analysis.

We then added a deterministic QQQ SMA50 regime gate after research showed that the strategy performed much worse in negative broad-tech market regimes.

On top of the quantitative engine, we built an agent layer designed around Strands. Alpha Lab remains the source of quantitative truth, while Bright Data is used for current web research and Cognee is used for persistent research memory. The agent produces structured daily research briefs and CLI outputs rather than making trading decisions on its own.

We also used QuantConnect/LEAN as an independent execution-validation environment to test whether our backtesting assumptions behaved realistically.

Challenges we ran into

One of the biggest challenges was execution realism.

An early QuantConnect implementation produced extremely strong returns, but deeper inspection showed that asynchronous order state was causing duplicate entries and unintended exposure. Instead of treating the result as alpha, we traced the problem to execution-state handling and rebuilt the order workflow around confirmed portfolio state.

We also found that the strategy was highly sensitive to transaction costs. A configuration that looked strong at zero slippage deteriorated significantly as friction increased.

Another challenge was parameter instability. The best parameter set in one walk-forward period was not consistently best in others, which pushed us away from further optimization and toward simpler structural risk controls.

Finally, integrating multiple external systems required graceful fallback behavior so the project could remain functional even when Bright Data, Cognee, or Strands credentials were unavailable.

Accomplishments that we're proud of

We built the system around research discipline rather than headline backtest returns.

The project now includes a shared-capital portfolio backtester, 64-configuration parameter sweep, walk-forward validation, cost sensitivity analysis, benchmark comparison, drawdown diagnosis, symbol attribution, deterministic regime controls, agent tooling, structured research artifacts, and independent execution validation.

A particularly important result was identifying the strategy’s main failure mode: clustered long semiconductor exposure during negative broad-market regimes. The QQQ SMA50 gate materially reduced exposure and improved the 2022 drawdown period while remaining profitable under moderate simulated transaction costs.

The repository currently has 46 passing automated tests.

What we learned

The biggest lesson was that a trading system should not be judged by its best backtest.

We learned that execution details, costs, regime dependence, and out-of-sample stability can completely change the interpretation of a strategy.

We also learned that an LLM is more useful as a research orchestrator than as a direct price-prediction engine. Quantitative signals and risk controls are more trustworthy when they remain deterministic, while the agent focuses on gathering context, recalling previous research, and explaining the evidence.

Most importantly, independent validation caught mistakes that would have been easy to miss in a single backtesting engine.

What's next for Fin Trading Brain

Next, we want to complete live validation of the Bright Data, Cognee, and Strands integrations and strengthen the research workflow with source deduplication, catalyst extraction, citation quality scoring, and outcome tracking.

On the quantitative side, the next work is focused on execution realism: regime-transition handling, liquidity and volume filters, sector and beta exposure controls, and deeper Alpha Lab versus QuantConnect reconciliation.

Longer term, the goal is to move from a research assistant into a robust paper-trading research platform while keeping deterministic risk controls and human approval between research conclusions and any real-world execution.

Built With

  • agentic-ai
  • algorithmic-trading
  • alpaca
  • amazon-bedrock
  • bright-data
  • cognee
  • python
  • quantconnect
  • strands-agents
Share this project:

Updates

Submission history