From 238c4d1caf44f16a724956a7b71e94ed0e0e5cd2 Mon Sep 17 00:00:00 2001 From: zephyrdark Date: Wed, 18 Feb 2026 21:51:05 +0900 Subject: [PATCH] feat: accept valuation amount instead of price for rebalancing input For holdings with quantity > 0, the input now accepts the total valuation amount and derives the current price by dividing by quantity. Holdings with quantity 0 (target-only) still accept price directly. Co-Authored-By: Claude Opus 4.6 --- .../src/app/portfolio/[id]/rebalance/page.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/portfolio/[id]/rebalance/page.tsx b/frontend/src/app/portfolio/[id]/rebalance/page.tsx index 2ddc6ca..574938f 100644 --- a/frontend/src/app/portfolio/[id]/rebalance/page.tsx +++ b/frontend/src/app/portfolio/[id]/rebalance/page.tsx @@ -111,8 +111,13 @@ export default function RebalancePage() { setError(null); try { const priceMap: Record = {}; - for (const [ticker, price] of Object.entries(prices)) { - priceMap[ticker] = parseFloat(price); + for (const [ticker, value] of Object.entries(prices)) { + const qty = getHoldingQty(ticker); + if (qty > 0) { + priceMap[ticker] = parseFloat(value) / qty; + } else { + priceMap[ticker] = parseFloat(value); + } } const body: Record = { @@ -190,23 +195,25 @@ export default function RebalancePage() { {/* Price Input */} - 현재 가격 입력 + 평가 금액 입력
{Object.keys(prices).map((ticker) => { const target = targets.find((t) => t.ticker === ticker); + const qty = getHoldingQty(ticker); + const isValuation = qty > 0; return (
setPrices((prev) => ({ ...prev, [ticker]: e.target.value }))} - placeholder="현재 가격" + placeholder={isValuation ? '평가 금액' : '현재 가격'} className="mt-1" />