"""시간손절이 '손절(stop_loss)'로 분류·서술되던 문제 (2026-10-07).""" from app.core.config import settings from app.services.day_trading_strategy import TIME_STOP_REASON_PREFIX from app.services.trade_analyzer import _parse_exit_type def test_dt_time_stop_reason_is_time_stop(): reason = f"{TIME_STOP_REASON_PREFIX}: 32분 경과, 수익=-0.4% < {settings.DAY_TRADE_TIME_STOP_MIN_GAIN * 100:.1f}%" assert _parse_exit_type(reason) == "time_stop" def test_swing_time_stop_reason_is_time_stop(): assert _parse_exit_type("시간손절: 20거래일 보유, 수익 1.2% < 3%") == "time_stop" def test_real_stop_loss_still_stop_loss(): assert _parse_exit_type("손절: -7.2% (기준 -7%)") == "stop_loss" assert _parse_exit_type("stop_loss hit") == "stop_loss" def test_journal_comment_uses_settings_not_hardcoded(): import inspect from app.services import trade_analyzer src = inspect.getsource(trade_analyzer) assert "손절 기준(-6%" not in src # 옛 하드코딩 서술 제거 assert "RSI 65+" not in src