CASE STUDY · AI-ASSISTED SOFTWARE ENGINEERING · PYTHON

STMAA: directing the development of a complex software system with AI

A personal R&D project that turned an ambitious goal — building a systematic-trading framework — into a structured process covering requirements, architecture, AI-assisted development, testing, operational controls and documented audits.

Context and challenge

STMAA (Structural Trading Multi-Agent Architecture) started as an experimental project for quantitative research, portfolio-weight generation, backtesting, risk controls and broker integration in a Paper environment. The challenge was not simply to implement a strategy: it was to coordinate interdependent components and make data, decisions, operational state, results and limitations verifiable.

The project was developed by one person through an iterative workflow with AI assistants. This required a method for breaking down complex goals, maintaining context, controlling changes and distinguishing generated code from software that had actually been verified.

My role

I directed the project and coordinated its AI-assisted development lifecycle. My contribution focused on:

The code was produced through an AI-assisted workflow. I do not claim to have manually written every component: the documented contribution is the ability to define the problem, direct the process, evaluate outputs and require proportionate verification.

System architecture

The framework separates its main responsibilities: market-data ingestion and validation, feature engineering, PPO strategy, risk overlay, execution engine, state persistence and monitoring.

  • Market data and validity/freshness checks.
  • Strategy and portfolio-weight generation.
  • Position, exposure and drawdown limits.
  • Separation between research logic and broker integration.
  • SQLite persistence, events and execution lifecycle.
  • Terminal dashboard with local read-only providers.

Stack and tools

Python 3.12, PyTorch, Stable-Baselines3, Gymnasium, pandas, NumPy, SQLite, the Alpaca Paper API and the Textual terminal interface. The quality workflow includes pytest, Ruff, GitHub Actions and security checks such as Gitleaks, Bandit and Semgrep.

The repository also contains technical documentation, versioned contracts, benchmark reports, operational runbooks and regression tests.

Development and control method

Work was organised into short, verifiable cycles:

A central project rule is fail-closed behaviour: when critical data or state is missing, stale or inconsistent, the affected path must be blocked rather than assuming favourable conditions.

Scale and verifiable evidence

At the documented 5 December 2026 baseline, the repository contained 276 tracked files: 76 application Python files and 139 Python test files.

Quantitative results and what they do not prove

The documented quantitative validation included 11 folds and three PPO seeds (42, 7 and 21), for 33 runs. Results showed seed sensitivity and did not establish a robust, generalisable strategy advantage over benchmarks. Reported averages are descriptive per-fold figures, not chained or compounded returns.

For this reason, STMAA is not presented as a profitable trading system. Controlled Paper validation remains open: P4.1 passed the shadow pilot, while P4.2 is blocked after a fail-closed check stopped an attempt before submission was confirmed because of invalid price data. Further PPO research is deferred and frozen.

Skills and learning demonstrated

The main lesson is that AI can accelerate software production, but it does not replace the responsibility of defining scope, evaluating evidence and deciding when a result is genuinely acceptable.

Project status and limitations

STMAA remains an experimental/alpha project. It is not certified, is not declared production-ready or live-trading-ready, does not manage client capital and has not demonstrated profitability. Tests and internal audits cover specific scopes and are not equivalent to independent validation or an absolute security guarantee.