From 9d9c14c2b1718a86dd377f176d655615ac2bcc5d Mon Sep 17 00:00:00 2001 From: Macbook Date: Thu, 11 Jun 2026 17:45:08 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B0=B1=ED=85=8C=EC=8A=A4=ED=8C=85=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89=20=EC=8B=9C=20=EC=9D=B8=EB=94=94=EC=BC=80?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0(indic?= =?UTF-8?q?atorParams)=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BacktestHistoryPage와 StrategyEditorPage의 handleQuickRun에서 runBacktest 호출 시 loadIndicatorSettings()로 사용자 저장 파라미터를 불러와 indicatorParams로 함께 전송한다. 이를 통해 백엔드가 기본값(kLength=14, smooth=3) 대신 사용자 설정값 (kLength=12, smooth=5 등)으로 지표를 계산하여 차트와 동일한 스토캐스틱 교차 지점에서 정확히 시그널을 생성한다. Co-authored-by: Cursor --- frontend/src/components/BacktestHistoryPage.tsx | 13 ++++++++----- frontend/src/components/StrategyEditorPage.tsx | 14 ++++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/BacktestHistoryPage.tsx b/frontend/src/components/BacktestHistoryPage.tsx index a69af47..5f13bf6 100644 --- a/frontend/src/components/BacktestHistoryPage.tsx +++ b/frontend/src/components/BacktestHistoryPage.tsx @@ -13,6 +13,7 @@ import { loadStrategies, runBacktest, loadBacktestSettings, + loadIndicatorSettings, API_BASE, type BacktestResultRecord, type BacktestAnalysis, @@ -221,8 +222,9 @@ export function BacktestHistoryPage({ theme = 'dark' }: Props) { setRunLoading(true); setRunError(null); try { - const [settings, barsRes] = await Promise.all([ + const [settings, indicatorParams, barsRes] = await Promise.all([ loadBacktestSettings(), + loadIndicatorSettings(), fetch(`${API_BASE}/candles/history?${new URLSearchParams({ market: runMarket, type: timeframeToCandleType(runTimeframe), @@ -238,12 +240,13 @@ export function BacktestHistoryPage({ theme = 'dark' }: Props) { } const strategy = strategies.find(s => s.id === runStrategyId); const result = await runBacktest({ - strategyId: runStrategyId, + strategyId: runStrategyId, bars, - timeframe: runTimeframe, + timeframe: runTimeframe, settings, - symbol: runMarket, - strategyName: strategy?.name, + indicatorParams, + symbol: runMarket, + strategyName: strategy?.name, }); if (!result) throw new Error('백테스팅 실행에 실패했습니다.'); // 결과 목록 갱신 후 새 결과 자동 선택 diff --git a/frontend/src/components/StrategyEditorPage.tsx b/frontend/src/components/StrategyEditorPage.tsx index a856b52..8600936 100644 --- a/frontend/src/components/StrategyEditorPage.tsx +++ b/frontend/src/components/StrategyEditorPage.tsx @@ -86,7 +86,7 @@ import { readStoredSize, storeSize, usePanelResize } from './strategyEditor/useP import StrategyDescriptionModal from './strategyEditor/StrategyDescriptionModal'; import ReactDOM from 'react-dom'; import { MarketSearchPanel } from './MarketSearchPanel'; -import { runBacktest, loadBacktestSettings, API_BASE } from '../utils/backendApi'; +import { runBacktest, loadBacktestSettings, loadIndicatorSettings, API_BASE } from '../utils/backendApi'; import { timeframeToCandleType } from '../utils/chartCandleType'; import { getKoreanName } from '../utils/marketNameCache'; import type { Timeframe } from '../types'; @@ -981,8 +981,9 @@ export default function StrategyEditorPage({ theme, onNavigateToBacktest }: Prop setQbError(null); try { const selectedStrategy = strategies.find(s => s.id === selectedId); - const [settings, barsRes] = await Promise.all([ + const [settings, indicatorParams, barsRes] = await Promise.all([ loadBacktestSettings(), + loadIndicatorSettings(), fetch(`${API_BASE}/candles/history?${new URLSearchParams({ market: qbMarket, type: timeframeToCandleType(qbTimeframe), @@ -997,12 +998,13 @@ export default function StrategyEditorPage({ theme, onNavigateToBacktest }: Prop throw new Error('캔들 데이터가 부족합니다. 타임프레임을 변경하거나 잠시 후 다시 시도해주세요.'); } const result = await runBacktest({ - strategyId: selectedId, + strategyId: selectedId, bars, - timeframe: qbTimeframe, + timeframe: qbTimeframe, settings, - symbol: qbMarket, - strategyName: selectedStrategy?.name, + indicatorParams, + symbol: qbMarket, + strategyName: selectedStrategy?.name, }); if (!result) throw new Error('백테스팅 실행에 실패했습니다.'); if (result.resultId) {