Navigation

Iteration 05 · 2026-06-09 · driver: native Claude Code /loop (laptop run)

Feature #4 — kendall_taub_ret_spread (PR #94)

← Dashboard · PR terrylica/mql5#94 · card 79 · cut off bootstrap #90

Done. The fourth ξ-confirmed candidate — the FIRST two-input ("ret_spread") substrate and the first copula-dependence feature — is a REAL continuous-float production column on 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 FOSS corroboration. PR #94 open (base main; diff auto-cleans once #90 + #91 + #92 + #93 land).

What it computes

Kendall's tau-b (Kendall 1945, DOI:10.1093/biomet/33.3.239) between the per-bar signed mid log-return (X) and the per-bar spread in bps (Y) over the 200-bar strictly-trailing window. Causal: the window is the 200 bars BEFORE bar i (current bar excluded). Value ∈ [−1, 1]. None on warmup (<10 both-finite pairs) or an all-tied window. First two-input substrate: X = ln(close)−diff (8 h weekend/Ouroboros gap-nulled, like #1), Y = spread_close/close·1e4 (per-bar, never gap-nulled); a both-finite pair mask drops any gap-nulled logret pair.

The chain — one SSoT, bit-exact to the column

LayerArtifactResult
Python SSoToracle_kendall_taub_ret_spread.pyscipy.stats.kendalltau(variant="b").statistic over the ret_spread window (scipy≥1.13 BSD-3), bit-faithful to the probe's k_kendallsha-pinned jsonl (12000 rows, 11200 finite) + .sha256 sidecar
Rust kernelorthogonal_extension_kernels::kendall_taub_ret_spread — INTEGER-EXACT concordant/discordant/tie counts (O(n²) strict-discordance + tie-run sums) → S/√(tot−xtie)/√(tot−ytie) clamped to [−1,1] (scipy's exact two-sqrt/two-division order); no transcendentals beyond f64::sqrt, no new depclippy clean
Differential parityvs the pinned oracle on the frozen fixture11200 == oracle, 12000 bars == rows, max|dev| 2.78e-17 (≈1 ulp — tightest of all 4 features)
Producer columnBarOrthogonalExtV1 { kendall_taub_ret_spread } + BarRow + schema.sql Nullable(Float64) CODEC(Gorilla(8),ZSTD(1)) + feature_metadata.yamltest_schema_contract 4/4
Producer populateKendallTaubRetSpreadRollingState — 200-bar ring of (logret, spread_bps) pairs + prior close/close-time; read-before-push observe(close_mid, spread_close, open_time_us, close_time_us) @ finalize
batch≡streamingstreaming observe() over the fixture per partition11200 == oracle, max|dev| 2.78e-17 (identical to batch)
3-way FOSSscipy vs independent clean-room numpy sign-outer-product tau-bPASS — 0 value-mismatches, 0 None/Some, max|dev| 0.000e+00 / 11200

3-way FOSS finding (it earned its keep)

scipy is the canonical tau-b and no second mainstream Python library implements it independently (pandas/pingouin all wrap scipy). So the independent leg is a from-scratch clean-room numpy estimator sharing NO code with scipy: the concordant-minus-discordant count via a dense sign outer-product np.sign(x[:,None]−x)·np.sign(y[:,None]−y) summed over the strict upper triangle, and the x/y tie-pair sums via np.unique(…, return_counts=True) — a different algorithm from scipy's O(n log n) lexsort + Fenwick inversion counting. They agree bit-for-bit (max|dev| 0.000e+00) across all 11200 windows: the integer concordance counts are identical and the final S/√/√ expression matches in order. Triangulates with Rust==scipy at 2.78e-17 ⇒ scipy == clean-room numpy == Rust.

Challenge-and-Held (inline; sub-agent dispatch skipped per the tick-3 signal)

Gates / scope

Next

Feature #5 — lziv_complexity_signs (card 40, LZ76 complexity of the log-return sign sequence, EXACT count + ε on the normalization).

Presentation only — never the SSoT.