32 Commits (main)

Author SHA1 Message Date
I Luk Kim 126445ae0e Promote v9.5.36 PEAD champion + prune experiments to 3-tier set; ORB soft-day parity; TGTC infra
- v9.5.36 promoted: megacap reaction_min 0.02→0.03 on v9.5.20 cap=0.70 base; Full 13,244%/MDD 11.67%/Sharpe 3.579/OOT 304%; clean Pareto win
- Pruned 130 experiment configs → keep 3 (v9.4.5 max-return, v9.5.36 balanced/champion, v9.5.18 cap=0.55 conservative); rebuilt index
- PEAD engine probes: low_vol anomaly + breakout_52w (retained as falsification probes; not promoted)
- Risk analysis: 11.67% MDD confirmed structurally HYMC (6-day giveback, not controllable); per-name cap sweep on next_open_long/reaction_close falsified (0 MDD impact)
- ORB: port soft-day primary-trigger filter to live engine (6-gate parity with simulator)
- TGTC trader infrastructure + advisor service (new)
- ORB v46/v49 sweep configs, intraday scripts, docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 months ago
I Luk Kim d000731cc7 PEAD session: add 4 candidate engines + Oracle vocab normalizer + auto-refresh disable
New engines (configurable but not promoted by default):
- libs/backtest/earnings_runup.py: pre-earnings drift entry (T-7 to T-3, attention+volume z-scores)
- libs/backtest/peer_sympathy.py: peer reaction trade after leader earnings, with reaction_close variant
- libs/backtest/vol_breakout_52w.py: 52-week high volume breakout
- libs/backtest/cross_sectional_momentum.py: 12-1 momentum with VIX/SPY-50dma regime filter

Pipeline additions:
- libs/parser/event_type_normalizer.py: normalize Oracle fallback raw vocab to strategy
  vocabulary (earnings_result→earnings_release, regulation_fd→guidance_update, etc.).
  Wired into apps/pipeline/event_parser/main.py oracle-fallback path.
- libs/labeler/label_generator.py: preserve future entry_dates as label_status='pending'
  instead of dropping as 'unavailable'.
- libs/export/snapshot_export.py: include 'pending' labels in snapshot export.
- libs/parser/rule_parser.py: harden 8-K item-code classifier against dirty input strings.

Infrastructure:
- libs/backtest/snapshot_store.py: _PRICE_FEATURE_WARMUP_DAYS 120→400 (needed for
  xsmom 12-1 lookback of 273 trading days).
- apps/backtester/run.py + apps/paper_trader/backtest_sim.py: disable auto-refresh
  of snapshots (user request — auto-refresh was silently rebuilding snapshots with
  current code, making historical backtests irreproducible across DB mutations).

Engine config support:
- libs/backtest/domain.py: add fields for ER/PS/VolBO/xsmom engine configs.
- libs/backtest/execution.py: wire pct-trailing for EarningsRunup.
- libs/backtest/scoring.py: synthetic candidate scoring for new engines.

Configs (POC + sweeps, none promoted as active strategy):
- Phase A-E PEAD baseline comparisons (no PEAD / +ER / +xsmom / +sleeves variants)
- Phase F1-F8 silo allocation sweep (v7.356 + ER/xsmom silos 15-60%)
- xsmom_poc_v1, xsmom_v2_regime_mdd
- v7.356_plus_er_silo_05/10/15/20/25/30 ranges
- earnings_runup_* / peer_sympathy_* / vol_breakout_52w_* POCs

Tests: 16-tests-each for each new engine + event_type_normalizer tests.

Note: backtest reproducibility infrastructure remains broken — see
_backup_2026-05-10/HANDOFF.md for details on the +12,592% reference run that
cannot be reproduced after rebuilds. Followup work needed before trusting any
specific backtest number.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 months ago
I Luk Kim 68102f1b3a Add reaction_close salvage variant to PeerSympathy engine
Add peer_sympathy_entry_timing_policy ("next_open"|"reaction_close") and
peer_sympathy_leader_filing_time_buckets to StrategyEngineConfig. The
reaction_close variant enters peers at peer's T 16:00 ET close on the
SAME trading day as the leader's print, addressing the v1 hypothesis
failure where T+1 gap had already absorbed the news overnight.

