- {items.map((item) => {
- const profitAmt = item.profit_amount;
- const profitRate = item.profit_rate;
- const profitAmtN = toNumeric(profitAmt);
- const profitRateN = toNumeric(profitRate);
- const isEditing = pf.editingId === item.id;
- const isDeleting = pf.deleteConfirmId === item.id;
- const isSelling = pf.sellConfirmId === item.id;
- const sellPrice = item.current_price ?? item.avg_price;
- const saleAmount = sellPrice != null ? sellPrice * (item.quantity ?? 0) : null;
-
- return (
-
- {isEditing ? (
-
- ) : (
- <>
-
-
- {item.name ?? item.ticker ?? 'N/A'}
-
-
- {item.ticker ?? ''}
-
-
-
- 수량
- {formatNumber(item.quantity)}
-
-
- 평균단가
- {formatNumber(item.avg_price)}
-
-
- 매입가
- {formatNumber(item.purchase_price ?? item.avg_price)}
-
-
-
현재가
-
- {item.current_price != null
- ? formatNumber(item.current_price)
- : '조회 실패'}
-
-
-
-
- 평가금액
-
- {item.current_price != null && item.quantity != null
- ? formatNumber(item.current_price * item.quantity)
- : '-'}
-
-
-
- 수익률
-
- {profitRate != null ? formatPercent(profitRate) : '-'}
-
-
-
- 평가손익
-
- {profitAmt != null ? formatNumber(profitAmt) : '-'}
-
-
-
- {!isSelling && !isDeleting && (
-
- )}
- {isSelling ? (
-
-
- {item.current_price == null && (
- 현재가 미조회 — 매입가 기준
- )}
- {saleAmount != null
- ? `${formatNumber(saleAmount)}원 매도 후 예수금 반영`
- : '매도 처리'}
-
-
-
-
- ) : isDeleting ? (
- <>
-
-
- >
- ) : (
- <>
-
-
- >
- )}
-
- >
- )}
-
- );
- })}
-