Selected engineering work / Case study

Local-first quantitative research operating system

Apex

One engineer’s system that watches four kinds of markets, keeps what it observes and every decision it makes as permanent evidence, records the gaps it could not capture, and tests ideas honestly before any simulated trade.

Crypto, event markets, securities and options, collected on schedules wherever the data and credentials allow; the few operator-driven parts are labelled. Built end to end: collectors, the evidence schema, the research and decision pipeline, safeguards, accounting and the console.

Research and simulated capital only. Apex has no live trading path. Simulated (PAPER) results are engineering evidence, not performance.

Scope, counted from Apex’s own record

  • Verified totals load from the published evidence once its hash checks pass.

Platform mapFour markets, one evidence store.

Select a market to light the path it genuinely takes. Select a subsystem to see what it does, how it is built and which markets use it. Paths are different lengths because the markets are at different depths.

The interactive map needs JavaScript. The capability matrix below gives the same facts as a table.

MarketsSame machinery, honestly different depth.

Every market is observed through the same evidence layer, but they are not equally mature. This matrix states where each one stops.

The matrix needs JavaScript.

Research and evidenceHow an observation becomes a conclusion you can audit.

The hard part is making the record impossible to quietly change, and refusing to let hindsight into a decision.

Walk through From observation to promotion gate

Try it Point-in-time boundary Abstract mechanism illustration · no market data

A decision may use a record only if it was available before its cutoff. Move the cutoff, then let a correction arrive late.

Retained The research ledger

Every hypothesis, trial and conclusion is kept, rejections included.

Retained Counterfactual decisions

Every decision is kept, and later facts are attached to it, accepted or rejected.

Predeclared Strategy rules and the cost model

The rules and the cost assumptions are fixed before evaluation. A rule moves toward PAPER only through an evidence-bound gate.

Follow the evidence day by day in the Explorer → · See the PAPER gate →

Architecture · technical depthPure rules in the middle, the outside world at the edge.

Dependencies point one way. The domain contains money, time and risk rules and imports nothing else, so every financial rule can be tested without a database, a clock or a network.

  1. InterfacesCommand line and a local HTTP API behind the React Operator Console. State-changing routes require a local origin and an idempotency key.Read-mostly operator surfaces
  2. AdaptersPostgreSQL repositories, bounded public-data clients, worker runners, report writers. Every external boundary is allow-listed and read-only unless a reviewed exception says otherwise.The only layer that touches the outside
  3. ApplicationUse cases and orchestration: authorize, execute, reconcile, and the recurring operating cycle. Depends on the domain, never on adapters.Sequencing
  4. DomainDecimal money, point-in-time information sets, the risk kernel, ledger rules, strategy and research semantics. No I/O of any kind.Pure rules

Each layer depends only on the layer below it.

    Six rules that never switch off

    • Exact decimals. Money, price, quantity, fee and probability are Decimal values. Floats, not-a-number values and exponent strings are rejected.
    • Append-only evidence. Database triggers reject updates and deletes. A correction is a new row that references the old one.
    • One ledger authority. Only the double-entry ledger posts cash, fees and profit or loss, and every journal balances.
    • Point-in-time data. Strategies receive an immutable information set, never a repository.
    • Authority NONE. Research and observation records carry no authority to trade, enforced by a database check.
    • Idempotent by identity. Every record has a deterministic identity, so replaying a cycle reuses evidence.

    Six gates before a change is done

    1. 1FormatOne command may rewrite source; the rest only check.
    2. 2LintStatic analysis with the repository rule set.
    3. 3Strict typingmypy --strict over the whole tree.
    4. 4Offline suiteUnit, property and security tests, including pinned report hashes.
    5. 5Real-database suiteMigrations, atomicity, concurrency and downgrade guards on real PostgreSQL.
    6. 6Whitespace checkgit diff --check before anything counts as finished.

    Stack Python 3.12 · mypy --strict · PostgreSQL · Alembic · SQLAlchemy · Docker Compose · Linux · systemd · React · TypeScript · Vite · double-entry ledger · property-based tests

    Open the engineering journey in the Explorer →

    Case studiesReal records, labelled by what they prove.

    Each case says whether it shows a platform-wide capability or the result of one specific experiment. The BTC-USD trial is the second kind.

    Autonomy and safeguardsScheduled, and safe to run twice.

    Two systemd timers start small, bounded passes. Each task decides whether it is due, a failure stays contained, and a repeated pass changes nothing. Coverage is not complete: options capture needs credentials, securities PAPER is operator-driven, and the host must be up. Break the scheduler below and watch what it refuses to do.

    Try it The scheduler, on its real tasks Simulated outcomes · recorded history is real

    Eight safeguards

    The authority boundary

    Authority only ever narrows as it moves toward money. The last rung does not exist in the code.

    Reliability and operational history

    The complete record of when Apex stopped observing. Nothing here has been smoothed or hidden.

    Explore outages and recovery in the Explorer →

    Operator Console · technical depthThe real interface, four screens.

    Genuine captures of the React console an operator uses, running against a sanitized, read-only copy of Apex’s recorded history. Each image is hash-checked in your browser before it is shown.

    BoundariesA research platform, not a trading product.

    • Real data, simulated capital. Apex observes real public markets. PAPER trials use simulated capital or a broker’s simulation host. No code path places a live order.
    • Research outcomes. Most strategy research so far has been rejected or exploratory. Nothing here is evidence of trading edge.
    • Depth differs by market. See the matrix: options are research only, and event-market PAPER has no orders in the retained record.
    • Maturity. It runs on one local machine and only while that host is awake. Historical equity universes are survivorship-limited.
    • Public material. The Explorer and the captures are a static snapshot of Apex’s own record with no live feed. Third-party market data is not republished. The production system and its infrastructure stay private.

    Next: ArenaOps, a cloud backend that slept until someone needed it.