feat(executor): retire SPY from #185 ATR exclusion — close L1346 (c) first half#207
Merged
Merged
Conversation
…first half L1346 (c) — the executor-side retirement of SPY-special-cases that alpha-engine #185 added as a defensive measure while SPY was only in macro library (Close-only). Post-fix evidence: alpha-engine-data #245 (MERGED 2026-05-15) promoted SPY to a full `universe` ArcticDB member via `_UNIVERSE_EXTRA = frozenset({"SPY"})`, written by both backfill.py (Saturday) and daily_append.py (weekday). 2026-05-24 DataPhase1 SSM log confirms: `Backfill write complete: 904 ok` = 903 constituents + SPY. universe.SPY now carries the atr_14_pct feature column that load_atr_14_pct needs. The #185 comment block itself anticipated this retirement: "the right remedy for ATR is exclusion (macro lib has no ATR), not macro-lib dispatch" — that's now stale advice. universe.SPY has full OHLCV + features; ATR computation works. Implementation: - New `_MACRO_SYMBOLS_NO_OHLCV = _MACRO_SYMBOLS - {"SPY"}` constant at the ATR exclusion site. Subtracts SPY from the exclusion (because universe.SPY now has OHLCV) while preserving the exclusion for VIX, TNX, IRX, sector ETFs, etc. (still Close-only in macro lib). - Comment block updated to reference L1346 (c) closure + the gate (a) verification evidence. Tests: 2 new in `test_l1346_spy_atr_exclusion_retired.py`: - White-box: SPY not in `_MACRO_SYMBOLS - {"SPY"}` derived set; legacy Close-only symbols (VIX/TNX/IRX/XLK/XLF) still in exclusion. - Source-level pin: `executor/main.py` derivation uses `_MACRO_SYMBOLS_NO_OHLCV`, NOT the full `_MACRO_SYMBOLS`. Future refactor that drops the subset distinction silently re-introduces the bug L1346 (c) closed. Full executor suite 962 pass. OUT OF SCOPE — continuing arc: - `executor/price_cache.py:135` `_MACRO_SYMBOLS` routing flip (read SPY from universe first, fall back to macro) — mirrors the predictor pattern from alpha-engine-predictor #196 (L1346 (b)). Defer as follow-up because price_cache.load_price_histories has more callers than the single ATR site here. - `executor/eod_reconcile.py:655` `_MACRO_SYMBOLS` routing flip — same pattern. Defer for the same reason. Both can ship together as a follow-up PR mirroring the predictor's defensive macro-fallback shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
cipher813
added a commit
that referenced
this pull request
May 25, 2026
…refer universe.SPY with macro fallback (#208) Completes the L1346 (c) retirement of SPY-special-cases across the executor. Pre-fix sites used `if ticker in _MACRO_SYMBOLS` to route SPY reads to macro library (Close-only); post-L1346 #245 universe.SPY now has full OHLCV via `_UNIVERSE_EXTRA`. Implementation (mirrors alpha-engine-predictor #196 defensive shape): - `executor/price_cache.py::load_price_histories` — gates on `_MACRO_SYMBOLS_NO_OHLCV = _MACRO_SYMBOLS - {"SPY"}`. SPY routes to universe first; on universe-read failure, defensive fallback to macro.SPY (clearly logged via dual-exception-class read_errors line). - `executor/eod_reconcile.py` — same routing flip + defensive fallback. Non-SPY macro symbols (VIX/TNX/IRX/sector ETFs) remain macro-routed (still Close-only in macro library; no universe entry). Defensive fallback can be removed once L1346 (b)+(c) soak clean for ≥1 Saturday cycle (operator-promoted soak; ~1-2 Saturdays out). Test plan: - Full executor suite 962 pass. - Pre-existing alpha-engine #185 ATR exclusion site already updated to `_MACRO_SYMBOLS_NO_OHLCV` (PR #207). Closes ROADMAP L1346 (c) second half. Combined with #207 (first half) + #196 (predictor (b) gate), the entire L1346 retirement arc is now shipped except the operator soak-watch. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
L1346 (c) executor-side retirement, first half: SPY no longer excluded from the ATR ticker set, since universe.SPY now carries atr_14_pct via alpha-engine-data #245's
_UNIVERSE_EXTRAwrite path.#185's own comment block anticipated this retirement — "the right remedy for ATR is exclusion (macro lib has no ATR)" is now stale. universe.SPY has full OHLCV + features.
Implementation
_MACRO_SYMBOLS_NO_OHLCV = _MACRO_SYMBOLS - {"SPY"}at the ATR exclusion siteTest plan
test_l1346_spy_atr_exclusion_retired.py(white-box + source-level pin)NoSuchVersionExceptionOut of scope (continuing arc)
executor/price_cache.py:135+eod_reconcile.py:655_MACRO_SYMBOLSrouting flips — bigger scope; defer as sibling PR mirroring the predictor fix(executor): treat optimal zero-trade optimizer solve as a valid HOLD #196 defensive-fallback shape.🤖 Generated with Claude Code