Lookahead defenses tightened for the new branch: cutoff is T 16:00 ET
(_bar_close_timestamp(decision_date)) instead of T+1 09:30 ET; bucket
allow-list excludes AMC filings (which under PEAD's reaction_date=T+1
convention pass the timestamp check but defeat same-session sympathy).
LeaderPrint now carries filing_time_bucket from the runner.

Runner: split _schedule_peer_sympathy_candidates into two phases.
reaction_close fires BEFORE _select_candidates_for_date(date) and emits
into _scheduled_add_ons[date]; next_open keeps the existing tail-of-loop
position emitting into _scheduled_delayed_entries[next_date].

v2 backtest (1052 trading days, midlarge-liquid-long-v1 snapshot):
  trades 256→120, return -52.9%→-2.4%, MDD 61.6%→24.5%, SQS 19.6→30.2.

Sample sympathy plays: GOOGL on META +7.7%, AVGO on COHR +6.3%,
SLB on HAL +5.5%, GE on HWM +5.1%. Profit factor 0.977 (one tweak
from breakeven). Verdict: VIABLE BUT WEAK — salvage hypothesis
empirically validated, near breakeven, not promoted yet.

35/35 peer_sympathy unit tests pass (29 pre-existing + 6 new for
reaction_close path).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3 months ago
I Luk Kim 465e248cb4 Wire pct-trailing end-to-end for EarningsRunup; tune v2 risk profile
Fix EarningsRunup trailing config that was previously captured in
Candidate.features only. Add activation-gated pct trailing to
update_trailing_stop with entry-relative giveback semantics
("lock in peak − giveback% of entry"). Plumb through
Candidate → ExecutionConfig → simulator. Default None preserves
legacy pct_X behavior — no impact on engines that don't opt in.

Add earnings_runup_poc_v2_tuned config: per_trade_risk_pct 0.65→0.30,
max_positions 30→8, max_positions_per_sector 30→4, macro_vix_max=30,
trailing_warmup_days 7→0 (activation gate replaces warmup).

v2 backtest (4y, 121 trades) vs v1 baseline (119 trades):
  Total return:  +37.27%  →  +254.69%
  Max drawdown:  53.23%   →  23.97%
  SQS:           45.2     →  69.7
  Robustness:    50.1     →  100.0
  Risk score:    23.5     →  35.0
  STOP r-mult:   −0.41    →  +0.65 (trailing-locked winners)

Promotion thresholds met: MDD < 25%, return preserved, SQS > 55.
Recommend integration as PEAD sleeve adjunct (orthogonal entry timing:
pre-print attention runup vs post-print drift) rather than standalone.

7 new pct-trailing tests: activation gate, ratchet, no-ratchet-down,
reversal-stop, legacy compat, end-to-end engine wiring. 28 passed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3 months ago
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
I Luk Kim 0cae86aa87 Revert: remove daily_budget_reset from PEAD backtest
Feature was added to wrong system (PEAD backtester). Fully reverted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 months ago
I Luk Kim 189aa58343 Add daily_budget_reset mode for research backtesting
New mode (risk.daily_budget_reset=True) where cash_available and sizing
equity reset to initial_equity at the start of each day, regardless of
how many open positions or realized P&L exist. Unlike fixed_capital_sizing
(단리, sizing only), this also treats buying power as if no positions are
held — useful for evaluating signal quality independent of capital constraints.

- domain.py: daily_budget_reset field on RiskConfig
- run.py: _daily_budget_reset flag; _sizing_equity / _sleeve_equity_est /
  _build_portfolio_state all honor the new flag
