BAT-032 (dcy-022): timeout_sec/slippage_pct 실행 정책, 미체결 자동 취소, 보호 지정가, `trex-core cancel` 백스톱. 마이그레이션 012. BAT-033: `trex-core enter --qty` 필수 검증 — 미지정 시 RPC 전 즉시 오류. BAT-034 (dcy-023): allocated_capital 죽은 필드 전 경로 제거 (domain·intent· persistence·snapshot·CLI). 마이그레이션 013(비가역 DROP). 외부 발신자 unknown key 무시 수신 의미론 적용. REL-006 confirmed: BAT-026~034 통합 릴리즈, pre-release smoke 증거 포함. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5.3 KiB
5.3 KiB
req-068: intent 실행 정책 계약 — timeout_sec + slippage_pct
- Status: Implemented
- Type: Interface
- Priority: High
- Owner: project maintainers
Intent
- buy/sell intent 계약에 실행 정책 필드(
timeout_sec·slippage_pct)를 추가해 전략이 "어떻게 체결할지"를 함께 선언한다. core 는 수신 측 먼저 배포 가능(optional, 하위호환). (dcy-022 FR-1)
Requirement
- buy/sell intent payload 에 optional 필드 추가:
timeout_sec(주문 유효시간 — N초 미체결 시 core 가 cancel_order 송신·롤백) ·slippage_pct(체결 보호밴드 — entry_price 기준 ±pct 실효 지정가). 두 필드 모두 optional — 미지정 시 기존 동작 하위호환(무기한 지정가/시장가).timeout_sec미지정 시 per-instance TOMLdefault_order_timeout_sec(opt-in, 미설정=OFF=무기한) 를 기본값으로 적용하고 per-intent 값이 override 한다.slippage_pct기본값 없음(미지정=보호밴드 없음). core 수신 측 먼저 배포(누락 시 무시 — orb-v1 발신과 lockstep 불필요). deprecate 없음(전부 신규 optional 필드, 기존 계약 보존).
Acceptance Criteria
- Given buy intent 에
timeout_sec=60포함, When core 수신, Then 슬롯에timeout_sec=60이 기록되어 집행 루프가 읽을 수 있다. - Given buy intent 에
slippage_pct=0.1포함, When core 수신, Then 슬롯에slippage_pct=0.1이 기록되어 dispatch 시 실효 지정가 산출에 쓰인다. - Given
timeout_sec미지정 intent, When per-instance configdefault_order_timeout_sec=120, Then 슬롯에timeout_sec=120이 기록된다(config 기본값 적용). - Given
timeout_sec미지정 + config 미설정, When 수신, Then 슬롯timeout_sec이 None — 기존 무기한 동작과 동일(하위호환). - Given 기존 buy/sell intent(timeout/slippage 필드 없음), When 수신, Then 기존 경로와 byte-동등하게 처리된다(회귀 없음).
- Given per-intent
timeout_sec와 configdefault_order_timeout_sec둘 다 있음, When 수신, Then per-intent 값이 우선한다(override).
Impacted Area
- Docs: docs/interface-contract.md(payload 확장)
- Modules: trex_core/application/intents.py(BuyIntent/SellIntent +timeout_sec/slippage_pct, IntentService +default_order_timeout_sec), trex_core/application/messaging_handlers.py(파싱), trex_core/domain/slot/models.py(+컬럼), trex_core/domain/slot/service.py(transit_slot 전달), trex_core/adapters/persistence/sql/012_add_execution_policy_fields.sql(DB)
- Config: DaemonInstanceConfig +default_order_timeout_sec
- Tests: 파싱·슬롯 기록·config 기본값·하위호환 단위
Notes
timeout_sec는 코어-타이밍(N초 후 cancel_order 송신) 이며 IOC/FOK 등 네이티브 TIF 는 후속 주기(dcy-022 OQ-1).slippage_pct는entry_price있을 때만 유효(OQ-2). 필드 역할:entry_price=기준·목표,slippage_pct=허용폭 → 실효 limit = entry_price*(1±pct).timeout_sec≠forced_close_at(포지션 만기 청산, REQ-037).- 출처: dcy-022 FR-1, OQ-1/OQ-2/OQ-3/OQ-4.
Change Log
CHG-20260610-01
- Date: 2026-06-10
- Author: Justin Ko
Change Summary
- dcy-022 FR-1 로부터 최초 생성(Proposed). intent 실행 정책 계약(timeout_sec + slippage_pct) 신규 정의.
Intent
- 실행 정책 optional 필드 계약을 backlog 로 정규화.
Acceptance Criteria Delta
- Added: AC-1~6 (timeout_sec 기록·config 기본값·slippage_pct 기록·하위호환·override 6개 기준)
- Updated: 없음
- Removed: 없음
Impacted Area Delta
- Docs: docs/interface-contract.md
- Modules: BuyIntent/SellIntent, messaging_handlers, intents, slot models, service, migration 012
- Tests: 파싱·기록·config·하위호환 단위
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 후 BAT-032 편성.
Validation Plan
- timeout_sec/slippage_pct 파싱·슬롯 기록·config 기본값·하위호환 단위 테스트.
CHG-20260610-02
- Date: 2026-06-10
- Author: Justin Ko
Change Summary
- Status Proposed → Approved (confirm-req). 필수 필드·구체 AC 충족, source dcy-022(confirmed, OQ-1~4 Answered, Freeze 승인)과 모순 없음.
Intent
- delivery input 으로 승격.
Acceptance Criteria Delta
- Added: 없음 / Updated: 없음 / Removed: 없음
Impacted Area Delta
- Docs: docs/srs/index.md (Register Approved) / Modules: 없음 / Tests: 없음
Delivery Trace Delta
- Batches: none / Releases: none
Revalidation Impact
- Reverification Needed: no / Existing Implementation Invalidated: no / Status Recommendation: keep-current / Follow-up Action: BAT-032 편성.
Validation Plan
- 승인 후 batch planning 에서 본 REQ AC 를 검증 기준으로 사용.
CHG-20260611-IMPL
- Date: 2026-06-11
- Author: Justin Ko
- Type: status
- Summary: Approved → Implemented (confirm-req-implemented). 근거: BAT-032(release-candidate) verification — 실행 정책(timeout_sec·slippage_pct) 계약·집행·운영자 cancel 백스톱 전 AC acceptance mapping 존재(신규 71 tests), 단위 425 passed 회귀 없음, baseline 2문서 수동 확인(M5). Blocking Issues 없음.