From c15ea96e2fc232494c095eb7e2e310531bc6be54 Mon Sep 17 00:00:00 2001 From: gahusb Date: Wed, 15 Apr 2026 02:10:17 +0900 Subject: [PATCH] =?UTF-8?q?fix(stock-lab):=20=EC=B4=9D=20=EB=A7=A4?= =?UTF-8?q?=EC=9E=85=20=EA=B8=88=EC=95=A1=EC=9D=84=20=EC=A2=85=EB=AA=A9?= =?UTF-8?q?=EB=B3=84=20=EB=A7=A4=EC=9E=85=EA=B0=80=EC=9D=98=20=EB=8B=A8?= =?UTF-8?q?=EC=88=9C=20=ED=95=A9=EA=B3=84=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 수량을 곱하지 않고 purchase_price 값만 그대로 합산. Co-Authored-By: Claude Opus 4.6 --- stock-lab/app/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stock-lab/app/main.py b/stock-lab/app/main.py index 3db1394..8b61cf8 100644 --- a/stock-lab/app/main.py +++ b/stock-lab/app/main.py @@ -332,7 +332,8 @@ def get_portfolio(): # purchase_price: 매입가 — 총 매입 금액 표시 기준 (없으면 avg_price로 폴백) purchase_price = item.get("purchase_price") if item.get("purchase_price") is not None else item["avg_price"] cost_basis = item["avg_price"] * item["quantity"] - buy_amount = purchase_price * item["quantity"] + # 총 매입 금액 표시는 종목별 매입가의 단순 합계 (수량 미곱산) + buy_amount = purchase_price eval_amount = current_price * item["quantity"] if current_price is not None else None profit_amount = (eval_amount - cost_basis) if eval_amount is not None else None profit_rate = round((profit_amount / cost_basis) * 100, 2) if (profit_amount is not None and cost_basis) else None