Iteration 09 · 2026-06-09 · driver: native Claude Code /loop (laptop run)
← Dashboard · PR terrylica/mql5#98 · card 83 · cut off bootstrap #90
fxview_cache.forex_bars: bit-exact Rust verified against a pinned Python SSoT, populated through the wired producer, with batch≡streaming parity and an independent 3-way FOSS corroboration. PR #98 open (base main; diff auto-cleans once #90–#97 land).
Shannon entropy rate (bits, in [0,1]) of a first-order 2-state (up/down) Markov chain over the binarized sign sequence of the per-bar mid log-return across the 200-bar strictly-trailing window — an information-theoretic predictability measure (0 = perfectly predictable sign chain, e.g. strict alternation; 1 = maximally unpredictable). Causal: the window is the 200 bars BEFORE bar i (current bar excluded). None on warmup (<16 finite trailing signs) OR a degenerate single-state window (pi[i]==0). H = −Σi statp[i] Σj P[i,j] log2 P[i,j] where the 2×2 transition counts are integer-exact (i64), P (row-stochastic) + statp (empirical from-frequency) are exact rationals, and only the final log2 + products are float (card 83 tier EXACT counts, ε on log2). Substrate = "signs" = np.sign(logret) over the gap-nulled mid log-return (logret = ln(close)−diff, 8 h weekend/Ouroboros gap-null — identical to anderson_darling_a2 / lziv_complexity_signs); (s>0) → bit 1 iff up-bar (flat OR down → 0). No new dep (f64::log2).
| Layer | Artifact | Result |
|---|---|---|
| Python SSoT | oracle_sign_two_state_entropy_rate.py — bit-faithful reproduction of probe k_sign_entropy_rate over the "signs" 200-bar window | sha-pinned jsonl (12000 rows, 11200 finite) + .sha256 sidecar |
| Rust kernel | orthogonal_extension_kernels::sign_two_state_entropy_rate — integer 2×2 i64 transition counts + row-stochastic P + statp + −Σ statp·P·log2 P; no new dep | clippy clean; 6 unit tests pin probe behaviour |
| Differential parity | vs the pinned oracle on the frozen fixture | 11200 == oracle, 12000 bars == rows, max|dev| 1.110e-16 |
| Producer column | BarOrthogonalExtV1 { sign_two_state_entropy_rate } + BarRow + schema.sql Nullable(Float64) CODEC(Gorilla(8),ZSTD(1)) + feature_metadata.yaml | test_schema_contract 4/4 |
| Producer populate | SignTwoStateEntropyRateRollingState — 200-bar sign ring + prior close/close-time (gap-null like lziv); read-before-push observe(close_mid, open_time_us, close_time_us) @ finalize | — |
| batch≡streaming | streaming observe() over the fixture per partition | 11200 == oracle, max|dev| 1.110e-16 (identical to batch) |
| 3-way FOSS | probe-form vs clean-room conditional-entropy decomposition vs pyitlib H(Xt|Xt−1) (ML) | PASS — 0 mismatches, max|dev| 2.220e-16 (clean-room) / 5.551e-16 (pyitlib) / 11200 |
The 2-state Markov entropy rate is corroborated THREE independent ways: the probe-form (SSoT; statp·P·log2 grouped by transition), a from-scratch clean-room conditional-entropy decomposition H = Σx p(x) H(next|x) via plain dict accumulation (no shared code with the probe; agrees at 2.220e-16), and pyitlib drv.entropy_conditional(b[1:], b[:−1], base=2, estimator='ML') (agrees at 5.551e-16). The FOSS trap: the candidate card lists NPEET, but NPEET is a kNN CONTINUOUS-entropy estimator — the wrong tool for a discrete 2-state chain. The correct discrete FOSS reference is pyitlib (MIT): its empirical (plug-in / ML) conditional entropy H(Xt|Xt−1) is identically the probe's estimator (p(from=i)=pi[i]/(n−1)=statp[i], p(to=j|from=i)=P[i,j]) — i.e. the Markov entropy rate of a first-order chain IS the one-step conditional entropy. The errata is carried through the oracle, kernel, schema COMMENT, metadata + this FOSS leg.
observe() forms this bar's sign from close_mid + the prior close/close-time (gap-null), reads the entropy rate over the trailing 200 signs BEFORE this bar, then folds this bar's sign in; a gap only NaN's that bar's sign (dropped by the kernel's finite filter — NO reset). Residual: live bigblack producer-vs-oracle smoke (no CH/MT5 on laptop — deferred to operator).None via pi[i]==0 (a state never seen as a transition source); <16 finite signs → None, ==16 computes; NaN (gap-null) signs filtered before binarization; H ∈ [0,1]; mixed-n20 → 0.94600887. The 2×2 transition counts are i64 (exact); only the log2 is float.mise run check:all-gates green on macOS except (a) worktree-context check:git-hook-installed and (b) the STANDING foreign research-orthogonality substrate-skip (see handoff). feature-metadata:verify-offline PASS.CompletedBar field required a 1-line Default::default() in 9 explicit literals (2 blocklisted test files) — exact-match on the stripped literal opener, so -> CompletedBar { return-type lines are never touched. Same pattern as #91–#97.sign_two_state_entropy_rate; field-unions with #91–#97 at operator merge. Merge order: #90 → #91 → #92 → #93 → #94 → #95 → #96 → #97 → #98.research-orthogonality substrate-skip recurs as a STANDING foreign item (first surfaced #92; rust-enhancement loop follow-up; scripts/research/ untouched — 0 files).Feature #9 (final implementable) — spectral_log_slope (card 75, PSD log-spectral slope via rfft + OLS log-log; ε ~1e-6; FFT — match libm primitive).
Presentation only — never the SSoT.