상세투자분석 계산로직 수정

This commit is contained in:
Macbook
2026-06-07 15:12:42 +09:00
parent c4365283cf
commit e1cf2ea46d
14 changed files with 366 additions and 58 deletions
@@ -20,6 +20,7 @@ import {
WinRateCircle,
CompareBar,
} from './shared/analysisDashboardUi';
import { analysisMethodLabel } from '../utils/analysisMethodLabels';
const fmtDate = (ts: number) => {
const d = new Date(ts * 1000);
@@ -104,6 +105,11 @@ export function BacktestDashboard({
<span className="brd-dash-badge">{timeframe}</span>
<span className="brd-dash-badge">{periodStr}</span>
{createdAt && <span className="brd-dash-badge brd-dash-badge--time"> {fmtDateStr(createdAt)}</span>}
{a.analysisMethod && (
<span className="brd-dash-badge brd-dash-badge--method">
{analysisMethodLabel(a.analysisMethod)}
</span>
)}
</div>
</div>
<div className={`brd-dash-header-kpi${reportMode ? ' brd-dash-header-kpi--report' : ''}`}>
@@ -141,6 +147,18 @@ export function BacktestDashboard({
<div className="brd-card-body">
<MetricRow label="총 수익률" value={pct(a.totalReturnPct)} cls={colorCls(a.totalReturnPct)}/>
<MetricRow label="총 손익 (금액)" value={wonFmt(a.totalProfitLoss)} cls={colorCls(a.totalProfitLoss)}/>
{a.realizedPnl != null && (
<MetricRow label="실현 손익" value={wonFmt(a.realizedPnl)} cls={colorCls(a.realizedPnl)} />
)}
{a.unrealizedPnl != null && a.unrealizedPnl !== 0 && (
<MetricRow label="평가 손익" value={wonFmt(a.unrealizedPnl)} cls={colorCls(a.unrealizedPnl)} />
)}
{a.cashBalance != null && a.cashBalance > 0 && (
<MetricRow label="기말 예수금" value={wonFmt(a.cashBalance)} />
)}
{a.holdingsValue != null && a.holdingsValue > 0 && (
<MetricRow label="보유 평가액" value={wonFmt(a.holdingsValue)} />
)}
<MetricRow label="총 이익" value={wonFmt(a.grossProfit)} cls="brd-pos"/>
<MetricRow label="총 손실" value={wonFmt(a.grossLoss)} cls="brd-neg"/>
<MetricRow label="평균 수익률/거래" value={pct(a.avgReturnPct)} cls={colorCls(a.avgReturnPct)}/>