You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
On 2026-05-08 19:45 UTC a transient Oracle FRED-proxy 5xx storm caused
paper_engine_vix_fred_unavailable to fire (3 sequential 500s; the 4th
attempt returned 200 OK with VIX=17.08). The pre-fix engine just left
VIXCLS missing from the macro dict, which the selector at
libs/backtest/selector.py:1171-1173 already treats strict-conservatively
(None → veto). So the 5/8 incident vetoed v7.356 PEAD candidates for
~1 minute with no money-loss exposure. But:
- Log severity was thin (info-level "unavailable", no escalation).
- No tolerance for short outages — every 500 cost the gate's signal.
- EventDetector PostgreSQL rows do not pre-populate macro_vix per
engine.py:2810-2812 comment, so live trading depends entirely on
the FRED fetch path.
Fix: in-memory session-scoped cache + 3-tier fallback in
PaperTradingEngine._fetch_macro:
Tier 1 fetch ok → cache (value, now_utc), log ..._ok (info)
Tier 2 fail, cache <24h → return cached value, log ..._stale_fallback
(warning) with staleness_sec
Tier 3 fail, cache stale → None, log ..._unavailable_blocking (error)
with reason={no_cache,cache_too_stale}
The None-veto path through the selector is preserved exactly, so no
silent-pass on unknown VIX. Empty/0 observations now treated as outage
to defend against an upstream regression flipping "missing→veto" into
"0→always-pass".
The thin libs/oracle_client/fred.py is intentionally untouched — fallback
policy belongs in the engine, not the generic client.
6 new tests in tests/unit/paper_trader/test_vix_fred_fallback.py
(success/cache-write, 500+stale-<24h, 500+stale->24h-blocks,
no-cache+500-blocks, empty-observations-blocks, recovery-refresh).
All 18 tests in -k "vix or fred" pass; full paper_trader suite 45/45.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
3 months ago | |
|---|---|---|
| .. | ||
| fixtures | 5 months ago | |
| integration | 4 months ago | |
| replay | 5 months ago | |
| unit | 3 months ago | |
| __init__.py | 5 months ago | |
| conftest.py | 5 months ago | |