iteration 01 · preflight + bootstrap · crypto cost-realism labels · 2026-07-14
Loop is live — tracking issue opened, journal activated, PR-A workbench ready PREFLIGHT DONE
← campaign board · tracking issue #614
In plain language — what happened this iteration
What is this project, in one breath? Our crypto price bars tell us what the market did, but not what it would have cost us to actually trade at each moment. We are adding eight "cost-realism labels" to every bar: numbers that record the worst price a buyer or seller would have gotten if their order executed with a realistic 3-second delay, plus fair-price benchmarks (TWAP, VWAP, arrival price) and a total round-trip cost estimate including exchange fees. These labels let our machine-learning models learn which trading signals survive real-world costs — and which only look profitable on paper.
What got done today? The groundwork. We opened the official tracking ticket (issue #614) that every new database column will reference; we flipped this campaign's journal from "waiting for approval" to ACTIVE (the supervisor authorized the work on 2026-07-11); we set up an isolated workbench (a git "worktree") so nothing touches the main codebase until a pull request is reviewed; and we did a deep read of every design document — the architecture decision record, the nine safety guards, the proven "oracle" testing template we will clone, and the sample market data (10,001 real Bitcoin trades and 10,001 real Ethereum trades from 2025-09-01) that all our correctness proofs will run against.
What's next? Writing the "oracle": a small, independent Python program that computes the eight labels the slow-but-obviously-correct way. Later, the fast production code (written in Rust) must reproduce the oracle's answers to within a billionth — or exactly, bit for bit, where the math allows. Two implementations, written separately, agreeing perfectly: that is how we prove the numbers are right.
Grounded this iteration
Preflight per LOOP_CONTRACT.crypto-cost-realism-labels.md (v2, ACTIVE): main == origin/main @ 597d074d; tracking issue terrylica/opendeviationbar-py#614 created (title: "Crypto cost-realism labels — label_fwd_3s_* family") — its number goes into every column COMMENT per HANDOFF hard-req 2. First journaled write: LOOP_LEDGER.json status SCAFFOLDED → ACTIVE, phase → P1_PR_A_ORACLE, gate note updated. PR-A worktree at .claude/worktrees/labels-pr-a-oracle on branch feat/labels/pr-a-oracle off origin/main. Python 3.14 venv + maturin develop build green. Eight parallel readers mapped: ADR window/naming/NULL semantics, guard suite A–I (D merged in #590; A/E/G ride PR-A; B/C/F/H/I ride PR-B), the bartels oracle template (sha-pin, quantize rc=2, oracle-fresh cmp -s, explicit nextest filtersets), kernel homing precedent in opendeviationbar-core, mise/slash-wrapper conventions, HANDOFF hard-reqs 1–7, iteration-page conventions, and the committed aggTrades fixture SHAs.
Artifacts + integrity pins
| Artifact | Pin / value | Note |
|---|---|---|
tests/fixtures/BTCUSDT-aggTrades-sample-10k.csv | b2f7399e928ebcc2… | 10,001 real Vision spot aggTrades, 2025-09-01, µs timestamps; spans ~580 s |
tests/fixtures/ETHUSDT-aggTrades-sample-10k.csv | b105e51f63e36be3… | 10,001 rows; spans ~394 s |
| Bar-table tripwires (guard F baseline) | 126 / 93 / 93 / 68 | ODB_RECORD_BATCH_NUM_COLUMNS / CORE_COLUMNS / dead-letter mirror / manifest count — must be UNCHANGED by both PRs |
| Entry window | tid > last_agg_trade_id AND ts_us < close+3e6 | breach trade excluded by TID; half-open µs |
| Exit window | [close+3e6, close+6e6) | 3-second hold, worst-print fills |
Decisions made (for operator review at PR time)
| # | Decision | Why |
|---|---|---|
| 1 | Cron watchdog (5 min) armed as crash-resume only; execution runs continuously in-session | Operator override 2026-07-14: active blocker; per-stage commits + ledger stay the resume points (R7) |
| 2 | Iteration pages publish live via direct campaign-folder copy to the site dir — never dashboard:deploy | Operator carve-out confirmed 2026-07-14; deploy task remains HARD STOP |
| 3 | TWAP weighting + roundtrip slippage expression to be pinned from the forex twin (~/eon/mql5, local read) | ADR is silent on both; do-not-guess rule — forex reference is the named SSoT to mirror |
Next fire picks up here
scripts/gen_labels_oracle.py (numpy, mirrors gen_bartels_oracle.py verbatim: SYMBOLS sha-pin dict, 8-dp quantize guard rc=2, out_env redirects, repr() full-float64 CSV) reading ONLY the committed BTC+ETH aggTrades fixtures; bar anchors derived by running the real OpenDeviationBarProcessor over the same fixtures (hermetic — no ClickHouse, no network); emit committed golden oracle CSVs for both symbols. Blocked-on: forex-twin TWAP/roundtrip formula extraction (reader in flight). Worktree .claude/worktrees/labels-pr-a-oracle, branch feat/labels/pr-a-oracle.