Files
trex-core/docs/srs/Documentation/req-054_safety-sell-cooldown-baseline-alignment.md
T
genichinandClaude Opus 4.8 565af6792c feat(safety-sell): dcy-010 BAT-014 — 영속 거부 재시도 쿨다운 (REQ-052~054)
dcy-010(safety-sell 영속 거부 재시도 백오프) 전체 SDLC: draft-req → confirm-req →
draft-batch(BAT-014 batch-lite) → run-batch-delivery → confirm-req-implemented.
2026-06-07 실 KIS LIVE SL/TP e2e에서 발견한 KIS 주문 spam 위험(영속 거부 시
매도 무한 재제출) 차단.

- REQ-052 (Integration): SafetySellService per-slot 인메모리 쿨다운
  (_in_cooldown/_attempt_sell/_prune_cooldown) — forced_close·stop-loss·take-profit
  트리거에 min_retry_interval_sec(600s) 이내 재시도 skip(가격 poll 포함) +
  max_retry_warn_count(3) 도달 시 WARNING + holding 이탈 정리. market_close 제외.
- REQ-053 (Configuration): SafetySellConfig min_retry_interval_sec/max_retry_warn_count
  + TREX_SAFETY_SELL_MIN_RETRY_INTERVAL/MAX_RETRY_WARN_COUNT env (additive)
- REQ-054 (Documentation): runtime-flows 쿨다운 flow + 가격체크 tr_id(FHKST01010100) 정정

인메모리 only(DB/스레드/인터페이스 변경 없음), default 미설정 시 기존 동작 불변.
검증: 신규 8 단위(쿨다운 6 + config 2), 전체 278 passed, ruff clean.
REQ-052~054 Implemented, BAT-014 release-candidate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 00:35:11 +09:00

3.6 KiB

req-054: safety-sell 쿨다운 runtime-flows 정합

  • Status: Implemented
  • Type: Documentation
  • Priority: Low
  • Owner: project maintainers

Intent

dcy-010 safety-sell 재시도 쿨다운(REQ-052/053) 구현 후 docs/runtime-flows.md의 safety-sell tick 흐름에 "쿨다운 체크 → 건너뜀/재시도" 단계를 반영한다(dcy-010 FR-6).

Requirement

  • docs/runtime-flows.md의 safety-sell 관련 흐름(forced_close / stop-loss·take-profit)에 per-slot 쿨다운 단계를 추가한다:
    • _safe_sell 호출 전 now - last_attempt_at < min_retry_interval_sec 이면 건너뜀
    • 쿨다운 만료 후 트리거 조건 유지 시 재시도 + attempt_count 증가
    • attempt_count >= max_retry_warn_count 시 WARNING 로그
    • 슬롯 holding 이탈 시 쿨다운 상태 정리
    • market_close 는 쿨다운 제외(하루 1회 가드)
  • (선택) docs/project-structure.md config.py 설명에 safety-sell env 2종 추가 반영.

Acceptance Criteria

  1. Given docs/runtime-flows.md의 stop-loss·take-profit / forced_close 흐름, When 읽으면, Then 쿨다운 체크(건너뜀/재시도)·경고 로그·holding 이탈 정리 단계가 서술되어 있다.
  2. Given docs/runtime-flows.md, When market_close 흐름을 읽으면, Then 쿨다운 제외(하루 1회 가드)가 명시되어 있다.

Impacted Area

  • Docs:
    • docs/runtime-flows.md (필수), docs/project-structure.md(선택)
  • Modules: 없음
  • Tests: 없음

Notes

  • REQ-052/053 구현 완료 후 batch verification 단계에서 수행(REQ-042/047/051 선례).

Change Log

CHG-20260608-01

  • Date: 2026-06-08
  • Author: Justin Ko

Change Summary

  • dcy-010(confirmed) → REQ-054 초안 생성.

Intent

  • safety-sell 쿨다운 runtime-flows 정합(FR-6)을 Documentation REQ 로 정규화.

Acceptance Criteria Delta

  • Added: AC-1~2 전체

Impacted Area Delta

  • Docs: runtime-flows.md, project-structure.md(선택)

Delivery Trace Delta

  • Batches: none (미할당)
  • Releases: none

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current
  • Follow-up Action: confirm-req 로 승인 (REQ-052/053 구현 batch 이후 연계).

CHG-20260608-02

  • Date: 2026-06-08
  • Author: Justin Ko

Change Summary

  • Proposed → Approved (confirm-req).

Intent

  • 승인 게이트 통과: 필수 필드·AC·Change Log 완비. baseline 정합 문서 REQ로 REQ-052/053 구현 후 verification 단계 수행.

Acceptance Criteria Delta

  • (변경 없음)

Impacted Area Delta

  • (변경 없음)

Delivery Trace Delta

  • Batches: none (미할당)
  • Releases: none

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current
  • Follow-up Action: draft-batch 로 delivery 편성(batch-lite, REQ-052/053 이후 연계).

CHG-20260608-03

  • Date: 2026-06-08
  • Author: Justin Ko

Change Summary

  • Status Approved → Implemented (confirm-req-implemented, 근거 batch BAT-014 release-candidate).

Intent

  • BAT-014 에서 docs/runtime-flows.md 에 "safety-sell 재시도 쿨다운" flow 추가(skip/재시도/경고/정리 + market_close 제외) + 가격체크 tr_id(FHKST01010100) 정정. AC-1~2 충족.

Acceptance Criteria Delta

  • (변경 없음)

Impacted Area Delta

  • (변경 없음)

Delivery Trace Delta

  • Batches: BAT-014 (release-candidate)
  • Releases: none

Revalidation Impact

  • Reverification Needed: no
  • Existing Implementation Invalidated: no
  • Status Recommendation: keep-current (Implemented)
  • Follow-up Action: draft-release 로 BAT-014 배포 편성.