- backtest_sim.py: daily_budget_reset param threaded through
- direct_runner.py: --daily-budget-reset CLI flag
- routers/backtest.py: BacktestRequest field + cmd arg
- client.ts: BacktestParams / BacktestTask types updated
- Backtest.tsx: checkbox in form + DBR badge in task list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 months ago
I Luk Kim 426de9038d Fix lookback entry bugs: current-price sizing + MHD expiration filter
Bug #2 (paper trader): lookback entries sized using historical entry_price_est
but filled at current market price, causing cash overdraft. Fix: override
entry_price_est with get_latest_bars() close before entering _process_entries.

Bug #3 (paper trader + backtester): paper trader was missing the per-candidate
MHD expiration check that the backtester already had. Also adds
lookback_min_remaining_days (default 3) to reject candidates with too little
holding time remaining — prevents entering a position the day before forced exit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 months ago
I Luk Kim b3ba914a8d Optimize v7 strategy: v7.356 achieves CW 2159% + SQS 90.7 (Pareto improvement over v7.314)
Key changes from v7.314 baseline (CW 2012%, SQS 90.0):
- max_position_value_pct 15→25, non_a_tier_target_1_fraction 0.2→0
- max_daily_new_risk_pct 30→50 (via v7.330, CW champion 2148%)
- bullish_raised_recovery per_trade_risk_pct 0.71→0.55 (DD improvement)
- bullish_raised_recovery max_holding_days 12→10 (sweet spot, +98pp CW)

Result: v7.356 CW 2159% (+147pp), SQS 90.7 (+0.7), risk 66.2 (+2.9), robustness 94.3 (+0.5)
All metrics improved simultaneously — return increase AND DD reduction achieved.

Also includes: web UI updates, pipeline scripts, v16/v17/v18/v19 experiment pruning,
Form4 preset additions, snapshot registry updates, domain.py enhancements.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 months ago
I Luk Kim 5496059b6c Add v7.120 composed GLD experiment updates 4 months ago
I Luk Kim f21caf23cb Prune Form4 experimental presets 4 months ago
I Luk Kim 4b1d9afde7 Prune unused sleeve presets and trim web preset lists 4 months ago
I Luk Kim 5cb2b9fcb8 Add non-core allocator v2 and Form4 freshness presets 4 months ago
I Luk Kim e38c314a09 Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure
New features:
- Ownership 13D/13G residual-cash sleeve with PIT calendar and quality filters
- Risk-off alpha sleeve (GLD/DBC rotation on crisis regime signals)
- Crisis relay target in parking: evaluates before defensive relay
- Bearish symbol allocation split (bearish_alloc_pct + sgov remainder)
- Alternative defensive ETF candidate (cash_parking_defensive_alt_symbol)
- Composite eval and engine ablation tools
- experiment and overfit CLI apps

New experiments:
- v17.x series (v17.1 champion SQS 78.4; v17.5–v17.129 exhausted)
- v18.x and v19.x families from v12.8 OOT defense branch
- v7.119 composed variants (idle alpha + ownership + risk-off sleeves)
- parking_only configs: bufb, jepq, merix, regime_tiered
- empty_strategy baseline config

Web app:
- Restructured into routers/services modules (experiments, leaderboard, runs, sqs, docs)
- Ownership sleeve and risk-off sleeve controls in backtest UI
- Frontend: ComposeStrategy page, tradeSleeves lib, idle decomposition display

Research tools:
- Ownership 13D/13G probe and PIT cache builder
- Dividend capture probe and cache builder
- Insider Form4 idle alpha probe
- Alternative ETF parking probe, put-spread overlay probe
- Wikimedia low-attention and peer-relative idle alpha probes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 months ago
I Luk Kim 5056295cb6 Add lookback entry feature for bounded backtests
When a backtest starts mid-stream (via --start), events that fired
before the start date but are still within their max_holding_days
window can now be entered on the first simulation day.

