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
| Stage | Responsibility | Notes |
|---|---|---|
| Market data | Intraday feed into the scanner. | Massive |
| Scanner | Batches 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 filter | Scores candidates. Reject reasons are vectorized so every rejection is explainable after the fact. | Factors private. |
| Broker | Bracket orders: entry plus exit legs. Live routing moved onto Alpaca behind a flag. | Alpaca · IBKR route retired |
| Execution ledger | Orders and fills, deduped by fill key; reconciled against the broker at startup. | SQLite · the subject of 03 |
| Warehouse | Durable history for research. | S3 Parquet |
| Publisher | Renders the dashboard as a pure function of content-addressed input snapshots; compare-and-set supersede; skip-unchanged publishing. | AWS Lambda |
| Dashboard | Public, 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
| Metric | Baseline | 2026-10-08 regression | 2026-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 |
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
- This sheet: the order path, the invariants in 02, and the method in 03.
- The architecture hub: era diagrams Fig.01–Fig.06.
- The live research dashboard ↗, published by the Lambda in 01.
- The reel on the full programme and in the resume.
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