fix(bat-052): CHG-20260626-02 보정 — buy_fee_only_assets 제거 + NFR-2 엄격화

portfolio-hub WAC가 매수 fee를 cost basis에 편입함에 따라(REQ-110 change-req)
이중계상을 방지하기 위해 buy_fee_only_assets 관련 로직을 전면 제거하고,
일중 닫힌 거래 AC-2 단언을 엄격 동치(realized_pnl_wac == realized_pnl)로 강화.

변경:
- OperatorReport.buy_fee_only_assets 필드 제거
- apply_wac_to_report buy_fee_only_assets 인자 제거
- buy_fee_by_asset 헬퍼 함수 제거
- render_text 매수전용 수수료 섹션 제거
- render_json buy_fee_only_assets 필드 제거 (WAC 필드 4개→3개)
- cli.py: buy_fee_by_asset import/사용 제거, 미사용 'from datetime import date, timedelta' 제거
- test_wac_equals_net_when_same_day_buy_sell: WAC 957.0, 엄격 동치 단언
- test_buy_only_assets_has_fee → test_buy_only_asset_no_fee_line (fee 라인 없음)
- test_render_json_has_all_four_wac_fields → test_render_json_has_three_wac_fields
- 동일 CLI 통합 테스트 보정

결과: 717 passed, 47 skipped

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
This commit is contained in:
2026-06-26 20:35:17 +09:00
co-authored by Claude Sonnet 4.6
parent 73d3b35ab2
commit d3e4af59cf
4 changed files with 42 additions and 78 deletions
-7
View File
@@ -668,7 +668,6 @@ def _cmd_verify(args, cfg) -> int:
def _cmd_report(args, cfg) -> int:
"""REQ-088/110/111: holdings / today's fills / WAC realized PnL / pending — direct-DB."""
import psycopg
from datetime import date, timedelta
from trex_core.application.operator_report import (
Holding,
@@ -676,7 +675,6 @@ def _cmd_report(args, cfg) -> int:
TradeRow,
apply_wac_to_report,
build_report,
buy_fee_by_asset,
kst_day_bounds_utc,
render_json,
render_text,
@@ -749,15 +747,10 @@ def _cmd_report(args, cfg) -> int:
key = item.symbol or pid
wac_by_asset_accum[key] = wac_by_asset_accum.get(key, 0.0) + item.realized_pnl
# OQ-3: buy_fee_only_assets = 당일 매수 거래 fee 합산 (매도 없는 자산 대상)
sell_assets = {t.asset_id for t in trades if t.side == "sell"}
buy_fee_only = buy_fee_by_asset(trades, exclude_symbols=sell_assets)
apply_wac_to_report(
rep,
wac_total=wac_total,
wac_by_asset=wac_by_asset_accum,
buy_fee_only_assets=buy_fee_only,
data_completeness_warning=any_warning,
)