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.
fithia2/docs/leader_intraday_momentum_wo...

175 lines
11 KiB
Markdown

# Leader Intraday Momentum Workflow
이 문서는 `Leader Intraday Momentum High WR Intraday First` 전략을 개발하고
검증하는 운영 기준이다. 기존 `orb_gainers`와 달리 이 전략은 ORB breakout보다
`장 초반 top leader follow-through`를 직접 매매하는 momentum 전략이다.
## Source Of Truth
정식 전략 파일:
- [leader_intraday_momentum_high_wr_intraday_first.yaml](/Users/yirugi/mycloud/personal/workspace/fithia2/configs/intraday/strategies/leader_intraday_momentum_high_wr_intraday_first.yaml)
공식 검증 경로:
- [apps/intraday_bt/run.py](/Users/yirugi/mycloud/personal/workspace/fithia2/apps/intraday_bt/run.py)
연구 helper나 momentum snapshot 결과는 빠른 탐색용이다. 최종 채택 판단은 반드시
아래 공식 CLI와 웹사이트가 사용하는 동일 경로로 재검증한다.
```bash
python -u -m apps.intraday_bt.run \
--config configs/intraday/strategies/leader_intraday_momentum_high_wr_intraday_first.yaml \
--start 2026-01-02 \
--end 2026-03-31 \
--daily-budget-reset \
--no-compound-returns
```
전략 개발 검증은 `daily_budget_reset + no compound`를 기본으로 한다. 이는 날짜별
edge를 보기 위한 연구 모드이며, 후반 구간의 복리/계좌 규모 효과로 과적합되는
문제를 줄인다. 실전 계좌 결과는 별도로 simple/compound 모드에서 확인한다.
## Current Engine
핵심 구조:
- Universe는 정식 `broad` 3408개 티커를 사용한다.
- Daily seed는 look-ahead 없이 당일 open 이전/entry 시점까지 알 수 있는 feature만 쓴다.
- Intraday-first shortlist를 만든 뒤, 10분 entry와 5분 confirmation으로 재랭킹한다.
- Five-sleeve selection으로 `core`, `volume`, `gap`, `trend`, `blend`를 분리한다.
- Same-day filing catalyst는 additive alpha가 아니라 weak tail exemption 판단에 쓴다.
- Moderate-gap liquid reserve는 sparse day에서만 broad scan이 잡는 liquid follow-through 후보를 보강한다.
- Multi-event liquid overlay는 core basket을 건드리지 않고, broad same-day filing cluster가 확인된 날에만 별도 budget으로 liquid continuation names를 추가한다.
- 손실 방어는 개별 티커 블랙리스트가 아니라 구조 조건만 사용한다.
현재 방어 레이어:
- `weak-event tail defense`: event flag가 있어도 support score가 낮으면 sparse-day 방어 예외로 보지 않는다.
- `low-momentum single-name defense`: single-name day에서 유일한 후보의 morning gain이 낮고 supported event/largecap도 아니면 day budget을 줄인다.
- `soft-day sparse defense`: soft day인데 basket이 1~2개뿐이고 event / liquid large-cap / moderate-gap liquid support가 없으면 day budget을 추가로 줄인다.
- `trailing_stop_pct: -0.07`: hard take-profit 없이 intraday trailing stop으로 큰 downside를 제한한다.
- `loss_containment_score`: WR/DD와 별도로 손실일 평균과 tail loss를 직접 보는 보조 지표다.
## Official Validation Windows
과적합 방지를 위해 2026 Q1만 보지 않고 2025년 분기별 official backtest를 같이 본다.
```bash
python -u -m apps.intraday_bt.run --config configs/intraday/strategies/leader_intraday_momentum_high_wr_intraday_first.yaml --start 2025-01-02 --end 2025-03-31 --daily-budget-reset --no-compound-returns
python -u -m apps.intraday_bt.run --config configs/intraday/strategies/leader_intraday_momentum_high_wr_intraday_first.yaml --start 2025-04-01 --end 2025-06-30 --daily-budget-reset --no-compound-returns
python -u -m apps.intraday_bt.run --config configs/intraday/strategies/leader_intraday_momentum_high_wr_intraday_first.yaml --start 2025-07-01 --end 2025-09-30 --daily-budget-reset --no-compound-returns
python -u -m apps.intraday_bt.run --config configs/intraday/strategies/leader_intraday_momentum_high_wr_intraday_first.yaml --start 2025-10-01 --end 2025-12-31 --daily-budget-reset --no-compound-returns
python -u -m apps.intraday_bt.run --config configs/intraday/strategies/leader_intraday_momentum_high_wr_intraday_first.yaml --start 2026-01-02 --end 2026-03-31 --daily-budget-reset --no-compound-returns
```
Latest official results as of 2026-04-21 after promoting the multi-event liquid overlay into the flagship:
| Window | Result file | Return | WR | Max DD | LC | Trades |
|---|---|---:|---:|---:|---:|---:|
| 2025 Q1 | `runs/intraday/intraday_20260421_220246_34b0dff0.json` | +6.56% | 55.1% | -10.93% | 66.11 | 89 |
| 2025 Q2 | `runs/intraday/intraday_20260421_223436_79a89cb1.json` | +23.23% | 60.0% | -4.31% | 66.80 | 60 |
| 2025 Q3 | `runs/intraday/intraday_20260421_224448_ccd2985b.json` | +6.92% | 49.6% | -6.81% | 64.38 | 135 |
| 2025 Q4 | `runs/intraday/intraday_20260421_222253_6f5a98e0.json` | -5.24% | 41.8% | -15.47% | 65.33 | 122 |
| 2026 Q1 | `runs/intraday/intraday_20260421_221923_2ea8b7f2.json` | +16.14% | 55.4% | -6.16% | 66.33 | 148 |
해석:
- 2025 Q4는 아직 음수라서 전략의 약점 구간이다.
- 다만 multi-event overlay는 2025 Q1/Q2/Q3/Q4 official 창에서는 아예 발화하지 않아, 약한 분기들을 추가로 오염시키지는 않았다.
- 2026 Q1 holdout에서는 2026-01-02 한 번의 broad filing cluster에서만 발화했고, 그 날 `APLD`, `BMNR` 두 개를 추가해 flagship 대비 수익률과 WR을 끌어올렸다.
- 다음 개선은 개별 종목을 외우는 방식이 아니라 Q4 같은 weak regime을 더 잘 감지하는 meta-layer여야 한다.
- `sector thrust` breadth engine은 2026-04-21에 코드로 추가해 실험했지만, 정식 전략에 full enable하면 2026 Q1 holdout이 약 `+21.92% -> +15.98%`까지 악화돼 아직 승격하지 않았다.
## Actual Catalyst Branches
2026-04-21에 `actual catalyst + liquid leader continuation` 방향도 분리 검증했다.
전략 파일:
- `configs/intraday/strategies/leader_intraday_momentum_actual_catalyst_liquid.yaml`
- `configs/intraday/strategies/leader_intraday_momentum_event_day_liquid_hybrid.yaml`
Q1 결과:
| Variant | Result file | Return | WR | Max DD | Trades | Notes |
|---|---|---:|---:|---:|---:|---|
| strict event-only | `runs/intraday/intraday_20260421_205738_1f70d7db.json` | +3.21% | 63.6% | -7.87% | 11 | actual filing catalyst만 거래해서 너무 sparse했다 |
| hybrid event reserve | `runs/intraday/intraday_20260421_210703_5bb723e7.json` | +15.65% | 54.8% | -6.14% | 146 | baseline보다 아주 미세하게 개선됐지만 구조 변화는 작았다 |
| baseline flagship | `runs/intraday/intraday_20260421_211021_30f71c80.json` | +15.59% | 54.8% | -6.19% | 146 | 비교 기준 |
해석:
- strict event-only는 방향성은 맞아도 메인 엔진으로 쓰기엔 너무 희소하다.
- hybrid는 `candidate_allowed_event_types`를 통해 `earnings_release`, `guidance_update`, `material_contract`, `other_material_event`만 event로 인정하게 했지만, Q1 기준으로 baseline 대비 개선폭은 `+0.06%` 수준에 그쳤다.
- 즉, actual catalyst를 reserve/overlay로만 넣는 것만으로는 아직 획기적 변화가 없었다.
- 다음 구조 개선은 `event issuer 자체`를 더 사는 것이 아니라, `event day에 broad scan에서 잡힌 liquid continuation names를 별도 engine/sleeve로 어떻게 승격할지` 쪽이 더 유망하다.
## Multi-Event Liquid Overlay
2026-04-21 최종 승격안은 strict event reserve가 아니라 `overlay-only` 구조였다.
핵심 규칙:
- core basket은 [leader_intraday_momentum_high_wr_intraday_first.yaml](/Users/yirugi/mycloud/personal/workspace/fithia2/configs/intraday/strategies/leader_intraday_momentum_high_wr_intraday_first.yaml)과 동일하게 유지한다.
- filing data는 core rank에 섞지 않는다.
- 대신 `earnings_release`, `guidance_update`, `material_contract`, `other_material_event`, `management_change`, `unknown` 중에서 **2개 이상** same-day contributor가 동시에 보이고, 합산 entry dollar volume이 **$100M 이상**일 때만 overlay를 켠다.
- overlay가 켜진 날에만 day budget의 12%를 써서, base basket 밖의 liquid continuation names를 최대 2개 추가한다.
최종 해석:
- 2025 official 창에서는 overlay가 발화하지 않았고 결과도 거의 그대로 유지됐다.
- 2026 Q1에서는 2026-01-02 하루만 발화했고, `APLD`, `BMNR` 두 개가 추가됐다.
- 이 한 번의 broad event cluster가 `+16.14% / WR 55.4% / DD -6.16%`를 만들었고, 직전 flagship 비교치 `+15.59% / WR 54.8% / DD -6.19%`보다 좋아졌다.
- 즉, 이 overlay는 “매일 조금씩 손대는 additive factor”가 아니라, **희소하지만 설명 가능한 broad event cluster day에만 붙는 post-allocation sleeve**로 이해해야 한다.
## Liquid Continuation Core Experiment
`moderate-gap liquid / liquid large-cap / sector thrust`를 overlay가 아니라
**full core basket engine**으로 승격한 실험도 별도로 진행했다.
- 전략 파일: [leader_intraday_momentum_liquid_continuation_core.yaml](/Users/yirugi/mycloud/personal/workspace/fithia2/configs/intraday/strategies/leader_intraday_momentum_liquid_continuation_core.yaml)
- 코드 변경:
- `momentum_selection_mode: liquid_continuation`
- `candidate_intraday_rank_mode: liquid_continuation`
- same-day `support_score`, `is_liquid_largecap`, `is_moderate_gap_liquid`를 candidate weighted rank에 추가
결과:
- 1차 broad version: [intraday_20260421_235041_f5aeac8a.json](/Users/yirugi/mycloud/personal/workspace/fithia2/runs/intraday/intraday_20260421_235041_f5aeac8a.json)
- `2026 Q1: -6.98%`, `WR 47.7%`, `DD -13.52%`
- stricter version: [intraday_20260421_235327_04e5bda8.json](/Users/yirugi/mycloud/personal/workspace/fithia2/runs/intraday/intraday_20260421_235327_04e5bda8.json)
- `2026 Q1: -0.43%`, `WR 46.8%`, `DD -11.56%`
- walk-forward spot check: [intraday_20260421_235647_93d29530.json](/Users/yirugi/mycloud/personal/workspace/fithia2/runs/intraday/intraday_20260421_235647_93d29530.json)
- `2025 Q1: -2.31%`, `WR 41.8%`, `DD -9.23%`
결론:
- 이 엔진은 실제로 `special liquidity` 이름만 중심으로 고르도록 동작했지만,
**flagship을 대체할 full core engine으로는 아직 edge가 없다.**
- 특히 moderate-gap liquid 정의를 core로 올리면 거래 수는 줄어도 분기 성과가
baseline보다 지속적으로 나빠졌다.
- 따라서 현재 판단은 `liquid continuation`을 full replacement로 승격하지 말고,
**tail replacement / reserve slot / rare-day sleeve** 쪽에만 제한적으로 쓰는 편이 낫다.
## Required Checks Before Keeping A Change
변경을 유지하려면 최소한 아래를 확인한다.
- Unit tests pass:
```bash
pytest -q tests/unit/intraday/test_simulator.py tests/unit/intraday/test_run_helpers.py tests/unit/intraday/test_screener.py tests/unit/intraday/test_metrics.py
```
- 2026 Q1 official result가 무너지지 않는다.
- 2025 Q1/Q2/Q3/Q4 중 한 분기만 좋아지고 다른 분기들이 크게 악화되지 않는다.
- 결과 JSON의 trade diagnostics로 변경이 어떤 구조에 적용됐는지 설명 가능해야 한다.
## Known Bottleneck
분기별 official 검증에서 `Fetching momentum filing catalysts` 단계가 가장 느리다.
현재는 캐시가 있어도 90% 이후 일부 ticker 조회가 오래 걸린다. 전략 검증 자체는
정상 완료되지만, 다음 인프라 개선은 event 조회 범위 축소나 캐시 hit 판정 개선이
우선이다.