BrickerP
Order path of the live trading system Eight stages left to right: Massive market data, intraday scanner, factor filter, Alpaca bracket orders, SQLite execution ledger, S3 Parquet warehouse, AWS Lambda publisher, and the public dashboard on CloudFront and S3. A startup reconcile loop joins the broker and the ledger. Below the ledger, a struck-through backfill cron that ran every five minutes and held the write lock, removed on 2026-10-09. ORDER PATH, LEFT TO RIGHT · ONE HOST · ONE WRITER MARKET DATAMassive SCANNERintraday batches FACTOR FILTERreject reasons BROKERAlpaca brackets LEDGERSQLite, 1 writer WAREHOUSES3 Parquet PUBLISHERAWS Lambda · CAS DASHBOARDCloudFront + S3 STARTUP RECONCILE · BROKER ↔ LEDGER HELD THE WRITE LOCK BACKFILL CRON · EVERY 5 MIN removed 2026-10-09 SSM-ONLY DEPLOYS · SECRETS IN SSM PARAMETER STORE · AFTER-CLOSE WATCHDOG STRATEGY, POSITIONS AND P&L NOT SHOWN

Technical sheet № 01 · Programme insert

Sheet № 01
Printed 2026-10-09
Live trading execution

执行

Execution

Technical sheet · Programme insert

Live trading execution

Private system · Strategy, universe, positions and P&L stay private

A private live-trading system on AWS that scans intraday, filters by factor, and routes bracket orders through Alpaca into a SQLite execution ledger. This sheet prints the order path, the invariants that keep it safe, and one measured regression with its method. Every number here carries its method line.

Role
Co-engineer · since Apr 2026
Broker
Alpaca · bracket orders
Market data
Massive
Live store
SQLite · one writer
Warehouse
S3 Parquet
Publisher
AWS Lambda → CloudFront / S3

Featuring fill-dedupe keys · startup reconcile · bracket / OCO · flag-gated routing · after-close watchdog · SSM-only deploys · content-addressed snapshots


01System

Eight stages · what each one is responsible for
StageResponsibilityNotes
Market dataIntraday feed into the scanner.Massive
ScannerBatches the universe each cycle. Event-based waits instead of polling; warm-cache fast paths; lazy-load startup.The scan batch is the unit measured in 03.
Factor filterScores candidates. Reject reasons are vectorized so every rejection is explainable after the fact.Factors private.
BrokerBracket orders: entry plus exit legs. Live routing moved onto Alpaca behind a flag.Alpaca · IBKR route retired
Execution ledgerOrders and fills, deduped by fill key; reconciled against the broker at startup.SQLite · the subject of 03
WarehouseDurable history for research.S3 Parquet
PublisherRenders the dashboard as a pure function of content-addressed input snapshots; compare-and-set supersede; skip-unchanged publishing.AWS Lambda
DashboardPublic, immutable render with redacted live logs.CloudFront + S3 (OAC)

SQLite keeps the live state on one host as one file: one writer, no network hop inside the order path, and a single artifact to reconcile against the broker at startup. The regression in 03 is the cost of that choice the moment a second writer appears.

Era diagrams for this path, Fig.01 through Fig.06, are printed on the architecture hub.


02Execution safety

Invariant
A fill is applied to the ledger exactly once.
Mechanism
Fill-dedupe keys on the shared execution ledger.
Status
Live
Invariant
Broker and ledger agree before the first order.
Mechanism
Startup reconcile of broker state against the database.
Status
Live
Invariant
Every entry carries its exit.
Mechanism
Bracket orders with OCO legs; bracket / OCO fixes landed before the Alpaca cutover.
Status
Live
Invariant
A routing change is reversible.
Mechanism
Live routing migrated onto Alpaca behind a flag; the IB Gateway path was removed only after cutover.
Status
Live · IBKR is the retired path
Invariant
Nothing runs unattended after the close.
Mechanism
After-close watchdog.
Status
Live
Invariant
No secret lives on the host or in the repo.
Mechanism
Live secrets in SSM Parameter Store; SSM-only deploys.
Status
Live
Invariant
The public dashboard cannot leak or lie.
Mechanism
Pure function of content-addressed snapshots; compare-and-set supersede; skip-unchanged publishing; redacted live logs; CloudFront / S3 origin access control.
Status
Live
Invariant
Only one process writes the live store.
Mechanism
SQLite single writer. Broken on 2026-10-08 by a backfill cron on the same host; restored by removing the cron on 2026-10-09. See 03.
Status
Restored 2026-10-09

03Measured

Scan batch latency · before and after the write-lock fix
MetricBaseline2026-10-08 regression2026-10-09 post-fix
Scan batch latency, p95~2.4 s~9.2 sBackfill cron active≈1.55 sCron removed 2026-10-09 · measured 2026-10-12 13:26–14:59 ET · p50 0.71 s, p99 1.69 s, n=276 · morning not measured
Scan batch p95 latency over three dates Baseline about 2.4 seconds; 2026-10-08 regression about 9.2 seconds; on 2026-10-09 the backfill cron was removed from the live host; 2026-10-12 afternoon about 1.55 seconds (p50 0.71, p99 1.69, n=276, 13:26–14:59 ET; morning not measured). SCAN BATCH P95 · SECONDS 0 2.5 5 7.5 10 BASELINE 2026-10-08REGRESSION 2026-10-09POST-FIX ~2.4 s ~9.2 s ≈1.55 s · 10-12 PM
Ink points are log reads marked ~ · the vermilion rule marks the 2026-10-09 fix (cron removed)

On 2026-10-08 scan-batch p95 rose from about 2.4 s to about 9.2 s with no change to the scanner itself. The cause was a backfill cron running every five minutes on the same host. SQLite admits one writer at a time; while the backfill held the write lock, the scanner's own ledger writes queued behind it, so each batch inherited the backfill's lock-hold time.

The cron was removed from the live host on 2026-10-09. The single-writer invariant was restored. On the 2026-10-12 afternoon (13:26–14:59 ET, n=276) p95 measured ≈1.55 s (p50 0.71 s, p99 1.69 s); the morning was not measured. The 2026-10-08 baseline was 9.2 s.


04Boundary

Public

Private

  • Strategy, factors, and the symbol universe.
  • Positions, orders, and fills.
  • P&L. The dashboard shows its own daily figure; it is not reproduced on this sheet.
  • Source code, tests, and runbooks.

Ink · oxblood · one vermilion spot on warm stockPrinted 2026-10-09 · Cron removed 2026-10-09yplmicro@gmail.com