Skip to content
Back

Pre-Trade Compliance Checker

AI-powered fund compliance — classifies securities, resolves corporate groups, blocks non-compliant trades before execution

2026 · Solo architect and developer · Working demo
fintechAIcompliancePythonAzure OpenAI

The Problem

Every AI classification needs to be reconstructable six months later under regulatory examination. That shaped everything.

The actual task: before a fund advisor's order reaches a broker, verify it doesn't breach KAGB and BaFin rules. The math is simple — sum positions, compare ratios. The hard part is the classification work feeding the math. Which securities qualify as InvStG-compliant? Which parent company owns each issuer? These questions mean interpreting legal definitions against market data that's frequently messy, incomplete, or just wrong.

The Approach

Two layers, each doing what it's actually good at.

AI classification pipeline. Three GPT-4 Turbo prompts with KAGB definitions baked in handle the ambiguous calls. Confidence-routed: >95% auto-approved, 80–95% flagged for a human, <80% goes to manual classification entirely. A circuit breaker trips after 5 consecutive failures — I'd rather halt than cascade bad classifications into trade decisions.

Deterministic rules engine. Pure Python. Each compliance rule is one self-contained class. New rule = new subclass. No config files, no touching existing code.

The hardest piece was Konzern resolution — figuring out which entities share a parent company. Source data leaves the parent company field blank more often than not. The AI infers relationships from issuer names, LEI codes, and public filings, assigns a confidence score with cache expiry, and surfaces anything low-confidence for review instead of guessing silently.

Every classification gets logged: model version, prompt version, raw response, confidence score. Overrides require a written justification — enforced by a CHECK constraint at the database level, not a UI prompt you can click past. The audit trail exists for BaFin, not for me.

AI Classification Pipeline ISIN + Metadata GPT-4 Turbo 3 prompts Confidence >95%: Auto approved ✓ 80–95%: Review flagged ⚑ <80%: Manual human review Circuit breaker after 5 failures classified data Deterministic Rules Engine Classified Positions Rules Engine InvStG · Konzern · Custom Pass / Fail Audit Log ✓ Konzern cache GLEIF 365d · AI 30d
Two-layer architecture: AI classification feeds the deterministic rules engine.

The Outcome

Working demo against a representative fund portfolio. InvStG compliance calculates correctly across mixed security types. The Konzern concentration rule groups positions by resolved parent company and blocks trades that would breach the 10% issuer limit. Output follows the Prüfung format that compliance officers actually expect to see.

The Constraint That Shaped Everything

If BaFin examines a trade from six months ago, the system has to show exactly why that position was classified the way it was. Which model. Which prompt version. What confidence score. Who approved it. That one requirement is why the classification log is immutable, why overrides need justification, and why I picked a deterministic rules engine over something more flexible. Auditability isn't a feature — it's the architecture.