매매 시그널 알림에서 상세레포터 팝업오류 수정
This commit is contained in:
@@ -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<Props> = ({
|
||||
|
||||
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<Props> = ({
|
||||
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<Props> = ({
|
||||
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<Props> = ({
|
||||
} 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();
|
||||
|
||||
Reference in New Issue
Block a user