- Add `lookback_entry_enabled: bool = False` to ExecutionConfig
- On first sim day, _collect_lookback_candidates() gathers pre-start
  events, runs them through the same select_candidates() pipeline,
  and injects them before normal candidates
- Entry fills at the first day's open price; gap-cap check is skipped
  since the event is multi-days old
- days_held is initialized to the elapsed trading days so TIME exits
  fire at the correct time relative to the original event date
- Store slice is extended backward by max_mhd calendar buffer so
  pre-start rows survive slice_by_date_range when feature is enabled
- Enabled in return_max_long_v7.119 for testing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 months ago
I Luk Kim ea9f156eeb Tune Form4 sleeve quality filters and reserve sizing 4 months ago
I Luk Kim 72681e69e5 Add Form4 residual-cash sleeve and UI support 4 months ago
I Luk Kim f2113b7e06 Fix cash parking phantom-money bug + live engine parking liquidation for events
Backtester (run.py):
- cash_available = (self._cash + parking_value) * multiplier caused trades to be
  approved even when self._cash ≈ 0 (all money in SGOV/QQQ).  Trades executed
  by deducting from self._cash → negative cash (phantom money).
- Fix: after simulate_entry, if self._cash < actual trade cost and parking exists,
  call _liquidate_parking_for_cash(shortfall) before deducting from cash.
- Verified: 2022-2026 backtest with qqqm_low_dd shows 0 cash_negative events.

Live engine (engine.py):
- Add _parking_liquidate_for_event(): frees parking cash to fund event entries.
  SGOV (virtual) reduces entry_value in DB; QQQM/QQQ sells real shares via broker.
- Both entry loops (engines mode + flat/reaction_close mode) now attempt parking
  liquidation when plan.skip_reason == "insufficient_cash" before giving up.

Also includes prior session work (accumulated since last commit):
- 6 novel parking gate signals: VRP, Market Temperature, Hurst exponent, Rolling
  Kurtosis, Return Autocorrelation, SPY-QQQ Correlation (composite risk score v2)
- QQQM parking symbol support (lower expense ratio vs QQQ)
- Snapshot auto-refresh + bar extension cache (pickle) to avoid 10-min re-fetches
- Bar extension clamps to last market-closed date (ET 4PM check)
- fithia2 refresh command; --no-refresh flag for paper backtest
- Paper backtest macro extension beyond last event date (parking-only periods)
- parking_state DB schema: 7 new columns (peak_price, gate_in_sgov,
  committed_target, pending_target, pending_days, sgov_entry_value, sold_today)
- Live engine: target confirmation (2-day), top-up drawdown gate, trailing stop,
  SGOV interest accrual, full 6-signal gate evaluation
- New PARKING_PRESETS: qqqm_low_dd, composite_v2, vv_24_vrp8, vt_24_t13, etc.
- Web GUI / CLI result parity fix (Oracle URL via get_settings().stock_oracle_url)
- Force-close uses last_exec_date (has bar data); parking liquidates at last_date

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 months ago
I Luk Kim 76581ead04 Remove overlay backtesting and scoring 5 months ago
I Luk Kim 1e66b67c7a Add technical/scientific feature experiments (v6new.106-173) and v6new.122 SQS 72.4
Tier 1: Vol/RSI/BB/OBV features — sizing scalers hurt public SQS, scoring
adjustments ineffective on 28-30 trades. Only doc_quality gate lowering
(0.66→0.55) improved results (+2 trades, +0.8 SQS).

Tier 2: Hurst exponent, Shannon entropy, sector momentum — entropy bonus
CW +10.7pp but SQS equivalent (72.3 vs 72.4). Sector momentum hurt badly.

Tier 3: OU theta, gravitational pull, market temperature — all caused
large CW return drops (-80 to -103pp). Physics-based indicators don't
fit event-driven PEAD.

