AI Trading System

Genetic algorithm engine for options strategy discovery. 666,700 lines of Python, 283+ audit probes, sub-5ms execution.

The audit layer is the point. 283 probes across every data path are what caught this system quietly ranking money-losers as its most robust picks — the aggregate looked flawless until the data was sliced by category. That verification discipline, not the model, is the transferable skill — the same model-risk and control rigor a bank already runs on any high-stakes number.

BY THE NUMBERS
0
lines of Python
0 / 0
test files / test functions
0+
audit probes
0
commits
<5ms
execution latency
0/gen
25 islands
ARCHITECTURE
Data Ingestion PostgreSQL + market feeds
Feature Engine 67 specialized modules
Evolution 25 islands x 100 genomes
Fitness Eval Walk-forward validation
Risk Gate Greeks + VaR/CVaR
Execution Order routing + fills
283 probes — nothing leaves without passing
midrun_sanity → early warning (kill/continue) data_corruption_audit → 283 probes, 12 categories audit_gate → final PASS/FAIL
THE BUG THAT ALMOST SHIPPED
$ python scripts/data_corruption_audit.py --scope fitness
PROBE FT-007: fitness_score_inversion
47 genomes ranked money-LOSERS as "most robust"
Root cause: scoring statistical artifact, not profit
Averages: flawless. Distribution: catastrophically wrong.
VERDICT: FAIL — audit halted evolution run
The averages looked perfect. Only a full audit — sliced by category — exposed it.
THREE-LAYER AUDIT SYSTEM
Layer 1 — Early Warning
midrun_sanity
Early warning during evolution runs. Kill/continue decision. Prevents wasted compute on corrupted data.
Example Probe
$ python scripts/midrun_sanity.py --run-id 0421 PROBE MR-012: island_population_variance Island 7: variance = 0.0001 (threshold: 0.01) All 100 genomes converged to identical strategy ACTION: Kill island 7, reseed from island 3
Layer 2 — Exhaustive Sweep
data_corruption_audit
283 probes across 12 categories (S-T-P-F-E-G-H-K-D-X-W-U). Exhaustive sweep of every data path.
Example Probe
$ python scripts/data_corruption_audit.py --category F PROBE FT-007: fitness_score_inversion Checking 2,500 genomes across 25 islands... 47 genomes ranked money-LOSERS as "most robust" Root cause: scoring statistical artifact, not profit VERDICT: FAIL — audit halted evolution run
Layer 3 — Final Verdict
audit_gate
Final PASS/FAIL verdict before any campaign launch. Integrates all audit layers into a single go/no-go decision.
Example Probe
$ python scripts/audit_gate.py --campaign Q2_OPTIONS Integrating audit layers... midrun_sanity: PASS (0 issues) data_corruption: PASS (283/283 probes clean) backtest_validation: PASS (walk-forward Sharpe = 1.47) risk_constraints: PASS (VaR within 2% limit) AUDIT GATE: PASS — campaign cleared for paper trading
THE FAILURE YOU NEVER SEE
$ python scripts/data_corruption_audit.py --scope dead-code
PROBE DC-003: dead_function_detection
130 functions completely dead — each throws an error
that is caught and logged below the level anyone reads
They looked wired up. They produced nothing. For weeks.
PROBE DC-007: alarm_connectivity
The alarm built to catch dead code was itself wired to nothing.
VERDICT: FAIL — 130 dead paths + 1 dead alarm
AI-built systems rot silently. Fail loud, fail closed, prove it ran — with data.
KEY INSIGHT

The averages looked flawless. The distribution was catastrophic.

An audit caught a scoring bug that ranked money-losers as the most “robust” picks. Every summary metric said the run was healthy — only slicing the results by category exposed it. And every earlier run had carried the same flaw, unnoticed.

Aggregate view
“Looks healthy.”  ✓
Sliced by category
Money-losers ranked #1.  ✗

Verify with data — and check the distribution, not the average.

QUALITY ENGINEERING
175-probe coverage audit baseline
Round 1-6 red-team probe development (60 → 90 → 112 → 134 → 161 → 180+)
Pre-paper-trading runbook sign-off required before any campaign goes live
Bandit security scanning, mypy type checking, ruff linting