feat(reconcile): safely seed canonical cost basis

This commit is contained in:
Hermes Agent
2026-07-17 09:57:08 +09:00
parent 18bd8d9f0b
commit 81a853a314
25 changed files with 1689 additions and 66 deletions
+14
View File
@@ -452,3 +452,17 @@ trex-notifier (단일 소비자) → 텔레그램 등 전달
| 소비자 | 전략 모듈(strategy_id 필터) | trex-notifier 단독 |
| 발행 재시도 | 재연결 후 1회 retry | **없음** (best-effort) |
- 2026-07-06 :: BAT-056 (dcy-002 FR-6, REQ-117/118) — 브로커 집행 venue 전달 경로 명시: `OrderRequest.venue`(기본 KRX) → KIS 어댑터 `EXCG_ID_DVSN_CD` 항상 명시 전송(submit_order/cancel_order). `get_current_price` market 파라미터 추가(기본 J). poll_fill TR 유지(NXT 체결 open item). 기존 orb/tsl 경로 무영향.
## Flow: `operator sync` (REQ-105/REQ-123, dcy-034 / BAT-051)
- Operator CLI `trex-core sync`는 브로커 잔고를 1회 조회해 슬롯 병합을 수행한다.
- 대상 슬롯은 상태별로 다음 규칙을 따른다:
- `PENDING_*`: 쓰기 스킵(수정 없음, warning clear 없음)
- `broker_qty == 0`: 스킵(안전 가드)
- `HOLDING`: qty(및 avg_price) 갱신
- `INACTIVE`: qty onboarding 시 `cost_basis`를 `seeded_avg_price`로 seed 시도
- `INACTIVE` 상태에서 `broker_qty > 0`이나 seedable avg_price가 없으면:
- `--dry-run`은 `skipped=True`, `seeded_avg_price=False`, `cost_basis_reason=<reason>`만 노출하고 status/qty/avg_price 변경을 수행하지 않는다.
- live는 `cost_basis_unavailable` 에러로 fail-closed 하여 status/qty/avg_price 쓰기를 모두 거부한다.
- 결과 객체에는 `before/after`, `warning_cleared`, `seeded_avg_price`, `cost_basis_source`, `cost_basis_reason`, `error`가 포함되어 운영자가 no-write/fail-closed 여부를 판별할 수 있다.