From 2bc9cc105efd8bbfd6913263d52bfda9b7f6911b Mon Sep 17 00:00:00 2001 From: Matt Spinola Date: Thu, 16 Jul 2026 16:51:11 -0400 Subject: [PATCH] registry: add 5 held-out generalization markets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add markets never touched by the CMR deploy selection, so the strategy can be scored on genuinely out-of-selection data (clean GENERAL evidence): Dairy (new class) DC Class III Milk 052641 Grains ZO Oats 004603 Grains KE KC HRW Wheat 001612 Equities EMD E-mini S&P MidCap 400 33874A Equities NKD Nikkei 225 ($, CME) 240741 Legacy COT pulled and verified into the store (Comm/NonComm legs present, ~24–36y each: Milk 1997→, Oats/KC-Wheat 1998→, MidCap 2002→, Nikkei 1990→). NKD legacy currently ends 2026-03-03 (the $-Nikkei contract may be winding down at CME). Prices + contract specs are the remaining step and are Norgate/Windows-only: cotdata-update --prices --metadata --symbols DC ZO KE EMD NKD Golden registry tests updated for the intentional +5 (count 42→47, Equities 4→6, new Dairy class, identity checksum). Co-Authored-By: Claude Opus 4.8 --- src/cotdata/registry.yaml | 18 ++++++++++++++++++ tests/test_registry.py | 11 +++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/cotdata/registry.yaml b/src/cotdata/registry.yaml index 3aa2999..4ed7646 100644 --- a/src/cotdata/registry.yaml +++ b/src/cotdata/registry.yaml @@ -9,6 +9,12 @@ Equities: cftc_code: "239742" hist_codes: - "23977A" + # Held-out generalization markets (never in the deploy selection) — collected here + # so the strategy can be scored on them; cot-analyzer flags them role: heldout. + EMD: # E-mini S&P MidCap 400 (CME) + cftc_code: "33874A" + NKD: # Nikkei 225 ($-denominated, CME) + cftc_code: "240741" Metals: GC: @@ -43,6 +49,18 @@ Grains: cftc_code: "007601" ZW: cftc_code: "001602" + # Held-out generalization grains (new symbols, never in the deploy selection). + ZO: # Oats (CBOT) + cftc_code: "004603" + KE: # KC HRW Wheat (Kansas City, CME) + cftc_code: "001612" + +# Dairy — a genuinely new asset class for the held-out generalization test: real +# commercial hedgers, never touched CMR selection. Collected here; cot-analyzer +# flags it role: heldout. +Dairy: + DC: # Class III Milk (CME) + cftc_code: "052641" Currencies: 6E: diff --git a/tests/test_registry.py b/tests/test_registry.py index 68bb6a0..5ae156b 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -11,7 +11,7 @@ # ── loading & basic shape ──────────────────────────────────────────────────── def test_registry_loads_all_symbols(): symbols = all_symbols() - assert len(symbols) == 42, f"Expected 42 symbols, got {len(symbols)}" + assert len(symbols) == 47, f"Expected 47 symbols, got {len(symbols)}" def test_basic_symbol_loading(): @@ -49,9 +49,12 @@ def test_hist_code_scales_normalization(): def test_by_asset_class(): equities = by_asset_class("Equities") - assert len(equities) == 4 + assert len(equities) == 6 # ES NQ YM RTY + held-out EMD, NKD assert all(eq.is_equity for eq in equities) + dairy = by_asset_class("Dairy") # new held-out class + assert [d.internal for d in dairy] == ["DC"] + crypto = by_asset_class("Crypto") assert [c.internal for c in crypto] == ["BTC", "ETH"] @@ -59,7 +62,7 @@ def test_by_asset_class(): # ── hashability (frozen dataclass must stay hashable, incl. scaled hist_codes) ─ def test_symbols_are_hashable(): # Would raise TypeError: unhashable type 'list' if hist_codes held a list. - assert len(set(all_symbols())) == 42 + assert len(set(all_symbols())) == 47 assert symbol("LBR") in {symbol("LBR")} hash(symbol("LBR")) # scaled hist_codes — the tricky one @@ -148,5 +151,5 @@ def test_golden_identity_checksum(): (registry.yaml carries FIXED identity only; unintended drift is a bug).""" ident = sorted((s.internal, s.cftc_code, s.asset_class) for s in all_symbols()) digest = hashlib.md5(repr(ident).encode()).hexdigest() - assert digest == "e14ab3bad0f67741a95f721d4eff5ada", ( + assert digest == "427c5d59ee4a2e5a09fd7dc6f8b5103a", ( "registry identity facts changed; update the expected checksum if intended")