10 Commits (2aba6418e6885b9eefeda12bb0079512053a04b4)

Author SHA1 Message Date
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 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 3c13c9e1b5 Add vix_pead regime sizing mode and macro experiments (v6new.19-21)
New in allocator.py:
- vix_pead mode: boosts sizing at VIX>18 (PEAD favorable), penalizes VIX 15-18
- Fixed vix_scaler application to support boost (scaler > 1.0)

Results:
- v6new.19 (spy_qqq risk_off=0.55): SQS 62.8 — reduces size in favorable PEAD regime
- v6new.21 (vix_pead boost+penalty): SQS 46.9 — penalty too aggressive, kills trades

VIX signal is real (62.3% vs 48.2% WR) but sizing alone can't capture it:
- Boosting doesn't help because same trades just get bigger
- Penalizing shrinks or drops trades, losing count
- Need the signal in TRADE SELECTION, not just sizing

v6new.9 (SQS 63.3) remains best.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 months ago
I Luk Kim b507fbf499 Add attention client and continue PEAD research 5 months ago
I Luk Kim 9ec0b26e10 Implement multi-engine PEAD strategy research workflow 5 months ago
I Luk Kim 2395a0c0c3 feat: PEAD mid-cap strategy + pipeline hardening + README cleanup
- Implement PEAD 7% Long+Short strategy with mid-cap universe expansion
- Add Stock Oracle screener/company clients, text sentiment features
- Enhance backtest engine: short-side execution, walk-forward CV, MFE/MAE analysis
- Harden pipeline: sequential Oracle API calls, scoring recalibration (event_quality 65%)
- Add experiment configs for 60+ strategy variants and journal tracking
- Add review/analysis CLI tools
- Remove obsolete dev/phase0-4 design documents and analysis scripts
- Clean README to reflect only implemented features (remove unbuilt adapters/engines)

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