diff --git a/agents/stock/workspace/scripts/behive_web.py b/agents/stock/workspace/scripts/behive_web.py index 5083e28..a306e9d 100644 --- a/agents/stock/workspace/scripts/behive_web.py +++ b/agents/stock/workspace/scripts/behive_web.py @@ -5759,6 +5759,12 @@ def _render_summary_panel(ordered_owners: list[str], owner_data: dict, balances: # 연도별/월별 절대 선택 — chart_ym('YYYY'=연도별·월별집계 / 'YYYY-MM'=월별·일별) 있으면 단위 강제 + period 필터. period = (chart_ym or '').strip() eff_unit = ('day' if len(period) > 4 else 'month') if period else chart_unit + # 절대 선택이 과거 기간(이번달·올해가 아님)이면 오늘 라이브 점·라이브 갱신을 끈다 — + # 과거 차트(예: 4월)에 today 순자산이 마지막 점·델타·하단값으로 섞이는 것 방지. 프리셋은 항상 today 포함. + _now_dt = datetime.now(KST) + period_is_current = True + if period: + period_is_current = (period == _now_dt.strftime('%Y')) if len(period) == 4 else (period == _now_dt.strftime('%Y-%m')) consolidated_parts: list[str] = [] by_account_parts: list[str] = [] @@ -5799,7 +5805,7 @@ def _render_summary_panel(ordered_owners: list[str], owner_data: dict, balances: prev_baseline_point = prev_baseline if prev_baseline else None # live current_pnl = current_net - baseline_nw - (시작점 이후 누적 cf + 오늘 cf). # series 마지막 점이 오늘이면 today_cf 는 baseline 이후 누적에 안 들어있으니 추가로 빼줘야 일관. - current_net = d.get('total_net') + current_net = d.get('total_net') if period_is_current else None if current_net is None: current_pnl = None else: @@ -5816,20 +5822,20 @@ def _render_summary_panel(ordered_owners: list[str], owner_data: dict, balances: today_cash_flow=None, mode=chart_mode, prev_baseline_point=prev_baseline, - rt_owner=owner, rt_base_net=d.get('total_net'), + rt_owner=(owner if period_is_current else None), rt_base_net=d.get('total_net'), )) else: # net 모드도 baseline 점(예: 5/1) prepend → 첫 영업일 변동이 0 기점에서 분기되는 모양. baseline 구간은 점선. chart_parts.append(_render_net_worth_chart( chart_series, - current_net=d.get('total_net'), + current_net=(d.get('total_net') if period_is_current else None), selected_days=chart_days, selected_unit=eff_unit, cash_flow_by_date=cf_by_date, today_cash_flow=today_cf, mode='net', prev_baseline_point=prev_baseline, - rt_owner=owner, rt_base_net=d.get('total_net'), + rt_owner=(owner if period_is_current else None), rt_base_net=d.get('total_net'), )) market_card = _render_market_indicators_card()