매매 시그널 알림에서 상세레포터 팝업오류 수정
This commit is contained in:
@@ -8,12 +8,12 @@ import { useTradeNotification, type TradeNotificationItem } from '../contexts/Tr
|
|||||||
import {
|
import {
|
||||||
loadBacktestSettings,
|
loadBacktestSettings,
|
||||||
loadPaperSummary,
|
loadPaperSummary,
|
||||||
loadStrategy,
|
|
||||||
runBacktest,
|
runBacktest,
|
||||||
type PaperSummaryDto,
|
type PaperSummaryDto,
|
||||||
type StrategyDto,
|
type StrategyDto,
|
||||||
} from '../utils/backendApi';
|
} 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 { loadAnalysisCandles } from '../utils/analysisChartData';
|
||||||
import { buildChartBacktestReportModel } from '../utils/backtestReportModel';
|
import { buildChartBacktestReportModel } from '../utils/backtestReportModel';
|
||||||
import { candleTypeToTimeframe } from '../utils/strategyToChartIndicators';
|
import { candleTypeToTimeframe } from '../utils/strategyToChartIndicators';
|
||||||
@@ -253,7 +253,7 @@ export const TradeNotificationListPage: React.FC<Props> = ({
|
|||||||
|
|
||||||
const handleReportFromAlert = useCallback(async (item: TradeNotificationItem) => {
|
const handleReportFromAlert = useCallback(async (item: TradeNotificationItem) => {
|
||||||
if (!item.isRead) markAsRead(item.id);
|
if (!item.isRead) markAsRead(item.id);
|
||||||
if (!item.strategyId) {
|
if (!item.strategyId && !item.strategyName?.trim()) {
|
||||||
window.alert('전략 정보가 없어 상세분석 레포트를 생성할 수 없습니다.');
|
window.alert('전략 정보가 없어 상세분석 레포트를 생성할 수 없습니다.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -265,14 +265,19 @@ export const TradeNotificationListPage: React.FC<Props> = ({
|
|||||||
setReportOpen(false);
|
setReportOpen(false);
|
||||||
|
|
||||||
try {
|
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 (gen !== reportGenRef.current) return;
|
||||||
if (!strategy) {
|
if (!strategy || effectiveStrategyId == null) {
|
||||||
window.alert('전략을 불러올 수 없습니다.');
|
window.alert('전략을 불러올 수 없습니다.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const market = item.market.startsWith('KRW-') ? item.market : `KRW-${item.market}`;
|
const market = normalizeMarketCode(item.market);
|
||||||
const timeframe = candleTypeToTimeframe(item.candleType ?? '1m');
|
const timeframe = candleTypeToTimeframe(item.candleType ?? '1m');
|
||||||
const toTimeSec = normalizeEpochSec(item.candleTime);
|
const toTimeSec = normalizeEpochSec(item.candleTime);
|
||||||
const bars = await loadAnalysisCandles(market, timeframe, toTimeSec, REPORT_BAR_COUNT);
|
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 strategyName = strategy.name || item.strategyName || '전략';
|
||||||
const btSettings = await loadBacktestSettings();
|
const btSettings = await loadBacktestSettings();
|
||||||
const res = await runBacktest({
|
const res = await runBacktest({
|
||||||
strategyId: item.strategyId,
|
strategyId: effectiveStrategyId,
|
||||||
bars: bars.map(b => ({
|
bars: bars.map(b => ({
|
||||||
time: b.time,
|
time: b.time,
|
||||||
open: b.open,
|
open: b.open,
|
||||||
@@ -331,7 +336,7 @@ export const TradeNotificationListPage: React.FC<Props> = ({
|
|||||||
} finally {
|
} finally {
|
||||||
if (gen === reportGenRef.current) setReportLoadingId(null);
|
if (gen === reportGenRef.current) setReportLoadingId(null);
|
||||||
}
|
}
|
||||||
}, [markAsRead, reportLoadingId, getParams]);
|
}, [markAsRead, reportLoadingId, getParams, strategies]);
|
||||||
|
|
||||||
const handleDeleteOne = useCallback(async (item: TradeNotificationItem, e: React.MouseEvent) => {
|
const handleDeleteOne = useCallback(async (item: TradeNotificationItem, e: React.MouseEvent) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|||||||
Reference in New Issue
Block a user