Skip to content

Author

Ali Arbab

Project

05 / Sovereign Alpha

Status

Research — built ahead of hardware

Navigate

← projects

§ 01

Pitch

Sovereign Alpha

A deterministic, fully local simulation of 2015–2025 markets for testing whether an LLM reading history can find real alpha.

Three modules in one closed loop: an LLM reads a decade of filings, Fed statements and news under versioned analyst personas and writes an Alpha Ledger; a Polars backtest engine trades on it with slippage, commissions and partial fills; an Unreal Engine 5 city visualises the result live. The rule that everything else serves is the temporal firewall — no simulated moment may see a row from its own future. The harness is built and tested on synthetic data; full-scale runs wait on hardware.

  • 3Modules in one loop
  • 6Versioned analyst personas
  • 8Architecture decisions
  • 32Test modules

As of

§ 02

Access

§ 03

Question

Can a model that reads history beat the market — honestly?

The research question is simple to state: if a reasoning language model reads a decade of SEC filings, Federal Reserve statements, economic releases and news — strictly in order, never seeing the future — can the signals it extracts beat buy-and-hold and standard factor models once slippage, commissions and partial fills are paid for?

Almost every public answer to that question is contaminated, because a backtest that can see one row of tomorrow looks brilliant and means nothing. So the project is built around making that leak impossible rather than unlikely.

§ 04

Modules

Read, trade, render.

  • Module I — extraction. Ingestion adapters for SEC EDGAR, FOMC, BLS and GDELT news; an HTML-clean → chunk → cached-encode tokenisation pipeline; and an inference layer that writes an Alpha Ledger — one row per document per entity, carrying sentiment, confidence, horizon and the persona and model that produced it.
  • Module II — the quant engine. Polars over memory-mapped Parquet, a strictly forward-only cursor, and a friction layer for slippage, commissions, partial fills and borrow costs. It reports Sharpe, Sortino, drawdown and capture ratio, then checks them with probabilistic and deflated Sharpe, bootstrap confidence intervals, walk-forward validation and purged k-fold cross-validation.
  • Module III — the digital twin. An Unreal Engine 5 city where each district is a sector and each building an asset, driven live over ZeroMQ with MessagePack on five topics. The message schemas and a mock publisher are built; the UE5 scene is next.

§ 05

Firewall

Rules that break the build.

Three invariants are treated as build failures, never as style: the temporal firewall, byte-for-byte reproducibility, and schemas as contracts.

  • The only way to merge two time series is as_of_join, backwards, on monotonic timestamps — a naive join can round a timestamp forward and leak the future silently.
  • A planted corpus of future-dated rows fails CI if any stage ever touches it, and property-based tests check that every transform keeps time moving forward.
  • Every run is identified by the hash of its corpus, persona, model, seed and lockfile. Same inputs, byte-identical outputs — that is a unit test, not a hope.
  • Every expensive stage is cached by the hash of its inputs, so changing a persona re-runs only inference, never tokenisation.

§ 06

Personas

The persona space is the search space.

Each analyst persona is a versioned TOML file. Changing one bumps its version, so every ledger row can be traced to the exact prompt that wrote it — and prompt engineering becomes something you can measure, persona against persona, in elimination brackets across rolling windows.

  • Aggressive momentum trader
  • Conservative multi-asset allocator
  • Geopolitical risk analyst
  • Hawkish Fed strategist
  • Semiconductor sector specialist
  • Risk-averse supply-chain analyst

§ 07

Decisions

Eight decisions, written down.

  1. 0001Polars over Pandas for the backtest engine
  2. 0002as_of_join is the only sanctioned temporal merge
  3. 0003ZeroMQ + MessagePack for the simulator → UE5 bridge
  4. 0004Pydantic at boundaries, Pandera in flight
  5. 0005Content-addressed caching at every pipeline stage
  6. 0006Single node, closed loop, zero cloud dependency
  7. 0007The synthetic Alpha Ledger is a first-class artifact
  8. 0008Persona definitions in TOML, parsed with the standard library

§ 08

Status

Built ahead of the hardware.

The workstation this is designed for — a 32GB GPU, 128GB of RAM and a Gen5 NVMe drive — hasn't arrived. Rather than wait, everything that doesn't need it is built: all of Module II, the plumbing of Module I, the Module III bridge, the persona library, the reproducibility hashing and the leak tests.

A synthetic Alpha Ledger generator drives the whole pipeline end to end on today's machine, and a written runbook covers the day the hardware lands: swap the stand-in model for DeepSeek-R1 32B, point it at the real corpus, run. Until then there are no results here — only a harness that can't lie about them.

§ 09

Stack

  • Python 3.12 + uv
  • Polars (as_of_join only)
  • Pydantic + Pandera contracts
  • Hypothesis property tests
  • ZeroMQ + MessagePack bridge
  • Unreal Engine 5 (twin, planned)
  • DeepSeek-R1 32B (planned)

Started · page reviewed

↑↓ navigate↵ selectESC close
15 results
Sovereign Alpha — a backtest that can't cheat — Ali Arbab — Ali Arbab