From bdc0ae8a252b2b1e021bdaff682bc58898ff14bb Mon Sep 17 00:00:00 2001 From: Macbook Date: Mon, 8 Jun 2026 01:39:14 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A7=A4=EB=A7=A4=20=EC=8B=9C=EA=B7=B8?= =?UTF-8?q?=EB=84=90=20=EC=95=8C=EB=A6=BC=EC=97=90=EC=84=9C=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=EB=A0=88=ED=8F=AC=ED=84=B0=20=ED=8C=9D=EC=97=85?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/TradeNotificationListPage.tsx | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/TradeNotificationListPage.tsx b/frontend/src/components/TradeNotificationListPage.tsx index c8af6f4..dffe889 100644 --- a/frontend/src/components/TradeNotificationListPage.tsx +++ b/frontend/src/components/TradeNotificationListPage.tsx @@ -8,12 +8,12 @@ import { useTradeNotification, type TradeNotificationItem } from '../contexts/Tr import { loadBacktestSettings, loadPaperSummary, - loadStrategy, runBacktest, type PaperSummaryDto, type StrategyDto, } from '../utils/backendApi'; -import { prefetchNotificationStrategies } from '../utils/resolveNotificationStrategy'; +import { prefetchNotificationStrategies, resolveNotificationStrategy } from '../utils/resolveNotificationStrategy'; +import { normalizeMarketCode } from '../utils/strategyHydrate'; import { loadAnalysisCandles } from '../utils/analysisChartData'; import { buildChartBacktestReportModel } from '../utils/backtestReportModel'; import { candleTypeToTimeframe } from '../utils/strategyToChartIndicators'; @@ -253,7 +253,7 @@ export const TradeNotificationListPage: React.FC = ({ const handleReportFromAlert = useCallback(async (item: TradeNotificationItem) => { if (!item.isRead) markAsRead(item.id); - if (!item.strategyId) { + if (!item.strategyId && !item.strategyName?.trim()) { window.alert('전략 정보가 없어 상세분석 레포트를 생성할 수 없습니다.'); return; } @@ -265,14 +265,19 @@ export const TradeNotificationListPage: React.FC = ({ setReportOpen(false); try { - const strategy = await loadStrategy(item.strategyId); + const { strategy, strategyId: effectiveStrategyId } = await resolveNotificationStrategy( + item.strategyId, + item.strategyName, + strategies, + item.market, + ); if (gen !== reportGenRef.current) return; - if (!strategy) { + if (!strategy || effectiveStrategyId == null) { window.alert('전략을 불러올 수 없습니다.'); return; } - const market = item.market.startsWith('KRW-') ? item.market : `KRW-${item.market}`; + const market = normalizeMarketCode(item.market); const timeframe = candleTypeToTimeframe(item.candleType ?? '1m'); const toTimeSec = normalizeEpochSec(item.candleTime); const bars = await loadAnalysisCandles(market, timeframe, toTimeSec, REPORT_BAR_COUNT); @@ -285,7 +290,7 @@ export const TradeNotificationListPage: React.FC = ({ const strategyName = strategy.name || item.strategyName || '전략'; const btSettings = await loadBacktestSettings(); const res = await runBacktest({ - strategyId: item.strategyId, + strategyId: effectiveStrategyId, bars: bars.map(b => ({ time: b.time, open: b.open, @@ -331,7 +336,7 @@ export const TradeNotificationListPage: React.FC = ({ } finally { if (gen === reportGenRef.current) setReportLoadingId(null); } - }, [markAsRead, reportLoadingId, getParams]); + }, [markAsRead, reportLoadingId, getParams, strategies]); const handleDeleteOne = useCallback(async (item: TradeNotificationItem, e: React.MouseEvent) => { e.stopPropagation();