feat: Triple Barrier 시간장벽을 캘린더 분 기반으로 전환 (#329) #346
Reference in New Issue
Block a user
Delete Branch "feature/issue-329-triple-barrier-calendar-minutes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
BacktestBar에timestamp필드 추가(옵션)max_holding_minutes사용 시 모든 bar의 timestamp 존재를 강제 검증max_holding_bars에서max_holding_minutes기준으로 전환Test
pytest -q tests/test_triple_barrier.py tests/test_backtest_pipeline_integration.pypython3 -m py_compile src/analysis/backtest_pipeline.py tests/test_backtest_pipeline_integration.pyRefs: #329
PR #346 Review: ACT-12 Triple Barrier 시간장벽 backtest pipeline 연결
✅ LGTM
플랜 준수: ACT-12 (GAP-5, #329) — Triple Barrier 시간장벽을 캘린더 시간(분) 기반으로 전환. PR #334(triple_barrier.py)의 후속으로 backtest pipeline 연결 완성.
구현 품질:
BacktestBar.timestamp: datetime | None = None기본값으로 하위 호환 유지max_holding_minutes설정 시에만 timestamp 필요 — 불필요한 제약 없음any(ts is None for ts in timestamps)전수 검사로 조용한 오동작 방지 (ValueError 즉시 발생)max_holding_bars→max_holding_minutes마이그레이션 +_bars()헬퍼 timestamp 추가Nit (optional, 머지 차단 아님):
위 체크를 통과한 시점에서
if ts is not None필터는 논리적으로 불필요합니다. mypy 타입 추론을 위한 코드라면# type: ignore또는cast()쪽이 의도를 더 명확히 표현합니다.리뷰 nit 반영했습니다.\n\n- 를 제거하고, non-null 검증 직후 로 의도 명시\n- 테스트: ..... [100%]
5 passed in 0.16s (5 passed)\n- 컴파일: \n\n반영 커밋:
리뷰 nit 반영했습니다.
resolved_timestamps = [ts for ts in timestamps if ts is not None]제거cast(list[datetime], timestamps)로 의도 명시검증:
pytest -q tests/test_backtest_pipeline_integration.py(5 passed)python3 -m py_compile src/analysis/backtest_pipeline.py반영 커밋:
273a3c1Nit 반영 확인 ✅
cast(list[datetime], timestamps)로 교체 확인. 바로 위any(ts is None)체크가 None 부재를 보장하므로 런타임 비용 없이 타입 체커 만족 — 정확한 접근입니다.from typing import castimport 추가도 확인.LGTM.