Files
trex-core/docs/batches/bat-031_20260610_position-sizing/planning.md
T
genichinandClaude Opus 4.8 5ee5f7f4e2 docs(srs/batch): dcy-021 REQ + BAT-031 + Implemented 전환
- draft-req: REQ-066(사이징 도메인·end-to-end), REQ-067(baseline 정합) 신규
- change-req: REQ-057(CHG-03 holding→pending_buy)·REQ-061(CHG-04 사이징 intent)·
  REQ-062(CHG-03 부분 매도 min(주문,잔고)) — Implemented→Approved 후 재구현
- confirm-req: REQ-066/067 Approved
- BAT-031 batch(index/planning/design D1~D4/implementation/verification) → release-candidate
- confirm-batch-verification 승인 + confirm-req-implemented:
  REQ-057/061/062/066/067 → Implemented (BAT-031 verification 근거)
- srs/batch index + dcy-021 discovery 생성 REQ 역참조 갱신

(issue #21 dcy-022 는 별도 작업으로 미포함)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 18:53:53 +09:00

2.4 KiB

BAT-031 Planning

  • Status: confirmed
  • Batch: BAT-031
  • Profile: standard

Included REQ

  • REQ-066 (Interface, Approved): 사이징 도메인 수량/avg_price 재계산 + end-to-end.
  • REQ-067 (Documentation, Approved): baseline 4문서 정합.
  • REQ-057 (CHG-20260610-03, Approved): 상태머신 holding→pending_buy 전이.
  • REQ-061 (CHG-20260610-04, Approved): 사이징 intent(증액/부분 매도, 명령형 qty+price).
  • REQ-062 (CHG-20260610-03, Approved): 부분 매도 집행 min(intent,잔고)·부분 체결 실제만.

Delivery Plan (마일스톤)

  1. M1 (REQ-057): state.py 전이 집합에 HOLDING→PENDING_BUY 추가(증액). test_state 갱신(13 transitions).
  2. M2 (REQ-066): service.py 전이 필드 규칙 — 증액 pending(avg_price 보존), 매수 체결 avg_price 가중평균 + 수량 = 브로커 정본 resync.
  3. M3 (REQ-061): intents.py 사이징 admission — 증액 매수(holding 슬롯 buy, already_active 예외)·부분 매도(SellIntent qty). messaging_handlers payload(qty/price).
  4. M4 (REQ-062): execution.py — 부분 매도 dispatch qty = min(intent, 브로커 잔고), 매수/매도 체결 시 broker 정본 resync·avg 가중평균, 증액 롤백은 holding 복귀.
  5. M5 (REQ-067): baseline 4문서 정합 + run-the-app e2e.

Dependencies

  • Internal: dcy-020(자산 영구 슬롯·REQ-062 브로커 정본·집행 루프) 전 단계 green.
  • External: 전략 모듈(trex-orb)이 사이징 intent 발행 — 기존 buy/sell 와 병존(additive)이라 무중단.

Design Gate

  • Design Required Before Implementation: yes
  • Reason: M3/M4 는 라이브 주문 집행 동작 변경(증액 매수·부분 매도 dispatch). 증액 시 "주문 수량 vs 보유 수량" 충돌·avg_price 가중평균·증액 롤백·부분 체결 처리는 잘못 구현 시 과매수/과매도/평단 오류 → design.md 에서 확정.

Milestones

  1. M1 상태머신 + test
  2. M2 service avg/qty
  3. M3 intent
  4. M4 execution
  5. M5 baseline + e2e

Risks

  • R-exec (High): 증액/부분 매도 집행 회귀(과매수·과매도·avg drift). 대응: 브로커 정본 resync(REQ-062), 멱등, 단위+paper e2e.
  • R-statemachine (Medium): 전이 추가 회귀. 대응: additive + test_state 회귀 가드.
  • R-strategy (Medium): trex-orb 계약 전환. 대응: 기존 intent 병존.

Notes

  • green 기준: 단위 전체 회귀(증액/부분 매도/부분 체결/avg 가중평균) + paper run-the-app e2e + ruff.