STK10-16 관심종목 시그널 재계산
작업 내용
worker가 collected.v1 수신 시 관심종목 시그널을 재계산·영속화하는 수직 슬라이스다. 관심종목 시그널은 기존 signal_snapshots(STK9)에 영속화한다.
- worker application:
RefreshWatchlistSignalUseCase— BE에서 관심종목·수급 팩터 read → ml 시그널 compute → BE signal upsert - worker infrastructure: BE read/persist client, ml compute client (STK10-13 client 재사용)
- backend presentation: signal upsert API — 기존 signal_snapshots 저장 경로 재사용(STK9-03), 없으면 보강
다이어그램
처리 흐름
sequenceDiagram participant EW as EventWorker participant UC as RefreshWatchlistSignalUseCase participant BE as backend API participant ML as ml compute EW->>UC: refresh(baseDate) UC->>BE: 관심종목·수급 팩터 read UC->>ML: 시그널 compute(inputs + factors) ML-->>UC: signals UC->>BE: upsert signal_snapshots (멱등)
클래스 의존
flowchart LR UC[RefreshWatchlistSignalUseCase] --> BEClient[backend client] UC --> MLClient[ml client] BEClient --> BE[backend signal upsert] MLClient --> ML[ml 시그널 compute]
테스트 케이스
- collected.v1 처리 시 관심종목 시그널이 재계산되어 signal_snapshots에 영속화된다
- 관심종목이 없으면 ml 호출 없이 스킵한다
- 동일 baseDate 재처리 시 멱등하게 덮어쓰기된다
- 수급 팩터가 ml 입력으로 전달돼 가중 반영된다
- ml·BE 호출 실패 시 재시도/DLQ 대상이 된다