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.
I Luk Kim 956cc78f1b Add 3 candidate engine classes beyond PEAD: EarningsRunup, PeerSympathy, VolBreakout52w
Adds three new synthetic-Candidate emitter engines parallel to the
existing leader_follower scheduler hook, plus look-ahead defenses
(LookaheadViolationError + per-engine assertions). Each engine is
covered by a standalone PoC config (no PEAD/parking/idle alpha) for
isolation backtests against the midlarge or broad snapshot.

Engines:

EarningsRunup (libs/backtest/earnings_runup.py)
 - Trigger: days_to_earnings ∈ [3,7] AND attention_zscore_20d ≥ 1.5
   AND dollar_volume_20d_zscore ≥ 1.0 (all evaluated at T-1 close)
 - Entry: T+1 next_open. Exit: -4% / +8% / max_holding_days =
   days_to_earnings - buffer (forced flat by close before announcement)
 - PIT calendar: PointInTimeEarningsCalendar adapter for backtest;
   oracle_surprise_prefetch fallback when parquet calendar absent
 - PoC verdict (configs/experiments/earnings_runup_poc_v1.json):
   119 trades over 1051 days, +37.27% total return, 44.46% MDD,
   SQS 45.2 (profitability=55.5, risk=23.5, robustness=50.1).
   VIABLE BUT NEEDS WORK — signal exists; standalone risk profile
   too aggressive for v7.356 baseline (8.8% MDD on v7.364). Path
   forward: per_trade_risk reduction, VIX gate, position cap, or
   integrate as PEAD sleeve adjunct (not as standalone replacement).

PeerSympathy (libs/backtest/peer_sympathy.py)
 - Trigger: leader passes PEAD filter (earnings_release / guidance_update
   / material_contract) AND leader reaction_close ≥ +5% AND peer 60d
   correlation ≥ 0.55 over [T-65, T-5]. Top-2 peers by correlation
   from leader_follower_extra_peer_symbols_by_sector + sector ETF
   holdings.
 - Entry: T+1 next_open on peer. Exit: -3.5% / +6% / max_holding=3 /
   peer-earnings blackout
 - PoC verdict (configs/experiments/peer_sympathy_poc_v1.json):
   256 trades over 1051 days, -52.92% total return, 54.47% MDD,
   SQS 19.6 (profitability=0.0, risk=5.4, robustness=100.0).
   DEAD. The leader's catalyst is already absorbed by T+1 next_open
   — peers gap up overnight before entry. robustness=100 confirms
   the negative result is not noise. Salvage paths (not implemented):
   reaction_close entry, raised-guidance-only restriction.
 - Note: initial run_id was 0 trades due to a select_candidates
   filter mismatch (engine.event_types=['peer_sympathy'] dropping
   real event_type='earnings_release' rows). The runner adapter
   was patched to bypass strategy_engine filtering for leader
   selection; the manual peer_sympathy_leader_event_types filter
   does the gating.

VolBreakout52w (libs/backtest/vol_breakout_52w.py)
 - Trigger: close_T-1 > max(high[T-252:T-2]) AND volume_T-1 ≥
   2 × median_volume_20d_T-2 AND ATR_14_T-1/close ∈ [0.015, 0.06].
   Entry T next_open, exit -3% / +5% / max_holding=2 / MOC.
 - Honest, look-ahead-safe descendant of the retired topgainer v1-v54
   family. Five layers of strict-before assertions guard the bar
   provider, candidate construction, trigger evaluation, and feature
   timestamps. A leaky-provider proof-by-contradiction test
   demonstrates the categorical catch.
 - PoC verdict (configs/experiments/vol_breakout_52w_poc_v1.json,
   broad-liquid universe): 1,332 trades, -87.28% total return,
   88.74% MDD, SQS 24.4 (profitability=0.0, robustness=100.0).
   DEAD AND HONEST. This is the most important finding of the three
   PoCs: the topgainer v1-v54 lineage's headline returns (+267%
   Sharpe 13.73 in best variants) were 100% lookahead bug. With
   the bug removed, the 52w-high + volume + ATR signal has no real
   alpha — the lookahead-corrected -4.3% from prior memory is
   confirmed and amplified to -87% on a fuller universe and longer
   horizon. Future "revive topgainer" proposals can cite this run
   (bt_return_max_long_v1_broad-liquid_20260509042903892342_3bb473d9)
   as definitive falsification.
 - Pre-open gap guard inactive (no premarket data in broad snapshot).
   skip_if_no_gap_data=true; the +4% gap-fade guard would not move
   the result given the magnitude.

