/** * 백테스팅 결과 통계 배지 — 차트 위에 오버레이로 표시. * 전략 선택 / 실행은 Toolbar의 드롭다운에서 담당. */ import React from 'react'; import type { BacktestStats } from '../utils/backendApi'; interface BacktestPanelProps { stats: BacktestStats | null; signalCount: number; onClear: () => void; } const BacktestPanel: React.FC = ({ stats, signalCount, onClear }) => { const fmt = (n: number) => (n * 100).toFixed(2) + '%'; const fmtWon = (n: number) => n >= 1000 ? (n / 10000).toFixed(0) + '만원' : n.toFixed(0) + '원'; const retColor = stats && stats.totalReturn > 0 ? '#26A69A' : stats && stats.totalReturn < 0 ? '#EF5350' : 'var(--text2)'; return (
시그널 {signalCount}개
{stats && ( <>
거래 {stats.totalTrades}회
승률 {fmt(stats.winRate)}
수익 {stats.totalReturn >= 0 ? '+' : ''}{fmt(stats.totalReturn)}
낙폭 {fmt(stats.maxDrawdown)}
{stats.finalEquity > 0 && (
최종자산 {fmtWon(stats.finalEquity)}
)} )}
); }; export default BacktestPanel;