Best result: v6new.122 (SQS 72.4, #3 leaderboard) = v6new.29 + doc quality
gate 0.66→0.55. Single parameter change outperformed all feature engineering.

New code:
- libs/features/market_features.py: 9 new features (vol, RSI, BB, OBV,
  Hurst, entropy, OU theta, gravitational pull, market temperature)
- libs/backtest/scoring.py: v12-v14 scoring models with technical gates
- libs/backtest/allocator.py: volatility + conviction size scalers
- libs/backtest/domain.py: volatility_size_scaler + conviction_boost config
- scripts/enrich_*.py: snapshot enrichment scripts
- 68 experiment configs (v6new.106-173)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 months ago
I Luk Kim 529477727f Add score and event_type to trade blotter output
FilledTrade now carries event_type and score from the Candidate.
These fields are written to trade_blotter.parquet and displayed in
paper backtest trade logs.

Previously score showed as 0.00 for all trades because the field
wasn't propagated from Candidate → FilledTrade → Parquet.

Score=0.00 is valid for trades from engines with score_threshold_override=0.0
(e.g. guidance_unknown_orderly) where engine gates, not score, determine entry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 months ago
I Luk Kim bb659cf7ae Add reaction-based position sizing to reduce mean-reversion loss risk
New feature: reaction_size_cap_threshold in RiskConfig
- When abs(reaction_day_return) > threshold, position size scales down
- Formula: scaler = threshold / abs(reaction) (linear inverse)
- E.g. threshold=8%: 8% reaction → 100%, 16% → 50%, 24% → 33%

Paper trading impact simulation (top 10 trades):
- PII (react +14%): loss $501 → $288 (saved $214)
- VSCO (react +18%): loss $792 → $350 (saved $442)
- RYTM (react +12%): loss $397 → $256 (saved $141)
- Winners (react <5%): unchanged (SSRM, FLS, LW, KGS all 100%)
- Total loss reduction: $2,610 → $1,813 (-30%)
- Net PnL improvement: +$797

v6new.24 backtest: Train SQS 92.5 (session best), risk=75.6.
Public SQS 52.5 (lower return due to sizing, but best risk profile).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 months ago
I Luk Kim 85c4d98987 Add v6new experiment suite: scoring v8/v9/v9g, cross-event drift, coverage engines
Scoring additions (libs/backtest/scoring.py):
- v8: conditional financial bonus (eps_growth_qoq/revenue_growth_qoq)
- v9: cross-event drift momentum (+/-10% from prior same-ticker 5d return)
- v9g: gated variant — reject events with negative prior drift

Snapshot export (libs/export/snapshot_export.py):
- _enrich_prior_event_drift: computes prior_event_fwd5d for all snapshots
- smallcap-liquid-long-v1 universe profile ($500M-$2B)
- market_cap_max support in screener and filtering

8 experiment configs (v6new.1-v6new.8):
- v6new.1: unknown event reclassification (neutral)
- v6new.2: financial features (neutral, EPS growth is noise)
- v6new.3: small-cap (blocked, survivorship bias)
- v6new.4-6: cross-event drift variants (rejected)
- v6new.7: engine pruning (quality up, count down)
- v6new.8: coverage expansion with 2 new post-market engines (best result)

Best result: v6new.8 SQS 41.5 vs v6.29 control 32.3 on same conditions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 months ago
I Luk Kim 02542248b7 Add attention-aware PEAD caps and promote step75 5 months ago
I Luk Kim b507fbf499 Add attention client and continue PEAD research 5 months ago
I Luk Kim c646303423 Recalibrate public SQS and exposure-aware tracking 5 months ago
I Luk Kim 9ec0b26e10 Implement multi-engine PEAD strategy research workflow 5 months ago
I Luk Kim cb19afa87b feat: add strategy improvement tracking system (SQS + journal + leaderboard)
Track experiment cycles with SQS scoring (0-100), JSONL journal, and
auto-generated leaderboard to prevent duplicate experiments and enable
data-driven strategy decisions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 months ago
I Luk Kim 191653394d feat: scoring cleanup — alpha-only composite, default-deny unknown events, new exit/risk features
Remove 5 non-alpha features (earnings surprise, risk penalty, parse confidence,
direction clarity, LM sentiment) from composite score to eliminate double-counting
with hard gates and noise sources. Redistribute weights to 5 alpha features.

Add default-deny for unknown event types, no-follow-through early exit (D+1),
kill switch log-only mode, macro regime size scaler. Remove SUE gate (Gate 8).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 months ago
I Luk Kim 4d0e773ba0 feat: overhaul strategy — document quality > price momentum
Flip scoring weights so event/document quality is primary signal (55%)
and market confirmation is secondary (35%). Add research mode with
kill-switch cooldown/reset, veto gates for bad events, reduced portfolio
risk, and 4 diagnostic analysis scripts.

Phase A: Research mode kill-switch reset, risk reduction (0.5%/trade,
max 4 positions), bullish-only direction for all event types.

Phase B: 2 new sub-scorers (parse_confidence, direction_clarity),
4 veto gates (oneoff risk, parse confidence, unknown/bearish direction).

Phase C: signal_quality, event_type_decomposition, kill_switch_impact,
concurrent_position analysis scripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 months ago
I Luk Kim cdf6ae3493 feat: Phase 5 fundamental strategy improvements
Fix core strategy flaws identified from academic research and Phase 4
backtest results (23% win rate, 0% target hits, 77% stop exits).

5A — Exit mechanics: ATR-based targets (reachable ~4.5% vs unreachable ~6-8%),
     partial profit-taking at target with breakeven stop on remainder,
     wider catastrophic stop (3.0 ATR), trailing stop enabled by default.
5B — Event-type-specific logic: EventTypeProfile with per-type overrides
     for holding days, ATR multipliers, score thresholds, direction filter.
     Disabled management_change and other_material_event (low evidence).
5C-1 — Expanded universe from 15 to 97 symbols across sectors including
       mid-cap growth where PEAD is stronger.
5C-3 — Bootstrap 95% confidence intervals for key trade metrics.
5D — SUE integration: earnings surprise scoring (eps_growth_qoq) at 10%
     weight, entry gate blocks negative EPS surprise for earnings events.
5F — Extended label horizons to 10D/20D with Alembic migration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 months ago
I Luk Kim 2f4d9f61f7 feat: implement Phase 4 -- event-driven backtester
Full backtesting engine that reads Parquet snapshots and simulates a
swing-trading strategy with no look-ahead bias.

## New modules (libs/backtest/)
- domain.py: All Pydantic v2 models (Candidate, PlannedOrder, FilledTrade,
  OpenPosition, DailyPortfolioState, MetricsBundle, BacktestConfig, etc.)
- calendar.py: Thin wrappers over time_utils + reaction_date
- manifests.py: Config load/deep-merge/validate, run-ID generation
- metrics.py: 21 pure-function metrics (no pandas, stdlib statistics only)
- selector.py: build_candidate(), rank_candidates() (score↓ ADV↓ symbol↑)
- allocator.py: 7-gate run_entry_gates(), ATR stop, floor() shares
- execution.py: simulate_entry/exit(), update_trailing_stop() (ratchet-up only)
- splits.py: Walk-forward windows, year/regime split utilities
- snapshot_store.py: Sync load() → asyncio.run(_async_load()), no look-ahead
- artifacts.py: Full run-dir writer (Parquet, CSV, JSON)

## App modules (apps/backtester/)
- run.py: BacktestRunner (exit-first→entry simulation, 25% kill switch) + CLI
- replay.py: Double-run determinism checker

## Config files
- configs/backtest/defaults.json: Base strategy defaults
- configs/experiments/baseline_v1.json: First experiment manifest

## Tests: 142 new tests, all passing
- 132 unit tests (no DB/HTTP required)
- 8 integration tests (synthetic SnapshotStore)
- 3 backtest determinism/replay tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 months ago