Shared infrastructure additions:
 - libs/backtest/domain.py: LookaheadViolationError class +
   StrategyEngineConfig fields (11 EarningsRunup + 11 PeerSympathy
   + 13 VolBreakout52w = 35 new fields)
 - apps/backtester/run.py: _BacktestAttentionZscoreAdapter,
   _RunnerPeerResolver, _schedule_earnings_runup_candidates,
   _schedule_peer_sympathy_candidates,
   _schedule_vol_breakout_52w_candidates wired into the daily
   scheduler block. PeerSympathy adapter bypasses strategy_engine
   filtering on leader selection (manual filter handles gating).

Tests: 21 (EarningsRunup) + 27 (PeerSympathy) + 38 (VolBreakout52w)
= 86 new unit tests, all passing. Broader unit suite: 1392 passed,
2 pre-existing failures unrelated.

Net engine state: EarningsRunup is the only viable new engine class.
PeerSympathy and VolBreakout52w are kept in-tree as falsification
evidence, not as production engines.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3 months ago
..
backtest Add 3 candidate engine classes beyond PEAD: EarningsRunup, PeerSympathy, VolBreakout52w 3 months ago
intraday Clean up superseded configs and commit accumulated R&D infrastructure 4 months ago
orb_trader Investigate compound mode: V23 is absolute champion in all modes 4 months ago
paper_trader Paper trader Phase 1 fixes: multi-session isolation, pipeline halt, snapshot refresh unblock 4 months ago
tools Remove momentum breakout sleeve (overfitting, valid -31%) and revert related code 4 months ago
web Investigate compound mode: V23 is absolute champion in all modes 4 months ago
__init__.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_config.py feat: PEAD mid-cap strategy + pipeline hardening + README cleanup 5 months ago
test_continuation_snapshot.py Update tests for pipeline, backtest engine, paper trader, and new modules 5 months ago
test_db_models.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_enrich_catalyst_persistence_features.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_enrich_earnings_history_features.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_enrich_peer_surprise_features.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_enrich_tier2_features.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_ensemble_overlay_backtest.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_event_features.py feat: PEAD mid-cap strategy + pipeline hardening + README cleanup 5 months ago
test_file_store.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_financial_features.py implement Phase 2 gap items: backfill CLI, retry, financial features 5 months ago
test_fred_service.py test: Phase 1/2 체크리스트 재작성 및 Oracle 실연동 통합 테스트 5 months ago
test_ids.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_labeler.py Fix label_price_unavailable: preserve future entry_dates as pending 3 months ago
test_llm_cache.py feat: implement Phase 3 -- LLM enrichment, labeler, review queue, dataset export 5 months ago
test_llm_client.py fix: disable Qwen3.5 thinking mode and switch OllamaClient to sync httpx 5 months ago
test_llm_parser_stub.py test: Phase 1/2 체크리스트 재작성 및 Oracle 실연동 통합 테스트 5 months ago
test_logging.py test: Phase 1/2 체크리스트 재작성 및 Oracle 실연동 통합 테스트 5 months ago
test_market_features.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_merged_snapshot.py Update tests for pipeline, backtest engine, paper trader, and new modules 5 months ago
test_merger.py feat: implement Phase 3 -- LLM enrichment, labeler, review queue, dataset export 5 months ago
test_oracle_client.py Add paper trader improvements, web GUI updates, and experiment registry cleanup 4 months ago
test_retries.py test: Phase 1/2 체크리스트 재작성 및 Oracle 실연동 통합 테스트 5 months ago
test_review_queue.py feat: implement Phase 3 -- LLM enrichment, labeler, review queue, dataset export 5 months ago
test_rule_parser.py Harden 8-K item-code classifier against dirty input strings 3 months ago
test_schema_validator.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_snapshot_export.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_text_normalizer.py Update tests for pipeline, backtest engine, paper trader, and new modules 5 months ago
test_time_utils.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago