Skip to content

PR1b: feature compute price+macro → ArcticDB (universe+macro libs, slim fallback, parity)#268

Merged
cipher813 merged 1 commit into
mainfrom
feat/compute-prices-arcticdb
May 19, 2026
Merged

PR1b: feature compute price+macro → ArcticDB (universe+macro libs, slim fallback, parity)#268
cipher813 merged 1 commit into
mainfrom
feat/compute-prices-arcticdb

Conversation

@cipher813
Copy link
Copy Markdown
Owner

The riskiest consumer migration of the Wave-4 arc (predictor/price_cache_slim/ deletion). Consumes lib v0.20.0 (PR0a-2 lib #51, merged: load_macro_series + shared read core).

Why this one is risky

features/compute._load_prices_and_macro feeds the entire feature-compute pipeline and _extract_macro. The slim cache historically carried equities + SPY + index/macro series (VIX/VIX3M/TNX/IRX/GLD/USO) + all XL* sector ETFs in one flat dict. Those tenants are split across two ArcticDB libs — a naive load_universe_ohlcv swap would silently drop every macro/ETF series → _extract_macro near-empty → SPY/VIX/VIX3M-derived features degrade across the whole universe. (This is the audit finding that justified the separate PR + the PR0a-2 load_macro_series helper.)

Change — composed read

New _load_price_source():

  • load_universe_ohlcv(bucket) → equities + SPY
  • load_macro_series(bucket, syms)_MACRO_SLIM_KEYSXL* (discovered via open_macro_lib().list_symbols(), startswith("XL"); the heterogeneous non-price features key is excluded by load_macro_series's explicit-symbols contract)
  • union = the slim-equivalent dict _extract_macro + the pipeline consume unchanged
  • slim retained as whole-set fallback — feature compute cannot run blind; returns None (→ empty, existing no-data contract) only if both sources fail
  • SOTA observation: while both exist, every run dual-reads + emits reconcile(...).as_metrics() JSON — grep WAVE4_PARITY_METRIC compute. require_ticker_match=False because slim legitimately carries symbols the universe lib does not — set asymmetry is logged in the metric fields for visibility while passed reflects value fidelity over the overlap. Dual-read + slim removed in PR4.

Safety

  • No Dockerfile-extra change (precise audit): features/compute.py is not Lambda-packaged — the Dockerfile doesn't COPY features/; it runs only via weekly_collector on EC2 spot, whose requirements.txt already carries [arcticdb,flow_doctor,rag].
  • Pin bump 0.19.0 → 0.20.0 (requirements.txt + Dockerfile, lockstep guard enforced).
  • +5 tests (compose / slim-fallback / parity-emit / both-fail / empty-source). Full data suite 1380 passing; Wave-4 anti-drift consumer-set guard still holds (compute.py keeps slim fallback → stays in WAVE4_INVENTORY until PR4).

Sequence

This completes the PR1 (consumer migration) tier on the data side — both data-repo data-read consumers (macro.py PR1a #267 merged; features/compute.py here) now ArcticDB-primary + parity-observed. Next: PR2 (backtester exit_timing.py), PR3 (dashboard health_checker.py retire), PR4 (delete writer+prefix, gated on one clean Saturday-SF zero-diff ParityReport across the WAVE4_PARITY_METRIC streams).

🤖 Generated with Claude Code

… parity)

PR1b of the Wave-4 predictor/price_cache_slim deletion arc — the
riskier consumer (feeds the ENTIRE feature-compute pipeline +
_extract_macro). Consumes lib v0.20.0 (PR0a-2: load_macro_series).

features/compute._load_prices_and_macro's price source moves from a
single load_slim_cache read to a composed ArcticDB read via the new
_load_price_source() helper:

- universe lib (load_universe_ohlcv) -> equities + SPY
- macro   lib (load_macro_series)    -> VIX/VIX3M/TNX/IRX/GLD/USO +
  XL* sector ETFs (discovered via open_macro_lib().list_symbols(),
  filtered startswith XL; the heterogeneous non-price 'features' key
  is excluded by the explicit-symbols contract)
- union = the slim-cache equivalent that _extract_macro + the feature
  pipeline consume unchanged.

slim cache RETAINED as a whole-set fallback — feature compute cannot
run blind (returns None only if BOTH sources fail -> empty, preserving
the existing no-data contract). SOTA observation: while both exist,
every run dual-reads + emits reconcile as_metrics() JSON (grep
WAVE4_PARITY_METRIC compute). require_ticker_match=False — slim
legitimately carries symbols the universe lib does not, so set
asymmetry is logged for visibility while passed reflects value
fidelity over the overlap. Dual-read + slim removed in PR4.

Pin bump 0.19.0 -> 0.20.0 (requirements.txt + Dockerfile lockstep).
No Dockerfile-extra change needed: features/compute.py is NOT
Lambda-packaged (Dockerfile does not COPY features/); runs only via
weekly_collector on EC2 spot, whose requirements already carry the
[arcticdb] extra.

+5 tests (compose / slim fallback / parity emit / both-fail / empty);
full data suite 1380 passing; Wave-4 anti-drift guard still holds
(compute.py keeps slim fallback -> stays in WAVE4_INVENTORY until PR4).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cipher813 cipher813 merged commit 6fbe254 into main May 19, 2026
1 check passed
@cipher813 cipher813 deleted the feat/compute-prices-arcticdb branch May 19, 2026 19:39
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