Skip to content

refactor(spy-universe): retire _MACRO_SYMBOLS SPY-special-cases (L1346 c)#224

Merged
cipher813 merged 1 commit into
mainfrom
feat/retire-spy-macro-special-case-l1346
May 28, 2026
Merged

refactor(spy-universe): retire _MACRO_SYMBOLS SPY-special-cases (L1346 c)#224
cipher813 merged 1 commit into
mainfrom
feat/retire-spy-macro-special-case-l1346

Conversation

@cipher813
Copy link
Copy Markdown
Owner

Summary

  • Remove SPY from _MACRO_SYMBOLS in executor/price_cache.py — SPY now reads from universe like any other held ticker.
  • Drop the L1346 transitional _MACRO_SYMBOLS_NO_OHLCV = _MACRO_SYMBOLS - {\"SPY\"} carve-out + SPY-specific defensive macro-fallback blocks in 3 files (price_cache.py, eod_reconcile.py, main.py).
  • Rewrite the L1346 ATR-exclusion pin test to assert the structural retirement (SPY not in _MACRO_SYMBOLS, no _NO_OHLCV derivation, no SPY-specific fallback).

Why

alpha-engine-data #245 (MERGED 2026-05-15) lifted SPY to a full universe ArcticDB member via _UNIVERSE_EXTRA = frozenset({\"SPY\"}). The transitional executor-side carve-outs preserved backwards-compat during the cross-repo soak; after Sat 5/16 + Mon 5/18 + Sat 5/24 DataPhase1 all wrote universe.SPY cleanly, the carve-outs are dead defense. Per feedback_no_silent_fails: defensive macro fallback would mask any universe.SPY gap rather than failing loud.

ROADMAP: L1886 (c)SPY → universe ArcticDB consumer retirement, executor half.

Composes with

Test plan

  • Full suite green: 1023 passed
  • L1346 pin tests rewritten to lock the structural retirement state
  • executor/main.py --dry-run gate passes (pre-push hook)
  • Next weekday morning planner (Mon 6/2 06:15 PT) — first organic exercise: ATR ticker set includes held SPY, load_atr_14_pct reads universe.SPY
  • Next EOD reconcile (Mon 6/2 ~13:15 PT) — held-position close lookup branches on the new _MACRO_SYMBOLS (SPY excluded), reads SPY from universe_lib

🤖 Generated with Claude Code

…6 c)

Remove the L1346 transitional carve-out + defensive macro.SPY fallbacks
across the executor. SPY now reads from the `universe` ArcticDB library
like any other held ticker — alpha-engine-data #245 (MERGED 2026-05-15)
lifted SPY to a full `universe` member via `_UNIVERSE_EXTRA =
frozenset({"SPY"})` written by both backfill (Saturday) and daily_append
(weekday). The transitional carve-out served its soak (Sat 5/16 + Mon
5/18 + Sat 5/24 DataPhase1 all wrote universe.SPY cleanly); the path
is now dead defense.

Changes:
- `executor/price_cache.py`: drop SPY from `_MACRO_SYMBOLS` (the constant
  becomes "executor's macro-routing list" rather than "everything in
  macro lib"; SPY is dual-written there but the executor reads from
  universe). Delete the `_MACRO_SYMBOLS_NO_OHLCV = _MACRO_SYMBOLS - {"SPY"}`
  derivation and the SPY-specific defensive fallback in `load_price_histories`.
- `executor/eod_reconcile.py`: drop the same `_NO_OHLCV` derivation +
  defensive fallback from the held-position close-lookup loop. Branch
  directly on `_MACRO_SYMBOLS` membership.
- `executor/main.py`: drop the `_NO_OHLCV` derivation; the ATR-tickers
  subtract uses `_MACRO_SYMBOLS` directly.

Tests:
- `test_l1346_spy_atr_exclusion_retired.py`: rewritten to pin the
  structural post-retirement state:
  - SPY NOT in `_MACRO_SYMBOLS`
  - main.py subtracts `_MACRO_SYMBOLS` directly (no `_NO_OHLCV` form)
  - `_MACRO_SYMBOLS_NO_OHLCV` symbol does not appear in main.py at all
  - No `if ticker == "SPY" and lib is universe(_lib)` fallback in
    price_cache OR eod_reconcile
- `test_executor_run_precompute_kwargs.py::test_main_imports_macro_symbols_from_price_cache`:
  flipped from `assert "SPY" in _MACRO_SYMBOLS` to `assert "SPY" not in
  _MACRO_SYMBOLS` + sanity-check VIX/TNX/IRX/XLK/XLF still present.

Composes with the sibling predictor PR (alpha-engine-predictor, L1346 b)
which dropped the symmetric `macro_lib` fallback from
`_verify_arctic_fresh`. Both PRs are independently mergeable.

Closes L1346 (c) — SPY → universe ArcticDB consumer retirement,
executor half.

Suite: 1023 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cipher813 cipher813 merged commit ff7fb0e into main May 28, 2026
1 check passed
@cipher813 cipher813 deleted the feat/retire-spy-macro-special-case-l1346 branch May 28, 2026 14:58
cipher813 added a commit that referenced this pull request May 28, 2026
#225)

`executor/price_cache.py::_open_universe_library` + `_open_macro_library`
now delegate to `alpha_engine_lib.arcticdb.open_universe_lib` /
`open_macro_lib` — the lib chokepoint that centralizes S3 URI
construction + `get_library` error wrapping across all alpha-engine
ArcticDB consumers (data + predictor + executor + research + backtester).

Local wrappers retained (not deleted) for two reasons:
1. Existing callers (`load_price_histories`, `load_atr_14_pct`, etc.)
   keep their import surface unchanged.
2. The module-top `import arcticdb as _arcticdb` (line 23) preserves the
   macOS allocator-prime invariant — pyarrow's allocator must NOT load
   before arcticdb's bundled aws-c-common allocator, else
   `aws_fatal_assert` segfaults on first `get_library()`. Lazy import
   inside the lib helper would defeat that ordering if the wrapper here
   were deleted entirely.

ROADMAP: **L2771** — _Migrate 6 ArcticDB get_library("universe") sites
to alpha_engine_lib.arcticdb_. First of 5 repos (executor); ae-data +
ae-predictor + ae-research + ae-backtester follow in sibling PRs.

Composes with PR #224 (L1346 c SPY-special-case retirement, OPEN) —
both edit `price_cache.py`; textual conflict is trivial.

Suite: 1021 passed (no regression).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant