매도(sell) 주문이 현재가가 아닌 매수가(entry_price) 지정가로 나가던 버그(issue #10) 정정. 슬롯의 매수 전용 entry_price 를 side 무관 "현재 pending 주문 지정가" limit_price 로 내부 rename 하고, pending 이탈(→holding/→closed) 시 clear 해 매수 지정가가 매도로 누수되는 경로를 구조적으로 제거. 거버넌스: 전부 change-req (신규 REQ 없음, dcy-012 OQ-3). - REQ-002: Slot entry_price→limit_price rename + clear-on-exit 생애주기 - REQ-006: daily_slot 컬럼 rename 마이그레이션 006 (idempotent) + persistence 매핑 - REQ-013: _dispatch 가 slot.limit_price 단일 필드로 가격/주문유형 결정 - REQ-007: SellIntent/sell payload optional limit_price + _admit_sell 운반 - REQ-036: SlotService.sell optional 가격 → 자율 매도(safety-sell/kill-switch) 시장가 - REQ-003: 컬럼 계약/드리프트 가드 limit_price 반영 - REQ-015: runtime-flows/interface-contract/data-model 정합 매도 정책(OQ-1 하이브리드): 가격 지정→지정가("00"), 미지정→시장가("01"). 자율 매도는 가격 미전달 → 항상 시장가 (손절 미체결 pending_sell 갇힘 방지, issue #9 연계). 검증: 단위 286 passed/32 skipped, 인프라 게이트(PG+RabbitMQ) 318 passed, ruff clean. 신규 test_sell_pricing(recording broker)로 지정가 매수 슬롯의 매도가 매수가 재사용 안 함을 직접 검증. BAT-016 release-candidate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3.0 KiB
3.0 KiB
BAT-016: 매도 가격 정책 정정 + 슬롯 entry_price→limit_price rename (sell dispatch 버그)
- Status: release-candidate
- Profile: standard
- Source Discovery: dcy-012
- Included REQ: REQ-013 (CHG-20260608-01), REQ-007 (CHG-20260608-02), REQ-036 (CHG-20260608-01), REQ-002 (CHG-20260608-01), REQ-006 (CHG-20260608-01), REQ-003 (CHG-20260608-01), REQ-015 (CHG-20260608-01)
Summary
- dcy-012(매도 주문이 현재가가 아닌 entry_price 지정가로 나가는 버그, issue #10)를 단일 standard batch 로 delivery 한다. 거버넌스는 dcy-012 OQ-3 결정대로 전부 change-req, 신규 REQ 없음.
- 핵심: 슬롯의 매수 전용
entry_price를 side 무관 "현재 pending 주문 지정가" 단일 필드limit_price로 내부 rename(Option A) 하고, pending 이탈(→HOLDING/→CLOSED) 시 clear 한다._dispatch는slot.limit_price한 필드만 읽어 가격/주문유형을 결정(값=지정가00, 없음=시장가01).SellIntent/sell payload 에 optionallimit_price추가, 자율 매도(safety-sell/kill-switch)는 가격 미전달 → 시장가.
Scope
- In Scope:
- 슬롯
entry_price→limit_price내부 rename(도메인 모델/EXPECTED_SLOT_FIELDS, REQ-002) + pending 이탈 clear 생애주기 - DB 컬럼 rename 마이그레이션
006_*.sql(idempotent) + persistence 매핑 (REQ-006) _dispatch가slot.limit_price단일 필드로 가격/주문유형 결정 (REQ-013)SellIntent/sell payload optionallimit_price+_admit_sell운반,SlotService.selloptional 가격 (REQ-007/REQ-036)- 컬럼 계약/드리프트 가드 갱신 (REQ-003)
- baseline 문서(runtime-flows/interface-contract/data-model) 정합 (REQ-015)
- 슬롯
- Out of Scope:
- 외부 buy/sell payload·slot read 의 필드명(
entry_price) rename — REQ-007/dcy-011 과 조율할 별도 계약 변경(NFR-3 호환 유지) - issue #9(KIS 외부 취소 시 pending_sell 갇힘) 자체의 복구 로직 — 본 버그는 #9 의 한 원인 제거, 복구는 후속 분리
- dispatch 시 현재가 자동 조회(
get_current_price) 기반 지정가 — OQ-1 미채택 - buy 주문 가격 의미 변경(매수 지정가는 동일 limit_price 로 set, 동작 동일)
- 외부 buy/sell payload·slot read 의 필드명(
Documents
- Planning: planning.md
- Design: design.md
- Implementation: implementation.md
- Verification: verification.md
Notes
- Source discovery 단일(dcy-012). OQ-1(하이브리드)·OQ-2(가격 유무 분기)·OQ-3(전부 change-req) Answered.
- 버그 재현 조건:
entry_price가 채워진 지정가 매수 슬롯의 매도. 시장가 매수 슬롯은 entry_price=NULL 로 우연히 정상 → 검증은 지정가 매수 슬롯 케이스 필수(S-1). OrderRequest.limit_price(broker_port) 는 기존 존재 — 슬롯 필드 rename 으로 이름까지 정합.- 마이그레이션은 글롭 재적용 모델이므로 006 은 idempotent DO-block(컬럼 존재 시에만 rename).