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