2.6 KiB
2.6 KiB
id, status, discovery, criteria
| id | status | discovery | criteria | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| req-0008 | approved | dcy-0008 |
|
기업행동 원가를 WAC replay에 반영 (#37)
Objective
기업행동이 포함된 portfolio의 holdings cost-basis가 기업행동 감사 기록의 authoritative 총원가와 기업행동 후 수량을 사용하여 현재 원가를 반환하고, 계산에 필요한 metadata가 없을 때 병합 전 원가를 정상값처럼 노출하지 않도록 한다.
Scope
GET /v1/portfolios/{portfolio_id}/holdings/cost-basisreplay에 repository가 결합한stock_consolidationmetadata를 전달한다.- 정상 기업행동은
quantity_after를 현재 replay 수량으로 적용하고 감사 기록의total_cost_basis를 authoritative 총원가로 보존하며, 주당 원가는total_cost_basis / quantity_after로 계산한다. - 기업행동 이후 BUY/SELL 또는 후속 기업행동이 있으면 같은 시간순 ledger replay 안에서 현재 수량·주당 원가·총원가를 계속 계산한다.
- 필수 기업행동 metadata인 양수
quantity_after또는total_cost_basis가 없으면 기업행동 전 WAC로 추정하지 않고 holdings 응답의cost_basis_per_unit과total_cost_basis를null로 반환하며, 기존 warning 필드로 기업행동 metadata 부족을 구분한다. - 정상·불완전 기업행동, 기업행동 이후 거래, BUY/SELL-only, authorization, ordering과 consumer compatibility를 회귀 검증하고 interface contract를 동기화한다.
Constraints
- 기업행동 감사 기록의
total_cost_basis가 원가 총액의 정본이다. Persistedaverage_price_after를 곱하여 총원가를 재구성하거나 별도의 허용오차 판정에 사용하지 않는다. HoldingsCostBasisResponse의 기존 필드와 nullability를 유지하며 신규 reason field 또는 DB migration을 추가하지 않는다.- Repository의
executed_at ASC, ledger_entry_id ASC순서, daemon scope와 portfolio ownership 검증을 유지한다. - 기업행동이 없는 BUY/SELL-only portfolio의 WAC 및 기존 불완전 거래 이력 warning 의미를 변경하지 않는다.
- trex-core source와 검증 tolerance를 변경하지 않는다.
Non-Goals
0.1%,1,000원 상한, 소수점 8자리 일치 등 기업행동 원가의 추가 tolerance 정책.- Corporate-action write transaction, idempotency, recovery, cash, profit buffer, portfolio reference price 또는 기존 ledger row의 수정·backfill.
- Broker 주문, trex-core slot 변경, B warning 삭제, production rollout 또는 특정 production portfolio 보정.